<p>I'm using a PersistentVolume and a Claim and then mounting it to my workdir '/server' to create a simple Minecraft server using K8s, and when I deploy it the jar file isn't there anymore?<a href="https://i.stack.imgur.com/Dj7Du.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Dj7Du.png" alt="enter image description here" /></a></p>
<pre><code>deployment.yaml
---------------
    spec:
      volumes:
        - name: minecraft-pvstorage
          persistentVolumeClaim:
            claimName: minecraft-pvclaim
      containers:
        - name: minecraft-deployment
          image: localhost:32000/minecraft:1.18.2-new
          imagePullPolicy: Always
          ports:
            - containerPort: 30007
          volumeMounts:
            - name: minecraft-pvstorage
              mountPath: /server
</code></pre>
<pre><code>pv.yaml
-------
apiVersion: v1
kind: PersistentVolume
metadata:
  name: minecraft-pv
  labels:
    type: local
spec:
  storageClassName: manual
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: &quot;/mnt/minecraft&quot;
</code></pre>
<pre><code>pvclaim.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: minecraft-pvclaim
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
</code></pre>
<p>Can anyone help me with this? It works when I delete the volumeMounts from the deployment.yaml.</p>

benjamint08
<p>When you mount something onto a directory in the image that already has content, the content in the image becomes <em>obscured</em>, i.e. hidden and replaced with the content of the mount.</p>
<p>More info here: <a href="https://docs.docker.com/storage/bind-mounts/#mount-into-a-non-empty-directory-on-the-container" rel="nofollow noreferrer">https://docs.docker.com/storage/bind-mounts/#mount-into-a-non-empty-directory-on-the-container</a></p>
