Kubeclust sets up a kubernetes 1.34.0 cluster on three VirtualBox virtual machines (one master and two workers) running Ubuntu 22.04 LTS using kubeadm.
- Virtual environment with Python3
- Virtualbox
- Vagrant
In the virtual environment, run
$ pip install -r requirements.txt
Run vagrant up
to bring up three virtual machines.
The hostnames and IP addresses of the machines are as follows:
kubemaster — 192.168.56.20
worker1 – 192.168.56.21
worker2 – 192.168.56.22
In the virtual environment created earlier, run
$ make cluster
As soon as it is done, you can ssh into kubemaster to see the nodes and the pods in the cluster. They may take a while to get ready.
$ vagrant ssh kubemaster
Get nodes and pods.
vagrant@kubemaster:~$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
kubemaster Ready control-plane,master 7m2s v1.34.0
worker1 Ready <none> 6m33s v1.34.0
worker2 Ready <none> 6m33s v1.34.0
vagrant@kubemaster:~$ kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system calico-kube-controllers-5b97c7b9dd-vldz4 1/1 Running 0 2m
kube-system calico-node-gb89r 1/1 Running 0 113s
kube-system calico-node-r7xwv 1/1 Running 0 114s
kube-system calico-node-st7c8 1/1 Running 0 2m
kube-system coredns-66bc5c9577-b9pcv 1/1 Running 0 2m
kube-system coredns-66bc5c9577-j4psg 1/1 Running 0 2m
kube-system etcd-kubemaster 1/1 Running 0 2m8s
kube-system kube-apiserver-kubemaster 1/1 Running 0 2m6s
kube-system kube-controller-manager-kubemaster 1/1 Running 0 2m6s
kube-system kube-proxy-db9nx 1/1 Running 0 113s
kube-system kube-proxy-tn7xs 1/1 Running 0 114s
kube-system kube-proxy-z779d 1/1 Running 0 2m
kube-system kube-scheduler-kubemaster 1/1 Running 0 2m6s
$ make clean
This will drain the nodes, make sure that they are empty before shutting them down and reset all kubeadm installed state.