<p>I'm trying to mount file from the host running minikube cluster with Hyper-V and pass in into MySQL Container with deployment yaml , I tried to add the file to the minikube vm ( with ssh) and then mount it to the deployment with PV and Claim , I tried to mount from the localhost that running the minikube ( my computer ) but still I don't see the file.</p>
<p>Current Configuration is : I have on the Hyper-V VM running minikube folder named data , and inside this folder i Have the file i want to transfer to the container ( pod ) .</p>
<p><strong>PV Yaml</strong></p>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: sqlvolume
spec:
  accessModes:
    - ReadWriteOnce
  capacity:
    storage: 1Gi
  hostPath:
    path: /data
</code></pre>
<p><strong>claim.yaml</strong></p>
<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  labels:
    io.kompose.service: sqlvolume
  name: sqlvolume
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
status: {}
</code></pre>
<p><strong>deployment.yaml (MySQL)</strong></p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: C:\Users\itayb\Desktop\K8S-Statefulset-NodeJs-App-With-MySql\kompose.exe convert
    kompose.version: 1.24.0 (7c629530)
  labels:
    io.kompose.service: mysql
  name: mysql
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: mysql
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        kompose.cmd: C:\Users\itayb\Desktop\K8S-Statefulset-NodeJs-App-With-MySql\kompose.exe convert
        kompose.version: 1.24.0 (7c629530)
      creationTimestamp: null
      labels:
        io.kompose.service: mysql
    spec:
      containers:
        - env:
            - name: MYSQL_DATABASE
              value: crud
            - name: MYSQL_ROOT_PASSWORD
              value: root
          image: mysql
          name: mysql
          ports:
            - containerPort: 3306
          volumeMounts:
            - mountPath: /data
              name: sqlvolume
          # resources:
          #     requests:
          #       memory: &quot;64Mi&quot;
          #       cpu: &quot;250m&quot;
          #     limits:
          #       memory: &quot;128Mi&quot;
          #       cpu: &quot;500m&quot;
      hostname: mysql
      restartPolicy: Always
      volumes:
        - name: sqlvolume
          persistentVolumeClaim:
            claimName: sqlvolume
status: {}
</code></pre>
<p>I Don't mind how to achieve that just , <strong>I have Hyper-V Minikube running on my computer and I want to transfer file mysql.sql from the host ( or from the PV I created ) to the pod.</strong></p>
<p>how can I achieve that ?</p>

ITBYD
<p>You can try with a hostPath type PersistentVolume</p>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-volume
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: &quot;/data/&lt;file_name&gt;&quot;
</code></pre>
<p>PersistentVolumeClaim</p>
<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pv-claim
spec:
  volumeName: &quot;pv-volume&quot;
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

</code></pre>
<p>Deployment ( changed pvc name )</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: C:\Users\itayb\Desktop\K8S-Statefulset-NodeJs-App-With-MySql\kompose.exe convert
    kompose.version: 1.24.0 (7c629530)
  labels:
    io.kompose.service: mysql
  name: mysql
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: mysql
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        kompose.cmd: C:\Users\itayb\Desktop\K8S-Statefulset-NodeJs-App-With-MySql\kompose.exe convert
        kompose.version: 1.24.0 (7c629530)
      creationTimestamp: null
      labels:
        io.kompose.service: mysql
    spec:
      containers:
        - env:
            - name: MYSQL_DATABASE
              value: crud
            - name: MYSQL_ROOT_PASSWORD
              value: root
          image: mysql
          name: mysql
          ports:
            - containerPort: 3306
          volumeMounts:
            - mountPath: /data
              name: sqlvolume
         resources:
             requests:
               memory: &quot;64Mi&quot;
               cpu: &quot;250m&quot;
             limits:
               memory: &quot;128Mi&quot;
               cpu: &quot;500m&quot;
      hostname: mysql
      restartPolicy: Always
      volumes:
        - name: sqlvolume
          persistentVolumeClaim:
            claimName: pv-claim
status: {}
</code></pre>
