Trying to mount existing volume in k8s generates error

10/28/2019

I have a very simple test.yaml file:

apiVersion: v1
metadata:
  name: petter-dummy-pod
spec:
  volumes:
    - name: recovery
      persistentVolumeClaim:
       claimName: petter-test
  containers:
    - name: petter-dummy-pod
      image: ubuntu
      command: ["/bin/bash", "-ec", "while :; do echo '.'; sleep 5 ; done"]
      volumeMounts:
        - name: petter-test
          mounthPath: "/tmp/recovery"
          subPath: recovery
  restartPolicy: Never

When I apply this one it generates an error that I am a bit stuck with:

/home/ubuntu# kubectl apply -f test.yaml
error: error validating "test.yaml": error validating data: [ValidationError(Pod.spec.containers[0].volumeMounts[0]): unknown field "mounthPath" in io.k8s.api.core.v1.VolumeMount, ValidationError(Pod.spec.containers[0].volumeMounts[0]): missing required field "mountPath" in io.k8s.api.core.v1.VolumeMount]; if you choose to ignore these errors, turn validation off with --validate=false

Any ideas how to solve this one?

-- Petter
kubernetes

1 Answer

10/28/2019

you have got a typo mounthPath: "/tmp/recovery" it should be mountPath rather than mounthPath

-- Suresh Vishnoi
Source: StackOverflow