CKA · Question #49
Create a new HorizontalPodAutoscaler (HPA) named apache-server in the autoscale namespace. This HPA must target the existing Deployment called apache-server in the autoscale namespace. Set the HPA…
1. Connect to the correct host: ssh cka000050 2. Verify the deployment exists: kubectl get deployment apache-server -n autoscale (Make sure it's there before creating the HPA, otherwise the HPA won't bind correctly.) 3. Create the HPA: kubectl autoscale deployment apache-server…
Question
Explanation
-
Connect to the correct host: ssh cka000050
-
Verify the deployment exists: kubectl get deployment apache-server -n autoscale (Make sure it's there before creating the HPA, otherwise the HPA won't bind correctly.)
-
Create the HPA: kubectl autoscale deployment apache-server
--namespace autoscale
--cpu-percent=50
--min=1
--max=4 -
Add the downscale stabilization window: (You'll need to patch the HPA to include the stabilization window of 30s.) Create a patch file called hpa-patch.yaml: cat <<EOF > hpa-patch.yaml spec: behavior: scaleDown: stabilizationWindowSeconds: 30 EOF Apply the patch: kubectl patch hpa apache-server -n autoscale --patch "$(cat hpa-patch.yaml)"
-
Confirm your work: kubectl describe hpa apache-server -n autoscale (Look for: Min/Max Pods: 1/4, Target CPU utilization: 50%, Stabilization window: should appear under Behavior > ScaleDown)
Topics
Community Discussion
No community discussion yet for this question.