@@ -5,16 +5,6 @@ The goal of this project is to demonstrate how to build a Kubernetes cluster on
55- Vagrant/Virtual Box
66- Home lab (coming soon)
77- The plan in the future is to deploy it on some cheap cloud VM's
8- ## Dependencies
9- ### Ansible
10- Ansible version is core 2.19.0. To install do:
11- ``` shell
12- sudo apt install python3-venv -y
13- python3 -m venv ~ /venvs/ansible
14- source ~ /venvs/ansible/bin/activate
15- pip install ansible-core==2.19.0
16- ```
17- Then ` source path/to/venv/bin/activate `
188### Vagrant
199- Install Vagrant and Virtual Box-
2010## Inventories
@@ -25,16 +15,52 @@ Then `source path/to/venv/bin/activate`
2515192.168.56.112 srv2
2616192.168.56.113 srv3
2717```
28- #### Deploy to Vagrant
29- Then from the root of the project:
18+ #### Local Development (Devcontainer)
19+ Ansible is run from a devcontainer to ensure a consistent, up-to-date version. You will need:
20+ - [ Docker] ( https://docs.docker.com/engine/install/ )
21+ - VS Code with the [ Dev Containers] ( https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers ) extension
22+
23+ ** 1. Open the project in the devcontainer**
24+
25+ Open the project in VS Code, then either accept the "Reopen in Container" popup or run via the command palette (` Ctrl+Shift+P ` ):
26+ ```
27+ Dev Containers: Reopen in Container
28+ ```
29+ The first run will pull the image and may take a minute. Subsequent opens are instant.
30+
31+ ** 2. Start the Vagrant VMs**
32+
33+ From a terminal on your ** host machine** (not inside VS Code):
3034``` shell
3135vagrant up
3236```
33- You should then be able to ssh to each node with ` vagrant ssh ${node_name} `
34- #### Re-running plays
35- Run:
37+ This boots the three VMs without running Ansible. You can verify they are up with:
38+ ``` shell
39+ vagrant status
40+ ```
41+
42+ ** 3. Install Ansible roles**
43+
44+ From the VS Code terminal (inside the devcontainer):
45+ ``` shell
46+ ansible-galaxy install -r roles/requirements.yml
47+ ```
48+
49+ ** 4. Run the playbook**
50+
51+ ``` shell
52+ ansible-playbook -i inventory/local_vagrant site.yml --become
53+ ```
54+
55+ ** Re-running the playbook**
56+
57+ Just re-run step 4. No need to restart the VMs.
58+
59+ ** Tearing down**
60+
61+ From the host terminal:
3662``` shell
37- vagrant provision
63+ vagrant destroy -f
3864```
3965### Home Servers
4066- This is a for sure a work in progress.... Currently, I only have three Lenovo m910q machines plugged straight into my ISP modem (It's not serving anything to the internet).
0 commit comments