Building a Kubernetes Cluster on a laptop using kubeadm, VirtualBox, and Vagrant
Can be follow for: Windows, Mac x86 (Intel) or Mac Silicon (M series)

Search for a command to run...
Can be follow for: Windows, Mac x86 (Intel) or Mac Silicon (M series)

No comments yet. Be the first to comment.
A real-world DevOps journey covering CI/CD, Infrastructure as Code, automation, security, and cloud-native design — based on practical enterprise experience. No theory, only implementation-focused guides and architecture thinking.
Gateway API Project
Azure Solution for SmartBuildings

RAG

Make it variables and reusable

Scaling pipeline to accept Dynamic inputs

Scaling with branches

Running Kubernetes locally is one of the best ways to understand how clusters work internally. In this article, I’ll walk through how I built a multi-node Kubernetes cluster on my Mac using Vagrant and VirtualBox, bootstrapped it with kubeadm, installed networking with Calico, and finally deployed an Nginx application to verify everything works.
This setup is perfect for DevOps engineers, SREs, and Kubernetes learners who want a production-like environment on their laptop.
Tips -
Follow/Read this article first to get base idea and then deploy as per your requirement by using cka-practice-code repo for specfic commands
Mac (Host Machine)
│
▼
VirtualBox Hypervisor
│
▼
Vagrant Managed VMs
│
├── controlplane
├── node01
└── node02
Tools used in the lab:
Oracle VM VirtualBox – VM hypervisor
Vagrant – Infrastructure automation
Kubernetes – Cluster platform
Project Calico – CNI networking plugin
| Node | CPU | RAM |
|---|---|---|
| controlplane | 2 | 2GB |
| node01 | 2 | 2GB |
| node02 | 2 | 2GB |
Install the following tools on Windows or macOS x86.
Download and install Oracle VM VirtualBox
https://www.virtualbox.org/wiki/Downloads
App click VirtualBox to complete the installation
brew tap hashicorp/tap
brew install hashicorp/tap/hashicorp-vagrant
vagrant --version
cka-practice-code/kubeadm-clusters/virtualbox and type vagrant up to start creating virtual machines (Controlplane, node01 & node02) through a script
Note the IPs after completion, required for SSH
We can check the status in Oracle Virtual Manager as well
Use the commands below to play with the environment
Check Status
vagrant status
Stop all VMs:
vagrant halt
Destroy environment:
vagrant destroy
Show VM's Names
VBoxManage list vms | awk -F\" '{print $2}'
https://canonical.com/multipass/install
./deploy-virtual-machines.sh
./destroy-virtual-machines.shControlplane, node01 & node3Tips - Kubernetes document for reference
Go to the repo 04-node-setup.md and start running commands one by one
Connect all three by SSH with the below credentials.
username: vagrant
password: vagrant
Note- Run all these commands on all three (Controlplane, node01, node2)
Configure Controlplane by following 05-Controlplane.md commands
Note- Run this only on Controlplane
Refer CNI documents but required commands provided in repo itself
Remember to copy the kubeadm join command and follow the remaining steps until
kubectl get pods -n kube-system
Hope you have the below ready-to-use command copied from Controlplane; otherwise, it can be retrieved by using kubeadm token create --print-join-command
kubeadm join 192.168.0.185:6443 --token 2lccuf.ha2rxb9dclxzkvrp \
--discovery-token-ca-cert-hash sha256:26d681f9cd77e66a71bbe5e4cd903fae34458660ce2304ff7b73f168fcf9c4c2
Run the following command on controlplane to get the browser address, then copy the output to your browser:
echo "http://\((dig +short node01):\)PORT_NUMBER"
Building Kubernetes manually with kubeadm provides a deeper understanding of:
Control plane components
Node registration
Cluster networking
Kubernetes troubleshooting
Real production cluster architecture
✔ Multi-node Kubernetes cluster running locally
✔ Networking configured with Calico
✔ Worker nodes successfully joined
✔ Nginx application deployed and accessible from the browser
This environment closely simulates a real production Kubernetes setup and is extremely useful for learning Kubernetes architecture and troubleshooting.
Thanks for your time and effort to get your hands dirty.
Abhinandan Chougule