In Question 14 of the Mock Exam Series of CKA, I accidentally messed up the PVC as I didn’t put the right storage class for PVC ‘olive…’. However when I try to set everything right and recreate the deployment and pvc, the pods are stuck in a PENDING state and I get an error saying that the PVC is not present on the node.
How can I rectify it? What can I do if I mess up a persistent volume claim or persistent volume in the exam?
Hi @alisbusinesses
Once you delete a PVC bound to a PV, the PVC gets stuck in a Terminating state. This usually happens due to the accessMode of the PV being set to Retain, or when the PVC is still being used by a Pod. To resolve this, you will need to delete the Pod/Deployment managing it and recreate everything from scratch.
Sometimes, in labs and Exam, the Pods/Deployments are already created as part of the question. it’s always a good practice to back up the current state of any resources you’re working on before making changes. This way, if something goes wrong, you can easily recreate them. For example, you can save a backup of a Deployment using:
kubectl get deployment <Deployment Name> -o yaml > deploy.yaml
.
Such backup files as created with the above command export the Deployment’s configuration into a YAML file, allowing you to restore it quickly if needed.
Regards
Thanks @Santhosh.Kumar for your quick reply. I made a mistake when I said Question 13. It’s actually question 14 that is causing the trouble. I made a deliberate mistake to test out if deleting the pvc and the deployment using it helps with the error and it did. But only once.
For the first time I deliberately used an incorrect pvc accessMode of ReadWriteOnce
for pvc
olive-pvc-cka10-str
. This resulted in the pvc getting stuck in the Pending
state. I deleted deployment and the pvc to resolve this, changed the accessMode
to ReadWriteMany
and recreated the resources and everything looked good. Except for the sidecar container that I had to run.
I had used args
instead of command
like it shows in the solution so I fixed the sidecar and tried deleting the pvc and the deployment and recreate them again to solve the error like I did above. But this time it gave the error that I asked in my original post and no amount of deleting and recreating helps.
I get the following error when I k describe pod olive-app-cka10-str-8c9b6765d-8gm96
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 3m32s (x2 over 9m2s) default-scheduler 0/3 nodes are available: 1 node(s) didn't find available persistent volumes to bind, 1 node(s) didn't match Pod's node affinity/selector, 1 node(s) had untolerated taint {node-role.kubernetes.io/control-plane: }. preemption: 0/3 nodes are available: 3 Preemption is not helpful for scheduling.
Could this be a limit of the KodeKloud platform? I would really appreciate if you could try how I did it and then explain what is causing the issue.
Best, Ali