How to use Kubernetes Persistent Local Volumes with Minikube on OSX?

3/5/2019

I want to experiment with Persistent Local Volumes using Minikube on OSX. I am using the local provisioner (https://github.com/kubernetes-sigs/sig-storage-local-static-provisioner) to create the PVs for me.

I create the local directory on the OSX host and mount it to the Minikube VM:

mkdir -p /path/to/data/dir
minikube mount /path/to/data/dir:/data/dir &

When I look at the logs for the provisioner, I can see errors like this:

Found new volume at host path "/data/dir" with capacity 0, creating Local PV "local-pv-ccc90d9b", required volumeMode "Filesystem"
Error creating PV "local-pv-ccc90d9b" for volume at "/data/zk-2": PersistentVolume "local-pv-ccc90d9b" is invalid: spec.capacity[storage]: Invalid value: "0": must be greater than zero

Guided by the advice here (https://github.com/kubernetes-incubator/external-storage/issues/968), I ssh'ed in to the Minikube VM and looked at the capacity of the mount:

$ df /data/dir/
Filesystem     1K-blocks  Used Available Use% Mounted on
192.168.99.1           0     0         0    - /data/dir

So the capacity of the mount is zero and this seems to the why it's throwing up the error I see. However, the parent directory

$ df /data          
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sda1       16888216 1129408  14769676   8% /data

Is this an issue with the minikube mount command? Can this be made to work on OSX? How do I get a Persistent Local Volume to work on OSX Minikube?

-- John
kubernetes
minikube

0 Answers