Infra & Cloud
yaml
Intermediate
Kubernetes HorizontalPodAutoscaler
Auto-scale a deployment between 2 and 10 pods based on CPU and memory utilisation.
yaml
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: myapp-hpa
spec:
scaleTargetRef: { apiVersion: apps/v1, kind: Deployment, name: myapp }
minReplicas: 2
maxReplicas: 10
metrics:
- type: Resource
resource: { name: cpu, target: { type: Utilization, averageUtilization: 70 } }
Prerequisites
- Kubernetes >= 1.26
- metrics-server
Pro Tips
- → Install metrics-server before applying HPA.
Commercial Licensing
Acquire a production access token or template license for enterprise deployment.
Module Info
- Language
- yaml
- Level
- Intermediate
- Read time
- 3 min
- Published
- Dec 2024
- License
- Commercial License
Newsletter
New modules every week, directly to your inbox.
Similar Modules
AWS S3 Static Website
Terraform module to provision an S3 bucket for static website hosting.
terraform
·
Intermediate
AWS RDS Postgres Terraform
Terraform resource for an RDS PostgreSQL instance with encryption and backup.
terraform
·
Intermediate
ECS Task Force Stop
Force-stop all running ECS tasks in a service for emergency rollback.
bash
·
Intermediate