#安装nfs软件
yum -y install nfs-utils
#修改配置文件
echo "/ifs/kubernetes *(rw,no_root_squash)" > /etc/exports
#验证
showmount -e
Export list for k8s-node01:
/ifs/kubernetes *
#其它节点测试,正常挂载,则正常
mount -t nfs 192.168.33.22:/ifs/kubernetes /mnt
#测试完成后,取消挂载
umount /mnt
# 部署yaml文件 nfs-client.zip
/root/nfspvc/nfs-client
class.yaml deployment.yaml rbac.yaml #修改deployment.yaml的路径和IP地址
kubectl apply -f .
#查看存储类
kubectl get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGEmanaged-nfs-storage fuseim.pri/ifs Delete Immediate false 8m26s
kubectl get pod
NAME READY STATUS RESTARTS AGE
nfs-client-provisioner-78c5f8cf76-dlnfb 1/1 Running 0 7m12s
helm show values stable/mysql
# helm install web-db --set persistence.storageClass="managed-nfs-storage" stable/mysql