Automates the setup of a Kubernetes cluster using Kubeadm via Vagrant and VirtualBox for hands-on CKA, CKAD, and CKS exam practice environments.
Vagrantfile & Scripts to setup Kubernetes Cluster using Kubeadm for CKA, CKAD and CKS practice environment
This tool is designed for Kubernetes certification aspirants and DevOps practitioners who want a ready-to-use, local Kubernetes cluster environment for practicing CKA, CKAD, and CKS exam scenarios. It simplifies cluster provisioning on Windows, Ubuntu, and Intel-based Mac systems using Vagrant and VirtualBox, enabling users to focus on learning and testing Kubernetes skills without manual setup complexities.
Ensure your workstation has at least 8 GB RAM and supports running multiple VMs with 3 vCPUs and 4+ GB RAM each. Mac/Linux users should configure VirtualBox networking as described to avoid private network creation errors. The dashboard installation is enabled by default but can be disabled or re-enabled via the settings.yaml file. This tool is intended for Intel-based Macs; Mac Silicon users should use the dedicated repository linked in the README.
Install Vagrant and VirtualBox on your system
Clone the repository: git clone https://github.com/scriptcamp/vagrant-kubeadm-kubernetes.git
Navigate to the cloned directory: cd vagrant-kubeadm-kubernetes
Run the cluster provisioning command: vagrant up
Set the KUBECONFIG environment variable: cd configs and export KUBECONFIG=$(pwd)/config
Alternatively, copy the kubeconfig file to your home directory: cp config ~/.kube/
For Mac/Linux users, configure VirtualBox network by creating/editing /etc/vbox/networks.conf with '* 0.0.0.0/0 ::/0' to avoid network issues
git clone https://github.com/scriptcamp/vagrant-kubeadm-kubernetes.git
Clones the repository containing the Vagrantfile and setup scripts.
cd vagrant-kubeadm-kubernetes
Navigates to the cloned repository directory.
vagrant up
Provisions and starts the Kubernetes cluster VMs using Vagrant and VirtualBox.
cd configs && export KUBECONFIG=$(pwd)/config
Sets the KUBECONFIG environment variable to use the cluster's kubeconfig file.
cp config ~/.kube/
Copies the kubeconfig file to the default Kubernetes config directory for easier access.
vagrant ssh -c "/vagrant/scripts/dashboard.sh controlplane"
Installs or reinstalls the Kubernetes Dashboard on the cluster control plane node.
kubectl -n kubernetes-dashboard get secret/admin-user -o go-template="{{.data.token | base64decode}}"
Retrieves the login token for accessing the Kubernetes Dashboard.
kubectl proxy
Starts a proxy to make the Kubernetes Dashboard accessible via localhost.