This project provisions a fully functional, multi-node Kubernetes cluster locally using Vagrant, VirtualBox, and kubeadm.
The goal of this project is to simulate a production-style Kubernetes environment on local infrastructure, focusing on:
- Infrastructure reproducibility
- Proper Kubernetes bootstrapping
- Real-world debugging and failure handling
- DevOps best practices using Infrastructure as Code (IaC)
This project is also well-suited for CKA (Certified Kubernetes Administrator) and CKAD (Certified Kubernetes Application Developer) exam preparation, providing a hands-on environment that closely mirrors the exam cluster topology.
The cluster is designed to be portable, meaning it can be spun up on any compatible Windows or Linux machine using a single command:
vagrant up
- 1 Control Plane Node
- 2 Worker Nodes
| Node Name | Role | IP Address |
|---|---|---|
| k8s-master | Control Plane | 192.168.56.10 |
| k8s-worker-1 | Worker Node | 192.168.56.11 |
| k8s-worker-2 | Worker Node | 192.168.56.12 |
- Host Provisioning: Vagrant
- Hypervisor: VirtualBox
- Guest OS: Ubuntu 22.04 LTS
- Container Runtime: containerd
- Kubernetes Bootstrap: kubeadm
- Networking (CNI): Calico
- Kubernetes Version: v1.32
- Calico Version: v3.29.0
All version and network settings are centralised in config/settings.yaml:
kubernetes_version: "v1.32"
calico_version: "v3.29.0"
pod_cidr: "192.168.0.0/16"
master_ip: "192.168.56.10"To upgrade Kubernetes or Calico, change the version here — no need to touch any scripts or the Vagrantfile.
- Mirrors real-world Kubernetes bootstrapping.
- Avoids managed abstractions (EKS/AKS/GKE) to gain deeper understanding.
- Industry standard container runtime.
- Required explicit systemd cgroup alignment for kubelet compatibility.
- Production-grade networking solution.
- Supports network policies and scalable pod networking.
- Ensures deterministic node-to-node communication.
- Avoids dependency on external networks.
- Modular shell scripts for:
- OS preparation
- container runtime installation
- Kubernetes component installation
- Improves maintainability and debugging.
-
Installed Software
- VirtualBox
- Vagrant
- Git
-
Hardware
- Minimum 8 GB RAM (16 GB recommended)
- CPU virtualization enabled (VT-x / AMD-V)
- On Windows, Hyper-V, VBS, and host-only network adapters may interfere with VirtualBox.
- Linux hosts generally provide a smoother experience.
git clone https://github.com/Abhiram-Rakesh/K8s-Vagrant-Kubeadm-Cluster.git
cd K8s-Vagrant-Kubeadm-Cluster
vagrant up
This command will:
- Create 3 Ubuntu VMs
- Configure networking
- Install containerd
- Install Kubernetes components
- Initialize the control plane
- Deploy Calico
- Join worker nodes to the cluster
vagrant ssh k8s-master
kubectl get nodes
kubectl get pods -n kube-system
Expected output:
k8s-master Ready control-plane
k8s-worker-1 Ready
k8s-worker-2 Ready
To stop the VMs without destroying them:
vagrant halt
To destroy the cluster and free all resources:
vagrant destroy -f
This project intentionally documents real-world issues encountered during setup.
- Cause: A previous
vagrant upfailed mid-way, leaving stale VM registrations in VirtualBox - Fix:
- Open VirtualBox GUI → right-click each stale VM → Remove → Delete all files
- If VMs don't appear in GUI, unregister manually:
VBoxManage list vms VBoxManage unregistervm <uuid> --delete - Delete Vagrant's local state:
rm -r .vagrant - Run
vagrant up
- Cause: Hyper-V or Windows Hypervisor Platform is enabled and competing with VirtualBox for hardware virtualisation
- Fix:
- Open PowerShell as Administrator and check:
bcdedit /enum | findstr hypervisorlaunchtype - If it shows
Auto, disable it:bcdedit /set hypervisorlaunchtype off - Also disable in Windows Features: Hyper-V, Virtual Machine Platform, Windows Hypervisor Platform
- Reboot, then run
vagrant up
- Open PowerShell as Administrator and check:
- Cause: A leftover
VBoxHeadless.exeprocess from a previous run is holding port 2222 - Fix:
- Find the process:
netstat -ano | findstr :2222 - Kill it using the PID from the output:
taskkill /F /PID <pid> - Run
vagrant destroy -fthenvagrant up
- Find the process:
- Cause: Misaligned cgroup driver or corrupted runtime state
- Fix: Fully reset containerd and regenerate configuration with SystemdCgroup=true
- Cause: Transient API server unavailability during worker node join (cluster still stabilising post-Calico deployment)
- Fix: The worker script automatically retries the join up to 3 times. If it still fails, re-provision manually:
vagrant provision k8s-worker-1 vagrant provision k8s-worker-2
These issues and fixes closely resemble problems seen in on-prem and bare-metal Kubernetes environments.
This project demonstrates:
- End-to-end Kubernetes cluster provisioning using kubeadm
- Practical experience with container runtimes and kubelet behavior
- Debugging Kubernetes networking, certificates, and node bootstrap
- Infrastructure automation using Vagrant