<p>I have a pod called <code>mypod0</code> with two persistent volumes.</p>
<p><code>mypd0</code>, <code>mypd1</code> (provided through two persistent volume claims <code>myclaim0</code>, <code>myclaim1</code>) mounted into <code>mypod0</code> at <code>/dir0</code>, <code>/dir1</code> as shown in the pod definition below.</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: mypod0
spec:
  containers:
    - name: mycontainer
      image: myimage
      volumeMounts:
      - mountPath: &quot;/dir0&quot;
        name: mypd
-   mountPath: &quot;/dir1&quot;
-   name: mypd1
  volumes:
    - name: mypd0
      persistentVolumeClaim:
        claimName: myclaim0
    - name: mypd1
      persistentVolumeClaim:
        claimName: myclaim1
</code></pre>
<p>Now I also have another pod <code>mypod1</code> already running in the cluster. Is there a way to <strong>dynamically/programmatically</strong> (using fabric8, Kubernetes-client) to unmount (detach) <code>mypd1</code> from <code>mypod0</code>, and then attach the volume <code>mypd1</code> into <code>mypod1</code> (without restarting any of the pods <code>mypod0</code>, <code>mypod1</code>). Any hint will be appreciated.</p>

Mazen Ezzeddine
<p><strong>As <a href="https://stackoverflow.com/users/213269/jonas">Jonas</a> mentioned in the comment, this action is not possible:</strong></p>
<blockquote>
<p>Nope, this is not possible. Pod-manifests is intended to be seen as immutable and pods as disposable resources.</p>
</blockquote>
<p>Look at the definition of <a href="https://kubernetes.io/docs/concepts/workloads/pods/" rel="nofollow noreferrer">pods</a>:</p>
<blockquote>
<p><em>Pods</em>  are the smallest deployable units of computing that you can create and manage in Kubernetes.</p>
<p>A  <em>Pod</em>  (as in a pod of whales or pea pod) is a group of one or more  <a href="https://kubernetes.io/docs/concepts/containers/" rel="nofollow noreferrer">containers</a>, with shared storage and network resources, and a specification for how to run the containers. A Pod's contents are always co-located and co-scheduled, and run in a shared context. A Pod models an application-specific &quot;logical host&quot;: it contains one or more application containers which are relatively tightly coupled. In non-cloud contexts, applications executed on the same physical or virtual machine are analogous to cloud applications executed on the same logical host.</p>
</blockquote>
<p>However, you can dynamically create new storage volumes. Kubernetes supports <a href="https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/" rel="nofollow noreferrer">Dynamic Volume Provisioning</a>:</p>
<blockquote>
<p>Dynamic volume provisioning allows storage volumes to be created on-demand. Without dynamic provisioning, cluster administrators have to manually make calls to their cloud or storage provider to create new storage volumes, and then create  <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/" rel="nofollow noreferrer"><code>PersistentVolume</code>  objects</a>  to represent them in Kubernetes. The dynamic provisioning feature eliminates the need for cluster administrators to pre-provision storage. Instead, it automatically provisions storage when it is requested by users.</p>
</blockquote>
