Kubernetes Cluster Setup in Laptop Using VirtualBox
- Download VirtualBox: https://www.virtualbox.org/wiki/Downloads
- Download Ubuntu 20.04.3 LTS: https://ubuntu.com/download/desktop/thank-you?version=20.04.3&architecture=amd64
- Install Ubuntu three times so that we will have 3 nodes for Kubernetes cluster. One Master node and other two as worker nodes.
- Create a NAT Network in Virtual Box (e.g. “Kubernetes Network”) from Network preferences section. Use Network CIDR as 10.0.2.0/24
- Attach NAT network to all three instances
- Set the hostnames of VMs as following:
sudo hostnamectl set-hostname k8s-control for Master node
sudo hostnamectl set-hostname k8s-worker1 for Worker node 1
sudo hostnamectl set-hostname k8s-worker2 for Worker node 2
- Edit /etc/hosts file to include IPs of all three nodes. For e.g.
10.0.2.4 k8s-worker1
10.0.2.15 k8s-control
10.0.2.5 k8s-worker2
- Run Following Commands in each of the nodes
cat