Kubernetes Persistent Volume Mount not found
Looks like you have an indentation it's finding the VolumeMount but not the Volume. Something like this should work:
containers:- image: your-image name: your-containers volumeMounts: - name: config mountPath: /config readOnly: true args: - --configfile=/config/traefik.tomlvolumes: - name: config persistentVolumeClaim: claimName: pvclaim2 configMap: name: traefik-config
Im going to take a wild guess here, is your traefik ingress controller running in the same namespace as your pvc? Pvc are namespace scoped, in your example, it is in default namespace. Normally we deploy ingress into its own namespace like "ingress" and its other associated pods.
Let's debug:
1) the name of your PersistentVolumeClaim is pvclaim2
and everything looks ok
2) VolumeMounts
section looks ok. config
is in read-only mode and it is correct for config.
3) volumes
section describes that config
volume's type is the persistentVolumeClaim
and it links to the PVC pvclaim2
- ok!
4) Next we can see that config
volume's type is the configMap
along with the PersistentVolumeClaim
at the same time...and that will be the reason of an errors in the future. Assuming you wanted to use config
volume as a mount for configfile traefik.toml
you don't need PVC (especially 5 gigabytes in read-only mode)
All you need to do is createconfigMap
. Command syntax:
kubectl create configmap <map-name> <data-source>
In your case it could be done like this:
kubectl create configmap traefik-config --from-file=<your-local-path-to-file>/traefik.toml
Then you need to update your Deployment:
containers:- image: your-image name: your-containers volumeMounts: - name: config mountPath: /config readOnly: true # as far as i know configmaps are read-only since 1.9.5 - name: some-persistent-storage-name mountPath: /<some-mount-point-for-storage>
...
volumes: - name: config configMap: name: traefik-config - name: some-persistent-storage-name persistentVolumeClaim: claimName: pvclaim2