<p>I am transitioning from docker to Kubernetes. Had been volumes on docker to expose files needed by container, just like the example below to provide grafana container some files.</p>
<p>I am confused on how the same can be established in Kubernetes using volumeMounts and volumes, and how is it linked to PersistentVolumeClaim.</p>
<pre class="lang-yaml prettyprint-override"><code>version: '3'

volumes:
  grafana_app_data: {}

services:
  grafana:
    image: grafana/grafana:latest
    volumes:
      - grafana_app_data:/var/lib/grafana
      - ./directory-on-local-machine/:/etc/grafana/provisioning/
</code></pre>

maopuppets
<p>A Pod Spec that is equivalent ↔️ would be something like this:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Pod
metadata:
  name: grafana-pod
spec:
  containers:
  - image: grafana/grafana:latest
    name: grafana-container
    volumeMounts:
    - mountPath: /var/lib/grafana
      name: grafana-app-data
    - mountPath: /etc/grafana/provisioning
      name: grafana-provisioning
  volumes:
  - name: grafana-app-data
    hostPath:
      path: /grafana-data
      type: Directory
  - name: grafana-provisioning
    hostPath:
      path: /directory-on-machiche
      type: Directory
</code></pre>
<p>This is using basic <code>hostPath</code>, you can also use a <a href="https://kubernetes.io/docs/concepts/storage/volumes/#local" rel="nofollow noreferrer">local volume</a> 💾 or any other type of <a href="https://kubernetes.io/docs/concepts/storage/volumes/" rel="nofollow noreferrer">supported volume</a> depending on what you need. 💾📀💿💽</p>
