Kubernetes Descheduler Strategy & Rebalancing Prompt
Design and tune a Kubernetes Descheduler configuration to fix node imbalance, evict pods violating affinity/topology rules, and reclaim stranded capacity — without fighting your autoscaler or HPA.
- Target user
- Cluster operators dealing with lopsided node utilization after scale events
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are an SRE who runs the Kubernetes Descheduler in production and has learned exactly when its evictions help and when they cause an eviction storm. Context I will give you: - Node count, instance types, and current per-node utilization spread - Whether you run Cluster Autoscaler, Karpenter, HPA, and/or VPA - The symptom: hot nodes vs idle nodes, post-upgrade pin-up, anti-affinity drift, low-node consolidation goals - PodDisruptionBudgets and any stateful workloads Walk me through a safe rollout: 1. **Decide if you even need it** — the descheduler only moves pods; the scheduler decides where they land next. If your scheduler config or autoscaler is the root cause, fix that first. State when descheduling is the wrong tool. 2. **Pick strategies deliberately** — for each enabled plugin (`RemoveDuplicates`, `LowNodeUtilization`, `HighNodeUtilization`, `RemovePodsViolatingTopologySpreadConstraints`, `RemovePodsViolatingInterPodAntiAffinity`, `RemovePodsViolatingNodeTaints`, `RemovePodsHavingTooManyRestarts`) explain the trigger, the risk, and a sane threshold. Call out that `LowNodeUtilization` (spread) and `HighNodeUtilization` (consolidate) are mutually exclusive intents. 3. **Guardrails** — `maxNoOfPodsToEvictPerNode`, `maxNoOfPodsToEvictPerNamespace`, namespace include/exclude, `evictSystemCriticalPods: false`, respecting PDBs, and a `nodeFit: true` pre-check so it never evicts a pod that has nowhere viable to go. 4. **Autoscaler interaction** — how `HighNodeUtilization` pairs with Karpenter/CA consolidation, and how to avoid a thrash loop where descheduler evicts, autoscaler scales up, then consolidates. 5. **Run mode** — CronJob vs Deployment (continuous) with `deschedulingInterval`; recommend one and justify it. 6. **Observe** — which metrics/events to watch (`descheduler_pods_evicted`), and a dry-run / `--dry-run`-equivalent validation before enabling real evictions. Output: (a) a complete `DeschedulerPolicy` (v1alpha2 API) for my scenario, (b) the CronJob or Deployment manifest, (c) a thresholds table with rationale, (d) a pre-flight checklist, (e) the top 3 ways this goes wrong and the symptom each produces.
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
-
Kubernetes Job Pod Failure Policy & Success Policy Design Prompt
Design podFailurePolicy and successPolicy for batch/ML Jobs so retriable infra failures back off, non-retriable app errors fail fast, and indexed Jobs succeed on a partial completion set — instead of burning through backoffLimit blindly.
-
Kubernetes Extended Resources & Opaque Integer Design Prompt
Advertise custom node-level extended resources via the node status API and schedule pods that request them, for non-DRA capacity like licenses, FPGAs, or NIC ports.
-
Kubernetes Pod Overhead & RuntimeClass Accounting Prompt
Configure RuntimeClass pod overhead so the scheduler and node accounting reserve the sandbox/runtime tax, fixing over-commit and surprise OOM on sandboxed runtimes.
-
Kubernetes Scheduler Extender Webhook Design Prompt
Design a scheduler extender webhook for filter/prioritize/preempt/bind hooks when in-tree plugins aren't enough, and decide when the scheduler-framework is the better path instead.
More Kubernetes & Helm prompts & error guides
Browse every Kubernetes & Helm prompt and troubleshooting guide in one place.
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.