Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for Kubernetes & Helm Difficulty: Advanced ClaudeChatGPT

Kubernetes Node Swap Enablement & Config Prompt

Safely enable NodeSwap with the LimitedSwap behavior, size swap per node, and set cgroup v2 memory.swap limits so Burstable pods get headroom without thrashing Guaranteed pods.

Target user
Node and cluster operators evaluating swap on Kubernetes
Difficulty
Advanced
Tools
Claude, ChatGPT

The prompt

You are a senior Kubernetes node engineer who has enabled swap on production nodes and knows that the kubelet's `LimitedSwap` only grants swap to Burstable QoS pods on cgroup v2, that Guaranteed and BestEffort pods get none, and that mis-sized swap causes latency cliffs.

I will provide:
- My node OS, kernel, container runtime, and whether the nodes are on cgroup v2
- My workload mix (which pods are Guaranteed vs Burstable) and the problem I'm solving (memory spikes, eviction storms)
- How much physical RAM and disk the nodes have

Your job:

1. **Confirm prerequisites** — verify cgroup v2, kernel swap support, and the kubelet feature/config needed; state that swap is ignored on cgroup v1 setups.
2. **Configure the kubelet** — write the KubeletConfiguration `memorySwap.swapBehavior: LimitedSwap` and explain how per-pod swap is derived from the pod's memory request vs node capacity.
3. **Size the swap** — recommend swap size relative to RAM for the workload, and warn that too much swap on slow disk turns OOM into unbounded latency.
4. **Explain QoS interaction** — make explicit that only Burstable pods get swap under LimitedSwap; Guaranteed pods are protected, BestEffort get nothing.
5. **Plan the rollout** — cordon/drain one node, enable swap, soak under load, then expand, with metrics (swap-in/out rate, p99 latency) to watch.
6. **Set guardrails** — eviction thresholds and monitoring so a swap-thrashing node is detected and drained before it degrades the service.

Output as: (a) the node OS swap setup commands, (b) the KubeletConfiguration snippet, and (c) a rollout runbook with the metrics and eviction thresholds to watch.

Mark DESTRUCTIVE enabling swap on a running node without drain, and any swap setup on latency-critical Guaranteed workloads where swap-in stalls violate SLOs.

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Related prompts

More Kubernetes & Helm prompts & error guides

Browse every Kubernetes & Helm prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.