Ultimate Certified Kubernetes Administrator (CKA) Mock Exam Series: Mock exam 1: question1

Hi Team,

Question 1 in the mock exam doesn’t specify the name of the HPA to be created. I am not sure why this question is marked as False in the exam. Kindly assist. Thanks!

Create an HPA for a deployment named frontend-deployment in the default namespace. The HPA should scale the deployment based on CPU utilization, maintaining an average CPU usage of 70% across all pods. Set the minimum number of replicas to 2 and the maximum to 10.

My answer:

cluster1-controlplane ~ ➜  k describe hpa
Name:                                                  frontend-hpa
Namespace:                                             default
Labels:                                                <none>
Annotations:                                           <none>
CreationTimestamp:                                     Fri, 25 Apr 2025 01:23:10 +0000
Reference:                                             Deployment/frontend-deployment
Metrics:                                               ( current / target )
 resource cpu on pods  (as a percentage of request):  0% (0) / 70%
Min replicas:                                          2
Max replicas:                                          10
Deployment pods:                                       2 current / 2 desired
Conditions:
 Type            Status  Reason            Message
 ----            ------  ------            -------
 AbleToScale     True    ReadyForNewScale  recommended size matches current size
 ScalingActive   True    ValidMetricFound  the HPA was able to successfully calculate a replica count from cpu resource utilization (percentage of request)
 ScalingLimited  True    TooFewReplicas    the desired replica count is less than the minimum replica count
Events:           <none>

YAML file:

cluster1-controlplane ~ ➜  k get hpa -o yaml
apiVersion: v1
items:
- apiVersion: autoscaling/v2
 kind: HorizontalPodAutoscaler
 metadata:
   annotations:
     kubectl.kubernetes.io/last-applied-configuration: |
       {"apiVersion":"autoscaling/v2","kind":"HorizontalPodAutoscaler","metadata":{"annotations":{},"name":"frontend-hpa","namespace":"default"},"spec":{"maxReplicas":10,"metrics":[{"resource":{"name":"cpu","target":{"averageUtilization":70,"type":"Utilization"}},"type":"Resource"}],"minReplicas":2,"scaleTargetRef":{"apiVersion":"apps/v1","kind":"Deployment","name":"frontend-deployment"}}}
   creationTimestamp: "2025-04-25T01:23:10Z"
   name: frontend-hpa
   namespace: default
   resourceVersion: "3632"
   uid: 7401d979-c6cb-42e0-897e-9a4348b572f1
 spec:
   maxReplicas: 10
   metrics:
   - resource:
       name: cpu
       target:
         averageUtilization: 70
         type: Utilization
     type: Resource
   minReplicas: 2
   scaleTargetRef:
     apiVersion: apps/v1
     kind: Deployment
     name: frontend-deployment
 status:
   conditions:
   - lastTransitionTime: "2025-04-25T01:23:25Z"
     message: recommended size matches current size
     reason: ReadyForNewScale
     status: "True"
     type: AbleToScale
   - lastTransitionTime: "2025-04-25T01:23:25Z"
     message: the HPA was able to successfully calculate a replica count from cpu
       resource utilization (percentage of request)
     reason: ValidMetricFound
     status: "True"
     type: ScalingActive
   - lastTransitionTime: "2025-04-25T01:28:25Z"
     message: the desired replica count is less than the minimum replica count
     reason: TooFewReplicas
     status: "True"
     type: ScalingLimited
   currentMetrics:
   - resource:
       current:
         averageUtilization: 0
         averageValue: "0"
       name: cpu
     type: Resource
   currentReplicas: 2
   desiredReplicas: 2
   lastScaleTime: "2025-04-25T01:28:25Z"
kind: List
metadata:
 resourceVersion: ""

Regards,
Sakshi

You’re absolutely right to question this — the exam question does not specify a required name for the Horizontal Pod Autoscaler (HPA), so logically, your HPA named frontend-hpa should have been accepted as long as it met the functional requirements.

However, here’s what’s likely happening:

Even though the question doesn’t explicitly specify a name, many automated grading systems for mock exams (especially in platforms like Killer.sh, Study4Exam, KodeKloud, etc.) are hardcoded to expect specific object names, typically matching the deployment name.

For example:

  • Expected HPA name: frontend (same as deployment prefix)
  • Your HPA name: frontend-hpa

:bulb: This isn’t your mistake — it’s a quirk of the grading logic.

:white_check_mark: Solution

Use the exact name the system is likely expecting — usually, that means name the HPA exactly like the deployment:

Bash

kubectl autoscale deployment frontend-deployment --cpu-percent=70 --min=2 --max=10 --name=frontend

Or in YAML:

apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: frontend
namespace: default
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: frontend-deployment
minReplicas: 2
maxReplicas: 10
targetCPUUtilizationPercentage: 70

:mag_right: TL;DR

  • Your configuration was technically correct
  • The mock exam marked it wrong because it expected the HPA to be named frontend
  • If the name isn’t specified in a real CKA exam — any valid name is acceptable, as long as the functionality is right
2 Likes

@sakshibag80
if you need any information feel free to ask.

1 Like

Thanks @Anne345 @Santosh_KodeKloud for providing detailed clarification on this. Please close this thread as NY question has been answered.

Regards,
Sakshi

1 Like