CKA · Question #51
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…
Connect to the correct host (if not already connected) ssh cka000050 Step 2: Verify the deployment exists kube-score-check-000050 kubectl get deployment apache-server -n autoscale Step 3: Create the HPA (initial setup) kube-score-check-000050 kubectl autoscale deployment…
Question
Explanation
Connect to the correct host (if not already connected)
ssh cka000050
Step 2: Verify the deployment exists
kube-score-check-000050 kubectl get deployment apache-server -n autoscale
Step 3: Create the HPA (initial setup)
kube-score-check-000050 kubectl autoscale deployment apache-server
--namespace autoscale
--cpu-percent=50
--min=1
--max=4
Step 4: Add the downscale stabilization window by patching the HPA
Create a patch file called hpa-patch.yaml
cat <<EOF > hpa-patch.yaml spec: behavior: scaleDown: stabilizationWindowSeconds: 30 EOF
Apply the patch
kube-score-check-000050 kubectl patch hpa apache-server -n autoscale --patch "$(cat hpa-patch.yaml)"
Step 5: Confirm your work
kube-score-check-000050 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.