How do you delete Minikube hostpath directory from host using xhyve?

1.7k views Asked by At

I'm using the PersistentVolume functionality for sharing VM directories with Pods. For example:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: psql-data-disk
spec:
  accessModes:
    - ReadWriteOnce
  capacity:
    storage: 1Gi
  hostPath:
    path: /data/psqldata

But I can't figure out how to delete the directory from the host VM so that I can reset the data. Minikube persists the /data/ directory across VM reboots, but doesn't document where it's storing it.

If you kubectl delete PersistentVolume psql-data-disk it doesn't delete any of the contents in the directory itself, it just deletes the K8s resource.

I'm using the docker-machine-driver-xhyve driver installed via brew on OSX Sierra.

2

There are 2 answers

0
Shane On

Ugh, I hadn't known about the minikube ssh command to get into the VM. So I just went in there and deleted the directory.

0
nuwar On

Thank you and Add some solution which i experienced persistant volume(pv) mounted to hostpath can't be deleted because of 'permission denined' And then if you do nothing in your minikube, you can login in root user. login and input 'root'