[Solved] Vagrant Kubeadm Cluster Crashes on Reboot
- Last Updated on: April 5, 2022
- By: scriptcrunch
Issue: If you set up a kubernetes cluster in Vagrant using kubeadm on a Ubuntu box, the cluster master node service may fail to start on a VM reboot.
If you check the kublet
logs, you will see connection refused errors for etcd service.
This issue is primarily due to swapoff
issue.
Kubeadm needs the swap to be off to function properly. Sometimes, even if you make the fstab
entry to disable the swap, it might not work as expected.
When you set up the cluster you might have run the following command. It will disable swap only for the running session. If you restart the VM, it gets enabled again.
swapoff -a
Solution
To solve the swapoff
issue, here is what you can do.
Create a crontab entry that disables swap on reboot. You can add the crontab entry using the following command.
(crontab -l 2>/dev/null; echo "@reboot /sbin/swapoff -a") | crontab -
If you restart the VM after setting the crontab, your kubernetes master services will come up automatically.
If you want an automated kubeadm cluster on vagrant, check out this Kubeadm vagrant Github Repository.
Also, check the Vagrant networking issue.
Other Interesting Blogs
Linux Foundation Coupon for 2022
Hi Techies, I wanted to let you know about a pretty sweet deal with the Linux Foundation Coupon that is running now.
CKA Exam Study Guide: Certified Kubernetes Administrator
Passing the cloud-native Certified Kubernetes Administrator (CKA) exam is not a cakewalk. To pass the CKA exam, you should have enough hands-on
Best Black Friday Deals For Techies & DevOps Enthusiasts
In this blog, we have listed down all the best Black Friday deals for techies. This is the best time to get