The goal of this project is to demonstrate how to build a Kubernetes cluster on bare metal or VMs and deploy it to multiple different environments.
- Vagrant/Virtual Box
- Home lab (coming soon)
- The plan in the future is to deploy it on some cheap cloud VM's
- Install Vagrant and Virtual Box-
- Add the following to your hosts file:
192.168.56.111 srv1
192.168.56.112 srv2
192.168.56.113 srv3Ansible is run from a devcontainer to ensure a consistent, up-to-date version. You will need:
- Docker
- VS Code with the Dev Containers extension
1. Open the project in the devcontainer
Open the project in VS Code, then either accept the "Reopen in Container" popup or run via the command palette (Ctrl+Shift+P):
Dev Containers: Reopen in Container
The first run will pull the image and may take a minute. Subsequent opens are instant.
2. Start the Vagrant VMs
From a terminal on your host machine (not inside VS Code):
vagrant upThis boots the three VMs without running Ansible. You can verify they are up with:
vagrant status3. Install Ansible roles and collections
From the VS Code terminal (inside the devcontainer):
ansible-galaxy install -r roles/requirements.yml
ansible-galaxy collection install -r collections/requirements.yml4. Run the playbook
ansible-playbook -i inventory/local_vagrant site.yml --becomeRe-running the playbook
Just re-run step 4. No need to restart the VMs.
Tearing down
From the host terminal:
vagrant destroy -f- 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).
- I plan to extend this with a pfsense or opnsense firewall and implement vLANs, VPN and isolate everything from my home devices before serving anything over the internet.
| Host | Host 1 | Host 2 | Host 3 |
|---|---|---|---|
| Model | Lenovo m910q | Lenovo m910q | Lenovo m910q |
| CPU | Intel i5 7500T | Intel i5 7500T | Intel i5 7500T |
| RAM | 8GB | 8GB | 8GB |
| Storage | 256GB NVM | 256GB NVM | 256GB NVM |
| NIC | Intel 1Gb I219-LM | Intel 1Gb I219-LM | Intel 1Gb I219-LM |