Ultimate CKA Mock Exam 5 Question 10

Hi Team, please I need clarification on what I did wrong here:

Solve this question on: ssh cluster1-controlplane


A storage class called coconut-stc-cka01-str was created earlier.


Use this storage class to create a persistent volume called 
coconut-pv-cka01-str as per below requirements:


- Capacity should be 100Mi.

- The volume type should be hostpath and the path 
should be /opt/coconut-stc-cka01-str.

- Use coconut-stc-cka01-str storage class.

- This volume must be created on cluster1-node01 
(the /opt/coconut-stc-cka01-str directory already exists on this node).

- It must have a label with key: storage-tier with value: gold.


Also, create a persistent volume claim with the name 
coconut-pvc-cka01-str as per the below specs:


- Request 50Mi of storage from coconut-pv-cka01-str 
PV. It must use matchLabels to use the PV.

- Use coconut-stc-cka01-str storage class.

- The access mode must be ReadWriteMany.

Ultimately, the examiner didn’t like my PVC. I cross-checked with the provided solution but it is a match (in my eyes, anyway…lol). I’ll provide examiner’s solution and mine below.
Examiner’s solution for the PVC:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: coconut-pvc-cka01-str
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 50Mi
  storageClassName: coconut-stc-cka01-str
  selector: 
    matchLabels:
      storage-tier: gold

My solution for the PVC:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: coconut-pv-cka01-str
spec:
  storageClassName: coconut-stc-cka01-str
  selector:
    matchLabels:
      storage-tier: gold
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 50Mi

My kubectl get pvc output:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","kind":"PersistentVolumeClaim","metadata":{"annotations":{},"name":"coconut-pv-cka01-str","namespace":"default"},"spec":{"accessModes":["ReadWriteMany"],"resources":{"requests":{"storage":"50Mi"}},"selector":{"matchLabels":{"storage-tier":"gold"}},"storageClassName":"coconut-stc-cka01-str"}}
  creationTimestamp: "2025-05-09T21:40:44Z"
  finalizers:
  - kubernetes.io/pvc-protection
  name: coconut-pv-cka01-str
  namespace: default
  resourceVersion: "10575"
  uid: 062f44c5-cdb8-4971-b173-60d4a74fd027
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 50Mi
  selector:
    matchLabels:
      storage-tier: gold
  storageClassName: coconut-stc-cka01-str
  volumeMode: Filesystem
status:
  phase: Pending

Also the reason it says pending under status is because the storage class is “waitforfirstconsumer” and no pod is utilizing it.

the results of the examination are:
:white_check_mark: Is PV created correctly?
:x: Is PVC created correctly?

Please help.

Thank you so much.

Ola

Rather than have me solve this, let’s see about troubleshooting this kind of problem. I note that:

  • I haven’t seen the PV which is also part of the problem.
  • Did you look at the events section of the description of the PVC?
  • Did you look at the events for that namespace?

Okay. I’ll attempt it again.

I didn’t think to look at the events of the PV, thank you. I’ll attempt again (as soon as I get the time) and look through that. I didn’t even think to include it in the request for help… lol

I did look at the events of the PVC though.
It said it remained pending because it was attached to a storage class that is set to “waitforfirstconsumer”.

Thank you very much.