📖 ~1 min read
Table of contents
Symptom & Impact
kubeadm preflight fails and cluster bootstrap cannot continue.
Environment & Reproduction
Seen on fresh Ubuntu hosts with default swap file active.
swapon --show
free -h
sudo kubeadm init
Root Cause Analysis
Kubernetes requires swap off for stable memory scheduling on many deployments.
Quick Triage
Verify swap state and kubelet logs.
swapon --show
sudo systemctl status kubelet
sudo journalctl -u kubelet -n 120 --no-pager
Step-by-Step Diagnosis
Identify swap entries in fstab and cloud-init files.
grep -n 'swap' /etc/fstab
ls -l /swap.img 2>/dev/null || true
cat /proc/swaps

Solution – Primary Fix
Disable active swap and remove persistent mount entry.
Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.
sudo swapoff -a
sudo sed -i.bak '/sswaps/s/^/#/' /etc/fstab
swapon --show

Solution – Alternative Approaches
Use kubelet config to tolerate swap only for specific lab scenarios.
sudo sed -i 's/^KUBELET_EXTRA_ARGS=.*/KUBELET_EXTRA_ARGS=--fail-swap-on=false/' /etc/default/kubelet
sudo systemctl restart kubelet
Verification & Acceptance Criteria
No swap devices active and kubeadm preflight passes.
swapon --show
sudo kubeadm init --dry-run
sudo systemctl is-active kubelet
Rollback Plan
Re-enable swap if host role changes away from Kubernetes.
sudo sed -i '/swap/s/^#//' /etc/fstab
sudo swapon -a
swapon --show
Prevention & Hardening
Bake swap-off policy into node provisioning templates.
grep -n swap /etc/fstab
cloud-init status --long
Related Errors & Cross-Refs
Can co-occur with cgroup driver mismatch between kubelet and container runtime.
Related tutorial: View the step-by-step tutorial for Ubuntu 24.04 LTS.
View all Ubuntu 24.04 LTS tutorials on the Tutorials Hub →
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
Kubernetes on Ubuntu installation and kubeadm preflight guidance.
Need Expert Help?
If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today — we respond within one business day.