Create Two Ubuntu VM (MASTER AND WORKER): and SSH Into them using the link here
Install Docker Engine on both VM and enable Docker:
sudo apt-get install -y docker.io
sudo usermod –aG docker Ubuntu
sudo chmod 777 /var/run/docker.sock
sudo systemctl start docker
sudo systemctl enable docker
sudo systemctl status docker
- Installing kubelet, kubeadm and kubectl:
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl gpg
Download the public signing key for the Kubernetes package repositories. The same signing key is used for all repositories so you can disregard the version in the URL:
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
Add the appropriate Kubernetes apt repository.
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
Update the apt package index, install kubelet, kubeadm and kubectl, and pin their version:
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
Enable the kubelet service before running kubeadm
sudo systemctl restart kubelet
sudo systemctl status kubelet
sudo systemctl status kubelet
Adding kubeadm to a network (ON THE MASTER VM ONLY)
sudo kubeadm init --apiserver-advertise-address=(PRIVATE IP OF VM) --pod-network-cidr=192.168.0.0/16
Adding kubenetes cluser:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Back on WORKER NODE:
Follow the same process to - Install kubelet, kubeadm and kubectl:
Join the Master and Worker with the Join Command:
- Using the JOIN Command looks like this on the vm
sudo kubeadm join 172.31.56.164:6443 --token y82mmu.a9wairsns2hhrgtu \
--discovery-token-ca-cert-hash sha256:fd617bad969a4275a7a8d03c6bcb3a9a115196feb14c27ffc5371495e1dc6f84
to retrive the join command incase you didnt save it run this on Master VM
kubeadm token create --print-join-command
To test on Master VM:
kubectl get nodes
its show node NOT READY.
Set your port network Using Calico manifest:
click here for doc info
curl https://raw.githubusercontent.com/projectcalico/calico/v3.28.0/manifests/calico.yaml -O
kubectl apply -f calico.yaml
Run these commands on MASTER
kubectl get nodes
kubectl get pod -A
Create a pod to TEST:
kubectl run my-pod --image=nginx
kubectl get pods
Thank You for Following and Practicing.
Top comments (0)