Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 32s default-scheduler Successfully assigned default/nfs-storage-nfs-client-provisioner-dcf475cdb-z5jn6 to node02 Warning FailedMount 0s (x7 over 31s) kubelet MountVolume.SetUp failed for volume "nfs-client-root" : mount failed: exit status 32 Mounting command: mount Mounting arguments: -t nfs 192.168.111.128:/data /var/lib/kubelet/pods/54c0d134-37bc-4661-a1a1-34691f914224/volumes/kubernetes.io~nfs/nfs-client-root Output: mount: wrong fs type, bad option, bad superblock on 192.168.111.128:/data, missing codepage or helper program, or other error (for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program)
In some cases useful info is found in syslog - try dmesg | tail or so.
# helm repo add azure http://mirror.azure.cn/kubernetes/charts/ "azure" has been added to your repositories # helm search repo nfs NAME CHART VERSION APP VERSION DESCRIPTION azure/nfs-client-provisioner 1.2.11 3.1.0 DEPRECATED - nfs-client is an automatic provisi... azure/nfs-server-provisioner 1.1.3 2.3.0 DEPRECATED - nfs-server-provisioner is an out-o...
安装helm
1 2
# helm pull azure/nfs-client-provisioner # tar zxvf nfs-client-provisioner-1.2.11.tgz
# kubectl get pod -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES nfs-storage-nfs-client-provisioner-dcf475cdb-22zm9 1/1 Running 0 2m3s 10.244.2.21 node02 <none> <none> # kubectl get sc NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE nfs-client (default) cluster.local/nfs-storage-nfs-client-provisioner Delete Immediate true 12m
踩坑
通过nfs的sc无法创建pvc,pod日志
1
E0710 06:40:34.902614 1 controller.go:1004] provision "default/mysql-pv-claim" class "nfs-client": unexpected error getting claim reference: selfLink was empty, can't make reference
解决方案:nfs-provisioner报错问题:”selfLink was empty”
1 2 3
# vim /etc/kubernetes/manifests/kube-apiserver.yaml // 增加 - --feature-gates=RemoveSelfLink=false #添加此行