Affected versions: Ubuntu 24.04 LTS

📖 ~1 min read

Table of contents
  1. Symptom & Impact
  2. Environment & Reproduction
  3. Root Cause Analysis
  4. Quick Triage
  5. Step-by-Step Diagnosis
  6. Solution – Primary Fix
  7. Solution – Alternative Approaches
  8. Verification & Acceptance Criteria
  9. Rollback Plan
  10. Prevention & Hardening
  11. Related Errors & Cross-Refs
  12. References & Further Reading

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
Illustrative mockup for ubuntu-24-04-lts — terminal_or_shell
Checking swap and kubelet readiness — Illustrative mockup — Progressive Robot

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
Illustrative mockup for ubuntu-24-04-lts — log_or_config
Disabling swap persistently — Illustrative mockup — Progressive Robot

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

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.