The solution for " Ultimate Certified Kubernetes Administrator (CKA) Mock Exam Series CKA Mock 3 Question 7" doesn’t seem to work.
In the solution, its mentioned that one should change request memory limits to 512Mi. When I edit the deployment, the pod still crashes and the question doesn’t pass.
Not sure what I’m doing wrong / and or the solution is incorrect.
Hi @rehdwolfe
While I verify the lab, it would help if you could share the YAML manifest that you tried.
Sure thing:
student-node ~ ➜ cat green.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "2"
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"labels":{"app":"green-app-cka15-trb"},"name":"green-deployment-cka15-trb","namespace":"default"},"spec":{"selector":{"matchLabels":{"app":"green-app-cka15-trb"}},"template":{"metadata":{"labels":{"app":"green-app-cka15-trb"}},"spec":{"containers":[{"env":[{"name":"MYSQL_ROOT_PASSWORD","valueFrom":{"secretKeyRef":{"key":"password","name":"green-root-pass-cka15-trb"}}},{"name":"MYSQL_DATABASE","valueFrom":{"secretKeyRef":{"key":"database","name":"green-db-url-cka15-trb"}}},{"name":"MYSQL_USER","valueFrom":{"secretKeyRef":{"key":"username","name":"green-user-pass-cka15-trb"}}},{"name":"MYSQL_PASSWORD","valueFrom":{"secretKeyRef":{"key":"password","name":"green-user-pass-cka15-trb"}}}],"image":"mysql:5.6","name":"mysql","ports":[{"containerPort":3306,"name":"mysql"}],"resources":{"limits":{"cpu":"100m","memory":"256Mi"},"requests":{"cpu":"50m","memory":"256Mi"}}}]}}}}
creationTimestamp: "2025-02-13T16:56:54Z"
generation: 2
labels:
app: green-app-cka15-trb
name: green-deployment-cka15-trb
namespace: default
resourceVersion: "5811"
uid: 22b8eaee-330c-4901-816a-45a11b06cad3
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: green-app-cka15-trb
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: green-app-cka15-trb
spec:
containers:
- env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: green-root-pass-cka15-trb
- name: MYSQL_DATABASE
valueFrom:
secretKeyRef:
key: database
name: green-db-url-cka15-trb
- name: MYSQL_USER
valueFrom:
secretKeyRef:
key: username
name: green-user-pass-cka15-trb
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: green-user-pass-cka15-trb
image: mysql:5.6
imagePullPolicy: IfNotPresent
name: mysql
ports:
- containerPort: 3306
name: mysql
protocol: TCP
resources:
limits:
cpu: 100m
memory: 512Mi
requests:
cpu: 50m
memory: 256Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
status:
availableReplicas: 1
conditions:
- lastTransitionTime: "2025-02-13T16:56:54Z"
lastUpdateTime: "2025-02-13T16:57:44Z"
message: ReplicaSet "green-deployment-cka15-trb-5f49cbf44b" has successfully progressed.
reason: NewReplicaSetAvailable
status: "True"
type: Progressing
- lastTransitionTime: "2025-02-13T17:29:56Z"
lastUpdateTime: "2025-02-13T17:29:56Z"
message: Deployment has minimum availability.
reason: MinimumReplicasAvailable
status: "True"
type: Available
observedGeneration: 2
readyReplicas: 1
replicas: 1
updatedReplicas: 1
In case it matters, I did an edit of the deployment to make the change.
To help us figure out what you did, please try saving your YAML in a code block like
this one here
You use the </>
key to create the empty code block; paste your code into that.
I might be blind but I don’t see the </> in my toolbar. I surrounded the above yaml in ``` which seems to have done what you want?
Yeah, that was what I wanted. The button is here:
As for the problem: the solution for the problem is close, but not quite correct. They suggest that you increase the memory limit to 512Mi. That turns out to be not quite enough: you need at least 600Mi, it turns out:
student-node ~ ➜ k top pod
NAME CPU(cores) MEMORY(bytes)
backend-cka06-arch 223m 601Mi
green-deployment-cka15-trb-5c6c8f579f-l6f7k 99m 595Mi
I used 1024Mi, and this passed the question.
I’ll give that a shot. Really good to know I was on the write track and not really missing anything. Do you need anything from me to help fix the mock solution?
Btw - Do I need to enable the display of the code block somewhere. I dont seem to have that button.
Looks like it is hiding under the gear icon.
That’s odd – not sure why your edit bar is rendered different from mine. What kind of browser are you using, on what platform?
Presently Windows 10 Pro 64 Bit - Chrome Version 133.0.6943.98 (Official Build) (64-bit)
Checking on my mac - it appears to be where you indicated