<p>I am trying to mount a directory called rstudio which is residing in /mnt/rstudio. But when I try to mount using persistent volume, the directory is showing up but not the files inside rstudio. Here's my deployment file</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: rsp-deployment
spec:
  selector:
    matchLabels:
      app: rsp
  replicas: 1
  strategy: {}
  template:
    metadata:
      labels:
        app: rsp
    spec:
      nodeSelector:
        kubernetes.io/hostname: testserver.local
      volumes:
       - name: rsp-persistent-storage
         persistentVolumeClaim:
           claimName: pv-claim-rsp
      containers:
      - env:
        - name: RSP_LICENSE
          value: MY LICENSE
        image: rstudio/rstudio-server-pro:latest
        name: rstudio-server-pro
        ports:
        - containerPort: 8787
        - containerPort: 5559
        volumeMounts:
         - name: rsp-persistent-storage
           mountPath: /tmp/rstudio
        resources: {}
        securityContext:
          privileged: true
      restartPolicy: Always
status: {}

---
kind: Service
apiVersion: v1
metadata:
  name: rstudio-server-pro
spec:
  selector:
    app: rsp
  ports:
  - protocol: TCP
    name: &quot;8787&quot;
    port: 8787
    targetPort: 8787
  type: NodePort
</code></pre>
<p>And my pv and pvc files are as follows</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-volume-rsp
spec:
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: &quot;/mnt/rstudio&quot;
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pv-claim-rsp
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: &quot;&quot;
  resources:
    requests:
      storage: 5Gi
</code></pre>
<p>Inside my /mnt/rstudio there are these much files.</p>
<pre><code>[root@test-server rstudio]# ls
launcher.conf                      launcher-mounts          launcher.pub        rserver.conf  
launcher.kubernetes.conf           launcher-mounts_working  logging.conf        rsession.conf 
launcher.kubernetes.profiles.conf  launcher.pem             notifications.conf  r-versions

</code></pre>
<p>But after the pod is up and running, the directory is showing empty. Any idea why? Thanks in advance!</p>

Siddharth
<p>LGTM. I am getting files if I swap the image with <code>nginx</code>. I would check two things:</p>
<ol>
<li>Permissions: Check what permissions the files have. You may have to update your permissions or UID to access the files.</li>
<li>Does <code>rstudio</code> image use that path? It may be processing that folder when it starts. Try mounting to a different path and see if you can see the files.</li>
</ol>
<p>Also, make sure you are launching the pod on the node where the host path exists. I am assuming <code>testserver.local</code> and <code>test-server</code> are the same.</p>
<p>HTH</p>
