Add an HPA that scales the Deployment between 3 and 15 pods at 70% CPU.
BeginnerHands-onWrite-a-Kubernetes-manifest tasks
Answer
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: web
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: web
minReplicas: 3
maxReplicas: 15
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
Key trick → Utilization is a percentage of the container's CPU request, so the HPA shows <unknown> if requests aren't set or metrics-server isn't installed.
More on Write-a-Kubernetes-manifest tasks
Write a Deployment and Service for an Nginx app with 3 replicas, resources and probes.BeginnerFix this broken Deployment YAML.BeginnerWrite a ConfigMap and Secret and inject them as environment variables and as a mounted file.IntermediateWrite an Ingress that routes `/api` to the api service and `/` to the web service with TLS.IntermediateWrite a pod spec with a hardened securityContext.IntermediateWrite a CronJob that runs a backup every night at 02:00 and keeps limited history.Intermediate