Good day,
Please I want to know if I was marked wrong because of “technicality” and not because I was inherently wrong.
The question
Create a Horizontal Pod Autoscaler (HPA) for the deployment named
api-deployment located in the api namespace.
The HPA should scale the deployment based on a custom metric
named requests_per_second, targeting an average value of 1000
requests per second across all pods.
Set the minimum number of replicas to 1 and the maximum to 20.
Note: Deployment named api-deployment is available in api
namespace. Ignore errors due to the metric requests_per_second
not being tracked in metrics-server
The proposed solution:
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: api-hpa
namespace: api
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: api-deployment
minReplicas: 1
maxReplicas: 20
metrics:
- type: Pods
pods:
metric:
name: requests_per_second
target:
type: AverageValue
averageValue: "1000"
The solution I applied:
controlplane ~ ➜ cat hpa.yaml
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: api-hpa
namespace: api
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: api-deployment
minReplicas: 1
maxReplicas: 20
metrics:
- type: Pods
pods:
metric:
name: requests-per-second
target:
type: AverageValue
averageValue: 1k
The result I was shown (and the issue):
Details
Is api-hpa
HPA deployed in api namespace?
Is api-hpa configured for metric requests_per_second
?
Essentially, the only difference between the two yamls (as far as I can tell is the averageValue) expressed by me as “1k” (which I took off the kubernetes website) and by the examiner as “1000”. I have tried to research and they are supposed to both mean the same thing. My best guess is that because the examiner has to mark by checking certain values, they may not have set up the system to accept “1k” as a valid answer.
I realise I have been posting here a lot but I just failed CKA and my rewrite is coming up soon. lol. So all help is greatly appreciated. lol