nerdexam
Linux_Foundation

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…

Submitted by hans_de· May 4, 2026Workloads and Scheduling

Question

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 to aim for 50% CPU usage per Pod. Configure it to have at least 1 Pod and no more than 4 Pods. Also, set the downscale stabilization window to 30 seconds.

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

#Horizontal Pod Autoscaler#Autoscaling#Deployment#CPU utilization

Community Discussion

No community discussion yet for this question.

Full CKA Practice