<p>I have a pretty simple Kubernetes pod. I want a stateful set and want the following process:</p>

<ol>
<li>I want to have an initcontainer download and uncompress a tarball from s3 into a volume mounted to the initcontainer</li>
<li>I want to mount that volume to my main container to be used </li>
</ol>

<p></p>

<pre><code>apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: app
  namespace: test
  labels:
    name: app
spec:
  serviceName: app
  replicas: 1
  selector:
    matchLabels:
      app: app
  template:
    metadata:
      labels:
        app: app
    spec:
      initContainers:
      - name: preparing
        image: alpine:3.8
        imagePullPolicy: IfNotPresent
        command:
          - "sh"
          - "-c"
          - |
            echo "Downloading data"
            wget https://s3.amazonaws.com/.........
            tar -xvzf xxxx-........ -C /root/
        volumeMounts:
        - name: node-volume
          mountPath: /root/data/

      containers:
      - name: main-container
        image: ecr.us-west-2.amazonaws.com/image/:latest
        imagePullPolicy: Always

        volumeMounts:
        - name: node-volume
          mountPath: /root/data/

  volumeClaimTemplates:
  - metadata:
      name: node-volume
    spec:
      accessModes: [ "ReadWriteOnce" ]
      storageClassName: gp2-b
      resources:
        requests:
          storage: 80Gi
</code></pre>

<p>I continue to get the following error:</p>

<p>At first I run this and I can see the logs flowing of my tarball being downloaded by the initcontainer. About half way done it terminates and gives me the following error:</p>

<pre><code>Multi-Attach error for volume "pvc-faedc8" Volume is 
already exclusively attached to one node and can't be 
attached to another
</code></pre>

LoganHenderson
<p>Looks like you have a dangling <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims" rel="noreferrer">PVC</a> and/or <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/" rel="noreferrer">PV</a> that is attached to one of your nodes.  You can ssh into the node and run a <code>df</code> or <code>mount</code> to check.</p>
<p>If you look at <a href="https://stackoverflow.com/questions/46442238/can-i-rely-on-volumeclaimtemplates-naming-convention">this</a> the PVCs in a StatefulSet are always mapped to their pod names, so it may be possible that you still have a dangling pod(?)</p>
<p>If you have a dangling pod:</p>
<pre><code>$ kubectl -n test delete pod &lt;pod-name&gt;
</code></pre>
<p>You may have to force it:</p>
<pre><code>$ kubectl -n test delete pod &lt;pod-name&gt; --grace-period=0 --force
</code></pre>
<p>Then, you can try deleting the PVC and it's corresponding PV:</p>
<pre><code>$ kubectl delete pvc pvc-faedc8
$ kubectl delete pv &lt;pv-name&gt;
</code></pre>
