This regarding CKA Mock Exam 2 question 1 from Ultimate Certified Kubernetes Administrator (CKA) Mock Exam

I have done everting right still not getting full marks for this question

Solve this question on: ssh cluster1-controlplane

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

Provisioner should be kubernetes.io/no-provisioner.
Volume binding mode should be WaitForFirstConsumer.

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:

**************************** StorageClass.yaml******************************

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: orange-stc-cka07-str
provisioner: kubernetes.io/no-provisioner # indicates that this StorageClass does not support automatic provisioning
volumeBindingMode: WaitForFirstConsumer

PersistentVolume.yaml******************
apiVersion: v1
kind: PersistentVolume
metadata:
name: orange-pv-cka07-str
spec:
storageClassName: orange-stc-cka07-str
capacity:
storage: 150Mi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
local:
path: /opt/orange-data-cka07-str
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- cluster1-controlplane

*******persistentVolumeClaim
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: orange-pvc-cka07-str
spec:
storageClassName: orange-stc-cka07-str
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 128Mi
volumeName: orange-pv-cka07-str

Hi @yeoleajinkya1

I just tried it and it worked with all the instructions in the question followed.
It would have helped if you had shared all your YAMLs in a code block.

You can use the </> button in the ribbon at the top of your editor and then paste the YAML in the code-block.

I also see that you are using local.path in your PV. I guess that could be the reason.
You need to use hostPath.path.