Real CKA Question 1 of 17 — Create a Horizontal Pod Autoscaler (HPA)
I will walk through 17 questions from my Certified Kubernetes Administrator (CKA) exam, which I successfully passed. The questions…
Real CKA Question 1 of 17 — Create a Horizontal Pod Autoscaler (HPA)
I will walk through 17 questions from my Certified Kubernetes Administrator (CKA) exam, which I successfully passed. The questions presented here are the same ones I encountered during the exam.
The goal of this blog is to demonstrate how these tasks can be approached and solved in a practical way, similar to the real exam environment. Each question focuses on core Kubernetes administration skills and the command-line techniques needed to complete tasks efficiently.
By going through these questions step by step, you will understand how to approach similar problems during the CKA exam and improve your ability to solve them quickly under time pressure.
You can watch the complete implementation video below
[embed]
The Certified Kubernetes Administrator exam is not a theory contest. It is a keyboard exam. You are dropped into a cluster and expected to make Kubernetes obey you. No slides, no excuses, just YAML and commands. Question 1 in many practice sets focuses on Horizontal Pod Autoscaling (HPA) — a mechanism that lets Kubernetes increase or decrease pods automatically based on metrics like CPU usage.
Think of HPA as a thermostat for your application. When CPU usage rises, Kubernetes adds more pods. When load drops, it removes them. The cluster continuously watches metrics and adjusts the number of replicas to keep the system balanced. Elegant idea. Brutally practical in real clusters.
Now let’s walk through the task.
Press enter or click to view image in full size

Problem Statement
Create a new Horizontal Pod Autoscaler named apache-server in the autoscale namespace.
Requirements:
- Target Deployment:
apache-server - Namespace:
autoscale - Target CPU usage: 50%
- Minimum pods: 1
- Maximum pods: 4
- Downscale stabilization window: 30 seconds
Step 1 — Verify the Deployment Exists
Before creating autoscaling rules, check if the deployment actually exists. Blind configuration is how people waste time in the exam.
kubectl get deploy -n autoscale
You should see:
apache-server
If it isn’t there, nothing will scale.
Step 2 — Create the HPA
In the exam, speed matters. The fastest way is using the kubectl autoscale command.
kubectl autoscale deployment apache-server --cpu-percent=50 --min=1 --max=4
-n autoscale --dry-run=client -o yaml > hpa.yaml
This creates the Horizontal Pod Autoscaler.
What this actually does:
kubectl autoscalegenerates the HPA •--dry-run=clientprevents it from being created in the cluster •-o yamlprints the YAML •>saves it into hpa.yaml
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
creationTimestamp: null
name: apache-server
namespace: autoscale
spec:
maxReplicas: 4
minReplicas: 1
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: apache-server
targetCPUUtilizationPercentage: 50
status:
currentReplicas: 0
desiredReplicas: 0
Now open the file and add the stabilization window because the autoscale command does not generate behavior rules.
Edit it:
vim hpa.yaml
Add this under spec:
behavior:
scaleDown:
stabilizationWindowSeconds: 30
The final structure should look like this:
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: apache-server
namespace: autoscale
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: apache-server
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
behavior:
scaleDown:
stabilizationWindowSeconds: 30
Then apply it:
kubectl apply -f hpa.yaml
Quick verification:
kubectl get hpa -n autoscale
A practical CKA survival trick: always dry-run and redirect to YAML when possible. Humans make typos. Kubernetes never forgives them. Generating YAML from kubectl removes half the mistakes candidates make under exam pressure.
References: Kubernetes HPA Documentation: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ Kubernetes Official Documentation: https://kubernetes.io/docs/ CKA Certification: https://training.linuxfoundation.org/certification/certified-kubernetes-administrator-cka/
메타데이터
- post_id
- 63fb00aaeb5c
- slug
- real-cka-question-1-of-17-create-a-horizontal-pod-autoscaler-hpa-63fb00aaeb5c
- url
- https://medium.com/@tradingcontentdrive/real-cka-question-1-of-17-create-a-horizontal-pod-autoscaler-hpa-63fb00aaeb5c
- canonical_url
- https://medium.com/@tradingcontentdrive/real-cka-question-1-of-17-create-a-horizontal-pod-autoscaler-hpa-63fb00aaeb5c
- author_url
- https://medium.com/@tradingcontentdrive
- status
- ok
- fetched_at
- 2026-06-18 00:10:23