0

I am running a kuberneted cluster using minikube.

I want to mount a folder from my PC into the minikube.

How can i do that.

I see there is hostPath, but that used the node inside minikube

Just like in docker-compose we can mount a host folder into the container, is there any such provision

Santhosh
  • 9,965
  • 20
  • 103
  • 243
  • Does [this](https://stackoverflow.com/questions/48534980/mount-local-directory-into-pod-in-minikube) answer your question? If not, could you please describe the environment in which minikube is running? – Andrew Skorkin Mar 14 '22 at 15:10

1 Answers1

0

@Santhosh If i understand your question correctly, do you want to mount a path from within a container to a PV of type hostpath on your host? Have you tried this :-

apiVersion: v1
kind: Pod
metadata:
  name: pv-recycler
  namespace: default
spec:
  restartPolicy: Never
  volumes:
  - name: vol
    hostPath:
      path: /any/path/it/will/be/replaced
  containers:
  - name: pv-recycler
    image: "k8s.gcr.io/busybox"
    command: ["/bin/sh", "-c", "test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/*  && test -z \"$(ls -A /scrub)\" || exit 1"]
    volumeMounts:
    - name: vol
      mountPath: /scrub
Amit
  • 633
  • 6
  • 13
  • `hostPath: path: /any/path/it/will/be/replaced` so you mean i can use the path on my local pc here directly. – Santhosh Mar 13 '22 at 03:14