- TechOps Examples
- Posts
- Optimizing Kubernetes Costs with Pod Disruption Budgets
Optimizing Kubernetes Costs with Pod Disruption Budgets
TechOps Examples
Hey — It's Govardhana MK 👋
Along with a use case deep dive, we identify the remote job opportunities, top news, tools, and articles in the TechOps industry.
👋 A brand new Kubernetes workshop from our sponsor PERFECT SCALE
Struggling with Kubernetes inefficiencies? Join our hands-on workshop to learn practical ways to optimize your environment and keep your clusters running smoothly.
We’ll cover best practices and how PerfectScale helps automate performance tuning.
What you’ll gain:
Tools to identify and safely reduce workload waste.
Strategies to resolve latency and prevent OOM errors, CPU throttling, and evictions.
Insights into evaluating autoscaling tools (HPA, KEDA, Karpenter, Cluster Autoscaler).
Guidance on selecting node types based on real usage trends.
Don’t miss out!
IN TODAY'S EDITION
🧠 Use Case
Optimizing Kubernetes Costs with Pod Disruption Budgets
🚀 Top News
👀 Remote Jobs
XM is hiring a Cloud Security Engineer
Remote Location: Worldwide
Speechify is hiring a Senior Software Engineer, Platform Engineering
Remote Location: Worldwide
📚️ Resources
📢 Reddit Threads
👋 Mark Zuckerberg announced that AI engineers will replace mid-level developers next year. Let that sink in for a second.
I can’t resist recommending.
Learn AI in 5 minutes a day
What’s the secret to staying ahead of the curve in the world of AI? Information. Luckily, you can join 800,000+ early adopters reading The Rundown AI — the free newsletter that makes you smarter on AI with just a 5-minute read per day.
🛠️ TOOL OF THE DAY
Lambda Live Debugger - Free open source tool for remote debugging AWS Lambda functions.
Allows you to debug locally, but the system behaves as if the code is running in the cloud with the same permissions.
🧠 USE CASE
Optimizing Kubernetes Costs with Pod Disruption Budgets
Kubernetes is well known for its extensibility and is great at scaling applications.
However, the real challenges arise in running it at optimal cost.
In fact, the most common conversation we keep hearing is about "right-sizing," and on paper, it is pretty easy to understand - like the image below.
However, it is easier said than done. "Right-sizing" involves a lot of measurements, techniques, and optimizations, making it a deep and vast subject.
Let’s zoom into Pod Disruption Budgets (PDBs) in the Kubernetes cost optimization context.
Why Do They Matter?
PDBs ensure high availability during disruptions by defining the minimum number of pods that must remain available during maintenance or scaling events.
But here’s the hidden cost: Misconfigured PDBs can lead to over-provisioning, where unnecessary compute resources are reserved to meet overly conservative thresholds.
Optimizing PDBs, therefore, becomes critical in cost-saving strategies.
Key Steps to Optimize PDBs for Cost Efficiency
1. Audit Your Workload Patterns:
Analyze pod lifecycles, scaling events, and traffic patterns using tools like kubectl top pods or Prometheus.
kubectl top pods --namespace=techops-prod
Check CPU and memory utilization trends to understand actual resource demands.
2. Set Realistic PDB Thresholds:
Instead of blanket thresholds, tailor PDBs for different workloads.
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: techops-pdb
spec:
minAvailable: 70%
Use percentage-based thresholds (minAvailable: 70%
) for dynamic workloads.
3. Integrate with Horizontal Pod Autoscaler:
Ensure PDBs align with HPA policies to avoid conflicts.
Example HPA:
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: example-hpa
spec:
minReplicas: 2
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
targetAverageUtilization: 75
4. Test Disruption Scenarios:
Use kubectl drain
commands to simulate node maintenance and validate PDB behavior.
kubectl drain <node-name> --ignore-daemonsets --delete-emptydir-data
To be honest, we can’t cover all the Kubernetes optimization insights in a short edition, so we are bringing a hands-on workshop with live exploration from Arthur Berezin, Product Leader & CNCF Ambassador