To install KVM, libvirt:
chmod +x kvm.sh
./kvm.sh
🔴 Now, fix the error in KVM with the steps under KVM/QEMU & libvirt Verification
To install kubectl, minikube:
chmod +x start.sh kubectl.sh minikube.sh
./start.sh
(Optional) Set kvm2 as default driver for minikube:
minikube config set vm-driver kvm2
KVM, libvirt, kubectl, minikube should be installed now. Check their status with the steps ahead.
After installing libvirt, you may verify the host validity to run the virtual machines with virt-host-validate tool, which is a part of libvirt.
sudo virt-host-validate
🔴IOMMU Error Reference:
If you see error iommu appears to be disabled in kernel. add intel_iommu=on to kernel cmdline arguments then follow the following steps:
Edit /etc/default/grub and add the option "intel_iommu=on" to GRUB_CMDLINE_LINUX or GRUB_CMDLINE_LINUX_DEFAULT:
GRUB_CMDLINE_LINUX="intel_iommu=on"
These changes will take effect once you run:
sudo update-grub or grub-mkconfig -o /boot/grub/grub.cfg
Finally,
sudo reboot
After installation check Minikube status:
minikube version
To start the cluster:
If default vm-driver was set before.
minikube start
If default vm-driver was NOT set before.
minikube start --vm-driver kvm2
Check if the Kubernetes cluster is up and running:
kubectl get nodes
Follow the steps below for cluster deployement:
chmod +x start.sh kubernetes.sh docker.shsudo su./start.sh- Comment out the line which has mention of swap partition in the file that opens (
/etc/fstab). - Add the hostnames of Master & Kubelets VMs in the next opened file (
/etc/hostname). - Add
Environment="cgroup-driver=systemd/cgroup-driver=cgroupfs"in the next opened file (/etc/systemd/system/kubelet.service.d/10-kubeadm.conf)
- Initiate the cluster:
kubeadm init --apiserver-advertise-address=<ip-address-of-kmaster-vm> --pod-network-cidr=192.168.0.0/16
🔴It will give the join statement for kubelet nodes (KEEP IT!)
🔴The output will ask to execute the following commands (CROSS CHECK ALWAYS):
- Come back to regular user from SuperUser profile.
mkdir -p $HOME/.kubecp -i /etc/kubernetes/admin.conf $HOME/.kube/configchown $(id -u):$(id -g) $HOME/.kube/config- Verify the cluster with
kubectl get pods -o wide --all-namespaces
🔴You will notice from the previous command, that all the pods are running except one: ‘kube-dns’. For resolving this we will install a pod network. To install the CALICO pod network, run the following command:
kubectl apply -f https://docs.projectcalico.org/v3.14/manifests/calico.yaml
- Connect the Kubelet to the cluster using the statement saved from
7output that looks like:kubeadm join <IP>:<PORT> --token <TOKEN> --discovery-token-ca-cert-hash <SHA256-VALUE> - Check nodes' health with
kubectl get nodes.