Kubernetes PodDisruptionBudget Generator
Generate PodDisruptionBudget YAML for your Kubernetes workloads. Configure minAvailable or maxUnavailable with fixed counts or percentages, add label selectors, and get a plain-English explanation of what the policy does.
Protects service availability during node drains and cluster upgrades.
Frequently Asked Questions
What is a PodDisruptionBudget (PDB)?▼
A PodDisruptionBudget is a Kubernetes policy resource that limits the number of pods that can be voluntarily disrupted at one time. Voluntary disruptions include node drains (kubectl drain), cluster upgrades, and evictions by the Cluster Autoscaler. A PDB protects your service's availability during these maintenance operations by telling Kubernetes: 'don't evict pods if it would leave fewer than N available.' PDBs do NOT protect against involuntary disruptions like hardware failures or OOMKill.
What is the difference between minAvailable and maxUnavailable?▼
minAvailable sets the minimum number (or percentage) of pods that must be running and ready at all times. Kubernetes won't evict a pod if doing so would drop below this threshold. maxUnavailable sets the maximum number (or percentage) of pods that can be unavailable at the same time. Kubernetes won't evict a pod if already maxUnavailable pods are down. minAvailable is easier to reason about for stateful services; maxUnavailable maps naturally to rolling update semantics. Pick one — don't set both in the same PDB.
Should I use a number or percentage?▼
Use a percentage if your deployment scales up and down frequently (e.g., with HPA). Percentages scale with your replica count automatically — minAvailable: 50% on a 10-replica deployment allows 5 disruptions; on a 4-replica deployment it allows 2. Use a fixed number if you have a stable replica count or need precise guarantees (e.g., minAvailable: 2 on a 3-replica stateful cluster ensures at least 2 nodes stay up for quorum). Important: if minAvailable equals your total replica count, no voluntary evictions are ever permitted — kubectl drain will block forever.
What does unhealthyPodEvictionPolicy: AlwaysAllow do?▼
By default, Kubernetes won't evict unhealthy pods (not Running or not Ready) if they count against the PDB budget. This can cause kubectl drain to hang when you have crashed pods. Setting unhealthyPodEvictionPolicy: AlwaysAllow lets Kubernetes evict unhealthy pods regardless of the PDB budget. This was added in Kubernetes 1.26. Use it when you want drains to succeed even when pods are already failing — but be aware it may reduce your available pod count below minAvailable temporarily.
How does a PDB interact with Cluster Autoscaler or kubectl drain?▼
Both the Cluster Autoscaler and kubectl drain are PDB-aware — they check existing PDBs before evicting pods. If evicting a pod would violate a PDB, the operation blocks and retries until it's safe. kubectl drain will print a 'Cannot evict pod as it would violate the pod's disruption budget' message and wait. The Cluster Autoscaler will skip a node and retry on the next cycle. This is exactly the behavior you want — it prevents scale-down or drain from breaking your service's availability guarantees.
What is the matchLabels selector and how do I find the right labels?▼
matchLabels selects which pods this PDB applies to, using the same label selectors as Kubernetes Services and Deployments. Run kubectl get pods --show-labels to see pod labels, or kubectl get deployment my-app -o yaml to find the selector. Typically you'd match the same labels as your Deployment's selector (e.g., app: my-app, version: v2). The PDB only applies to pods it selects — if your selector doesn't match any pods, the PDB has no effect.
Related Products
on GumroadPremium Workflow Pack
Production-grade workflows, architecture guides, and deployment scripts for teams that ship. 10 advanced CI/CD workflows (blue-green, canary, E2E, security), 5 architecture deep-dives, code review checklist, PR process guide, and 5 battle-tested Bash deployment scripts.
Buy on Gumroad →GitHub Actions CI/CD Templates Pack
12 production-ready GitHub Actions workflow templates covering Node.js, Python, Docker, multi-environment deployments, security scanning, and auto-changelog. Copy, paste, ship.
Buy on Gumroad →Developer Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →You Might Also Need
Kubernetes Resource Estimator
Estimate total Kubernetes cluster CPU and memory requirements. Input pods, replicas, and resource requests/limits to get cluster totals, requests vs limits analysis, and a ready-to-use ResourceQuota YAML.
Open free tool →
Kubernetes Resource Calculator
Calculate total CPU and memory requirements for your Kubernetes workloads. Input resource requests and limits per pod, replica count, and get cluster resource usage with cloud cost estimates.
Open free tool →
Kubernetes Resource Calculator
Calculate K8s resource requests and limits. Input CPU cores, memory per pod, replica count. Output cluster resource needs, HPA config, namespace quota YAML.
Open free tool →
More Free Tools
Related Articles
Pulumi vs Terraform 2026: Which IaC Tool Should You Choose?
A deep comparison of Pulumi and Terraform for infrastructure as code in 2026. Covers syntax, state management, provider ecosystem, team adoption, and when to choose each tool.
AWS CDK vs Terraform vs Pulumi: Infrastructure as Code Comparison 2026
Complete comparison of AWS CDK, Terraform, and Pulumi for infrastructure as code in 2026 — language support, state management, multi-cloud, community, and when to use each.
Docker Compose vs Kubernetes for Small Teams 2026
Should small teams use Docker Compose or Kubernetes in 2026? Compare production viability, K3s as a middle ground, Kompose migration, and the real costs of managed Kubernetes for teams under 20.
Docker Compose vs Kubernetes: When to Use Each (2026)
A practical guide to choosing between Docker Compose and Kubernetes in 2026. Compare complexity, use cases, cost, and learn when to migrate from one to the other.
Kubernetes Cost Optimization: A Practical Guide for 2026
Reduce your Kubernetes costs by 40-60% with rightsizing, VPA/HPA, spot instances, namespace quotas, and cost monitoring tools like Kubecost. Real examples included.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →