PVC Storage Mock Series Question

In the below question, I followed the steps as suggested in answer, modified PVC storage to 100Mi from 150Mi, still it considered wrong.

please help

Each of these questions has an associated SECTION e.g.
image
In which section was this question?

This would be difficult to tell, but screenshot tells everything

I finally located this question. The section I asked you for is TROUBLESHOOTING

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    type: local
  name: orange-pvc-cka13-trb
  namespace: default
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
  volumeMode: Filesystem

Please see the screenshot, Status= bound, pvc storage reduced. Answer Considered as wrong.

And you recreated it with exactly the YAML I posted?

Actually Without labels, will try that but my follow-up questions: a) labels are mandatory? b) and do we need to call out default namespace as well?

And Just FYI, whatever is not working right now, worked perfectly fine [my same code] in some attempts, so it’s a intermittent, Any thoughts?

The labels should not matter, however the namespace does matter.
If your namespace setting for current context on that cluster was something other than default (e.g. from a previous question), and you create it without namespace, then the PVC will still bind, but the PVC would be in the wrong namespace and the question would be marked incorrect.

Remember that a persistent volume is non-namespaced. It can be bound by a PVC in any namespace.

Thanks for explaining, But how come my namespace setting from previous question is impacting my next question., I am really not sure what setting/command you are reffering to. please help

As I said, whatever is not working right now, worked perfectly fine [my same code] in some attempts, so it’s a intermittent, Any thoughts?

Say you ran a command like

kubectl config set-context --current --namespace blue

for a previous question that uses cluster1

If you then come to this question and create a PVC without namespace in the YAML or without doing

kubectl config set-context --current --namespace default

then the PVC would create and bind in the blue namespace, which is not what the question wants - even though the PVC shows as bound. It would be bound in the wrong namespace.

Should this question be scored wrong again, then in the few minutes you have before the lab ends, run exactly the following to verify the PVC is in the right place

kubectl config use-context cluster1
kubectl get pvc -n default orange-pvc-cka13-trb

If you get no result, then it is in the wrong namespace.

If it does come back with a result and the question is still marked incorrect, then post it here. We don’t need a full screenshot - just copy the text including the commands you ran and the output from the terminal

and paste it into a code block like this

Sure, @Alistair_KodeKloud, Will come back

Here is the Full YAMLs of both PV and PVC:

student-node ~ âžś kubectl get pv,pvc -o yaml
apiVersion: v1
items:

PVC came in bound status,

Also, Just FYI, Previously and as well as currently, I have not created any new YAML, Steps that I followed are:

  1. edited pvc 150 - 100 Mi
  2. yaml file saved in /tmp/
  3. Ran newly created yaml from /tmp location.
    So that Namespace: default is already there, Nethier I removed, Nor I modified/Added.

Still Answer considered wrong.

Mock Test 5, Question 7

Hi @Sunil-Chhabra

Just testing the question and it’s work fine

Step to follow :

  • Edit pvc and modify capacity from 150 to 100
kubectl edit pvc orange-pvc-cka13-trb
  • Save edit a new file is create on /tmp
  • Delete existed pvc
kubectl delete pvc orange-pvc-cka13-trb

-Create a new pvc from the file on /tmp

kubectl create -f /tmp/kubectl-edit-1733228050.yaml

Normally, he should work

If the issue persists, please share the pv and pvc using codeblock on text format it’s not readable

Regard

Thansk @mmkmou_KodeKloud

I did follow - steps exactly as yours, but in my case, it considered wrong when I ended exam.

Also, It did considered Right in one of my attempts, so I am unsure what is happening.


1 Like