一、NFSd配置
- 打开系统配置 System Preferences
- 点开安全和隐私 Security & Privacy → Privacy → Full Disk Access
- 点击 输入密码
- 点击 +
- 按下⌘ command + shift + G
- 键入/sbin/nfsd 并点击 Go, 然后点击Open
注:这个选项会允许nfsd访问所有磁盘文件。
二、Minikube的安装
# minikube start --driver=hyperkit --container-runtime=containerd \
--image-mirror-country=cn --nfs-share=/Users/tom/Documents/letsencrypt \
--nfs-shares-root=/nfsshares
minikube v1.19.0 on Darwin 11.3
▪ KUBECONFIG=/Users/tom/.kube/config
✨ Using the hyperkit driver based on user configuration
❗ None of the known repositories in your location are accessible. Using registry.cn-hangzhou.aliyuncs.com/google_containers as fallback.
✅ Using image repository registry.cn-hangzhou.aliyuncs.com/google_containers
Starting control plane node minikube in cluster minikube
Creating hyperkit VM (CPUs=2, Memory=2200MB, Disk=20000MB) ...
Preparing Kubernetes v1.20.2 on containerd 1.4.3 ...
▪ Generating certificates and keys ...
▪ Booting up control plane ...
▪ Configuring RBAC rules ...
Configuring bridge CNI (Container Networking Interface) ...
Verifying Kubernetes components...
▪ Using image registry.cn-hangzhou.aliyuncs.com/google_containers/k8s-minikube/storage-provisioner:v5 (global image repository)
Enabled addons: storage-provisioner, default-storageclass
Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
- 查看exports文件
> $ cat /etc/exports
# BEGIN: minikube-hyperkit minikube-/Users/tom/Documents/letsencrypt
/Users/tom/Documents/letsencrypt 192.168.64.15 -alldirs -mapall=tom
# END: minikube-hyperkit minikube-/Users/tom/Documents/letsencrypt
2. 在一些特别的场景下需要local_lock=all
需要重新remount一下,并带上local_lock=all
选项。
# minikube ssh 'su -c "mount -t nfs -o remount,rw -o local_lock=all 192.168.64.1:/Users/tom/Documents/letsencrypt /nfsshares/Users/tom/Documents/letsencrypt "'