Book Consultation Submit Ticket

Mastering Cloud Capacity Autoscaling and Cost Operations: A Practical Guide for SREs

This post covers a deep practical approach to cloud capacity autoscaling and cost operations, including scenario, symptoms, diagnosis, commands, risk controls, rollback, verification, and when to submit an OpsGlobal ticket.

Mastering Cloud Capacity Autoscaling and Cost Operations: A Practical Guide for SREs
Cloud Migration 6min 39 views 2026-07-21
KubernetesSRE

Scenario

Your Kubernetes cluster frequently experiences Pod scheduling failures during business peaks, while idle resources during low traffic lead to excessive cloud bills. You need autoscaling to match load and control costs.

Symptoms

  • Pods stuck in Pending due to insufficient node resources
  • Node utilization below 30% for hours
  • Monthly cloud bill increases >20% without corresponding business growth

Diagnosis

  1. Check cluster resources: kubectl top nodes and kubectl top pods
  2. Inspect Pod events: kubectl describe pod <pod-name> for Insufficient memory/cpu
  3. Analyze costs: In AWS Cost Explorer, filter by service (EC2, EKS) and tags to identify idle resources
  4. Check HPA status: kubectl get hpa to see target vs actual metrics

Commands

Configure HPA (Horizontal Pod Autoscaler)

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: my-app-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: my-app
  minReplicas: 2
  maxReplicas: 10
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 70

Apply: kubectl apply -f hpa.yaml

Configure Cluster Autoscaler (node autoscaling)

Assuming Cluster Autoscaler is deployed, set min/max nodes:

apiVersion: v1
kind: ConfigMap
metadata:
  name: cluster-autoscaler-status
  namespace: kube-system
data:
  config: |
    {
      "minNodes": 3,
      "maxNodes": 20
    }

Or via AWS CLI to update Auto Scaling Group:

aws autoscaling update-auto-scaling-group --auto-scaling-group-name my-asg --min-size 3 --max-size 20

Cost tagging and reporting

# Label nodes for cost tracking
kubectl label nodes --all cost-center=production
# Use AWS Cost Explorer to group by tag

Risk Controls

  • Set HPA cooldown: --horizontal-pod-autoscaler-downscale-stabilization-window=5m
  • Set Cluster Autoscaler scale-up delay: --scale-down-delay-after-add=10m
  • Use PodDisruptionBudgets for critical services
  • Test in staging before production

Rollback

  1. Delete HPA: kubectl delete hpa my-app-hpa
  2. Restore Deployment replicas: kubectl scale deployment my-app --replicas=3
  3. Reset Cluster Autoscaler config: revert ASG min size
  4. To fully disable: kubectl scale deployment cluster-autoscaler --replicas=0 -n kube-system

Verification

  • Check Pod scheduling: kubectl get pods -o wide all running
  • Monitor resource usage: kubectl top nodes showing 40-80% utilization
  • Compare cost: review AWS bills for two weeks before and after, expect at least 15% savings
  • Load test: kubectl run -it --rm load-generator --image=busybox -- /bin/sh -c "while true; do wget -q -O- http://my-app-service; done" and observe scaling

When to Submit an OpsGlobal Ticket

  • Autoscaling fails to trigger despite metrics, logs show metric server issues
  • Cluster autoscaler oscillates causing instability
  • Need cost optimization advice across multi-region, multi-cluster deployments
  • Scaling policy errors cause service disruption

Use cases

Useful for teams handling Cloud Migration issues and needing a clear troubleshooting and delivery workflow.

Problem background

This post covers a deep practical approach to cloud capacity autoscaling and cost operations, including scenario, symptoms, diagnosis, commands, risk controls, rollback, verification, and when to submit an OpsGlobal ticket.

Troubleshooting steps

Confirm impact and recent changes, collect logs, configuration and metrics, then apply fixes from low to high risk.

Command examples

Replace sample resource names with real values and store passwords, tokens and keys in environment variables.

Risks

Before production changes, confirm backups, access boundaries, change windows and rollback paths.

Rollback plan

Keep original configuration and release versions; roll back config, images or database changes if metrics degrade.

Deliverables

Root-cause notes, key commands, remediation steps, verification results and follow-up recommendations.

!

Need help with a similar technical issue?

If your servers, Kubernetes, Docker, CI/CD, databases or monitoring systems have similar issues, submit logs and config files for remote diagnosis.

Ticket Contact on WhatsApp Consult