I have a pod called mypod0
with two persistent volumes.
mypd0
, mypd1
(provided through two persistent volume claims myclaim0
, myclaim1
) mounted into mypod0
at /dir0
, /dir1
as shown in the pod definition below.
apiVersion: v1
kind: Pod
metadata:
name: mypod0
spec:
containers:
- name: mycontainer
image: myimage
volumeMounts:
- mountPath: "/dir0"
name: mypd
- mountPath: "/dir1"
- name: mypd1
volumes:
- name: mypd0
persistentVolumeClaim:
claimName: myclaim0
- name: mypd1
persistentVolumeClaim:
claimName: myclaim1
Now I also have another pod mypod1
already running in the cluster. Is there a way to dynamically/programmatically (using fabric8, Kubernetes-client) to unmount (detach) mypd1
from mypod0
, and then attach the volume mypd1
into mypod1
(without restarting any of the pods mypod0
, mypod1
). Any hint will be appreciated.
As Jonas mentioned in the comment, this action is not possible:
Look at the definition of pods:
However, you can dynamically create new storage volumes. Kubernetes supports Dynamic Volume Provisioning: