Edith Puclla:
Hello guys, what is wrong with this yaml, It looks well with the volumeMounts
spec:
containers:
- command:
- /bin/sh
- -c
- while true; do date; sleep $TIME_FREQ;done > /opt/time/time-check.log
image: busybox
imagePullPolicy: Always
name: time-check
resources: {}
volumeMounts:
- mountPath: /opt/time
name: vol
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumes:
- name: vol
emptyDir: {}
dnsPolicy: ClusterFirst
enableServiceLinks: true
nodeName: node01
preemptionPolicy: PreemptLowerPriority
I am getting this error, when I apply the yaml
controlplane $ k apply -f /tmp/kubectl-edit-xk9a5.yaml -n dvl1987
The Pod "time-check" is invalid: spec.containers[0].volumeMounts[0].name: Not found: "vol"
Tanumoy Ghosh:
Just a guess if vol is a keyword; try changing vol
to my-vol
and see if it gets applied
Edith Puclla:
same problem 
The Pod "time-check" is invalid: spec.containers[0].volumeMounts[0].name: Not found: "volll"
Tanumoy Ghosh:
Is this Lightening Lab 1 or 2 ?
Edith Puclla:
Lightening 1 , question 3 I think, time-check pod
Tanumoy Ghosh:
ok - let me try
Tanumoy Ghosh:
Did you create the configmap time-config
before creating the pod and why are you explicitly scheduling the pod in node01 ?
For me it worked with vol
$ kubectl create ns dvl1987
namespace/dvl1987 created
$ kubectl -n dvl1987 create cm time-config --from-literal=TIME_FREQ=10
configmap/time-config created
$ kubectl -n dvl1987 run time-check --image busybox --dry-run=client -o yaml -- /bin/sh -c 'while true; do date; sleep $TIME_FREQ;done >> /opt/time/time-check.log' > busybox.yaml
$ vi busybox.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: time-check
name: time-check
namespace: dvl1987
spec:
containers:
- args:
- /bin/sh
- -c
- while true; do date; sleep $TIME_FREQ;done >> /opt/time/time-check.log
image: busybox
name: time-check
resources: {}
volumeMounts:
- mountPath: /opt/time
name: vol
volumes:
- name: vol
emptyDir: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
$ kubectl create -f busybox.yaml
pod/time-check created
Tanumoy Ghosh:
I have copy pasted your spec
section it is working fine at my end in Kodekloud Lab environment
Edith Puclla:
I see @Tanumoy Ghosh I was editing this pod, so maybe I got confused 
I did it again, and It works too.
Thank you so much