Lesson  in  Exam 1 — Cluster Basics, Storage & Scheduling

Question 4: Configure HPA Autoscaler

Create a HorizontalPodAutoscaler for an existing Deployment using kubectl.

The Deployment api-gateway already exists in namespace api-gateway, currently running with a fixed replica count and no autoscaling.

Using kubectl, create a HorizontalPodAutoscaler named api-gateway that targets this Deployment, with min 2 and max 4 replicas, scaling at 50% average CPU utilization.

Hint 1

kubectl autoscale deployment api-gateway -n api-gateway --min=2 --max=4 --cpu=50% does this in one command.