CKA prep, mock test 5

Que 5, Create a VPA named api-vpa in Auto Mode for a deployment named api-deployment in the services namespace. The VPA should automatically adjust CPU and memory requests but must ensure that the CPU requests do not exceed 1 cores and memory requests do not exceed 1Gi. Additionally, set a minimum CPU request of 600m and a minimum memory request of 600Mi.

The containerName in VPA should explicitly match the container name inside api-deployment.

My solution =

cluster1-controlplane ~ ➜ k get vpa -A
NAMESPACE NAME MODE CPU MEM PROVIDED AGE
services api-vpa Auto 25m 262144k True 55m

cluster1-controlplane ~ ➜ cat vpa.yaml
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: api-vpa
namespace: services
spec:
targetRef:
apiVersion: “apps/v1”
kind: Deployment
name: api-deployment
updatePolicy:
updateMode: “Auto”
resourcePolicy:
containerPolicies:
- containerName: “api-deployment”
minAllowed:
cpu: 600m
memory: 600Mi
maxAllowed:
cpu: 1
memory: 1Gi

Kodekloud Solution =
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: api-vpa
namespace: services
spec:
targetRef:
apiVersion: apps/v1
kind: Deployment
name: api-deployment
updatePolicy:
updateMode: “Auto”
resourcePolicy:
containerPolicies:
- containerName: api-container
minAllowed:
cpu: “600m”
memory: “600Mi”
maxAllowed:
cpu: “1”
memory: “1Gi”

Details =

Does the API Vertical Pod Autoscaler (VPA) target the API Deployment? correct

Is the resource request configured within the api-vpa? Wrong
Is the resource limit configured within the api-vpa? Wrong
Are the resources adjusted for the pods by the api-vpa? Wrong

What did I miss ? why it’s wrong ?

You aren’t using

code blocks

which makes it hard to figure out how your YAML differs from the solution YAML. Please read this guide for info on how to do this properly.

I did confirm that the solution YAML passes the grader though.