Ultimate CKA Mock Exam Question: Section Storage

Came across this question in the Ultimate CKA Mock Exam Lab:

SECTION: STORAGE

For this question, please set the context to cluster1 by running:

kubectl config use-context cluster1

Create a storage class called orange-stc-cka07-str as per the properties given below:

Next, create a persistent volume called orange-pv-cka07-str as per the properties given below:

  • Capacity should be 150Mi.

  • Access mode should be ReadWriteOnce.

  • Reclaim policy should be Retain.

  • It should use storage class orange-stc-cka07-str.

  • Local path should be /opt/orange-data-cka07-str.

  • Also add node affinity to create this value on cluster1-controlplane.

Finally, create a persistent volume claim called orange-pvc-cka07-str as per the properties given below:

  • Access mode should be ReadWriteOnce.

  • It should use storage class orange-stc-cka07-str.

  • Storage request should be 128Mi.

  • The volume should be orange-pv-cka07-str

I got everything right on this question except for the pvc part.
PVC was stuck in pending mode because it would not bind because of the volume binding mode was
set at WaitForFirstConsumer as per the instructions for creating the storage class. The instruction did not say create a pod that uses this pvc or does it state in the solution that we are
supposed to either. Regardless I tried to create a pod that used this pvc but it did not work. The pod
was stuck in pending saying the node could not find a pv to use. I tried changing the storage class bind mode to immediate but then it said that was an immutable change. I then ran out of time to do anymore.

What does your PVC yaml look like here? The problem spec says that it should bind to orange-pv-cka07-str, which suggests that there should be a volumeName: orange-pv-cka07-str in its YAML. If you omitted that, it’s possible that’s what the grader is grumpy about.

I didn’t have the volume name in the pvc file. so that was the issue. I didn’t realize you could put the volume name in there. I will try that next time I have the question, thanks. I guess I never paid attention to the kubernetes documentation on reserving a pv before.