[Solved] Vagrant Kubeadm Cluster Crashes on Reboot
- Last Updated On: April 5, 2022
- By: Scriptcrunch Editorial
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.
If you using Vagrant for Kubernetes Certification preparation, check out the Linux Foundation Coupons to save up to 50% on certifications.
Scriptcrunch Editorial
Other Interesting Blogs
CKA Certification Study Guide (Certified Kubernetes Administrator)
This comprehensive CKA certification exam study guide covers all the important aspects of the Certified Kubernetes Administrator exam and useful resources. Passing
[40% OFF] Linux Foundation LFCA, LFCS & LFCT Exam Voucher Codes
Linux Foundation has announced up to a $284 discount on its Linux certification programs Linux Foundation Certified IT Associate (LFCA) and Linux
Linux Foundation Coupon for September 2024
Hi Techies, I wanted to let you know about a pretty sweet deal with the Linux Foundation Coupon that is running now.