<p>Is there any way to connect to a volume attached to a Kubernetes cluster and explore the content inside it.</p>

anXler
<p>First, create a PersistentVolumeClaim and Pod to mount the volume</p>

<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-claim
spec:
  accessModes:
    - ReadWriteOnce
  volumeName: &lt;the-volume-that-you-want-to-explore&gt;
  resources:
    requests:
      storage: 3Gi
---
apiVersion: v1
kind: Pod
metadata:
  name: volume-inspector
spec:
  containers:
    - name: foo
      command: ["sleep","infinity"]
      image: ubuntu:latest
      volumeMounts:
      - mountPath: "/tmp/mount"
        name: data
  volumes:
    - name: data
      persistentVolumeClaim:
        claimName: my-claim
        readOnly: true
</code></pre>

<p>Then exec into the Pod and start exploring</p>

<pre><code>$ kubectl exec -it volume-inspector bash
root@volume-inspector:/# ls /tmp/mount
</code></pre>
