My pod declares two different volumes.
I use some definition templating, and depending on the environment in some cases I would like to reuse the same claim for the two volumes.
This results in an error:
Unable to mount volumes for pod "task-pv-pod_<...>": timeout expired waiting for volumes to attach/mount for pod "<...>"/"task-pv-pod". list of unattached/unmounted volumes=[task-pv-storage1]
- It works fine with two different claims.
- It is possible to reuse the same claim in several pods.
This is a simplified pod definition:
kind: Pod
apiVersion: v1
metadata:
name: task-pv-pod
spec:
volumes:
- name: task-pv-storage1
persistentVolumeClaim:
claimName: task-pv-claim
- name: task-pv-storage2
persistentVolumeClaim:
claimName: task-pv-claim
containers:
- name: task-pv-container
image: nginx
ports:
- containerPort: 80
name: "http-server"
volumeMounts:
- mountPath: "/usr/share/nginx/html"
name: task-pv-storage1
- mountPath: "/usr/share/nginx/something-else"
name: task-pv-storage2
So why is it not working?