概述
https://hub.helm.sh/charts/stable/nfs-client-provisioner
部署准备
部署方式
fetch到本地,并解压
helm fetch stable/nfs-client-provisioner
tar -xf nfs-client-provisioner-1.2.6.tgz
修改values.yaml,主要设置以下几个选项,其它一些选项,如storageClass.reclaimPolicy可根据情况自行定制
特别注意: mountOptions挂载参数是数组形式
nfs:
server: xxxx.cn-shenzhen.nas.aliyuncs.com
path: default
mountOptions:
- vers=3
- nolock
- proto=tcp
- noresvport
通过helm安装
#执行如下安装命令:
helm install -f values.yaml --name default-nfs-provisioner stable/nfs-client-provisioner
检查
#主要看sc是否创建
kubectl get sc
NAME PROVISIONER AGE
nfs-client cluster.local/default-nfs-provisioner-nfs-client-provisioner 6m16s
kubectl describe sc nfs-client
Name: nfs-client
IsDefaultClass: No
Annotations: <none>
Provisioner: cluster.local/default-nfs-provisioner-nfs-client-provisioner
Parameters: archiveOnDelete=true
AllowVolumeExpansion: True
MountOptions:
vers=3
nolock
proto=tcp
noresvport
ReclaimPolicy: Delete
VolumeBindingMode: Immediate
Events: <none>
测试
#创建test-nfs-pvc.yaml,内容如下:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test-nfs-pvc
spec:
storageClassName: nfs-client
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Mi
#执行如下命令:
kubectl apply -f test-nfs-pvc.yaml
#查看pvc,及pv的情况
kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
test-nfs-pvc Bound pvc-65937626-deb4-11e9-b579-00163e064a2f 10Mi RWO nfs-client 2m49s
已经自动创建了PV(pvc-65937626-deb4-11e9-b579-00163e064a2f),并绑定了
#查看PV
kubectl describe pv pvc-65937626-deb4-11e9-b579-00163e064a2f
Name: pvc-65937626-deb4-11e9-b579-00163e064a2f
Labels: <none>
Annotations: pv.kubernetes.io/provisioned-by: cluster.local/default-nfs-provisioner-nfs-client-provisioner
Finalizers: [kubernetes.io/pv-protection]
StorageClass: nfs-client
Status: Bound
Claim: default/test-nfs-pvc
Reclaim Policy: Delete
Access Modes: RWO
VolumeMode: Filesystem
Capacity: 10Mi
Node Affinity: <none>
Message:
Source:
Type: NFS (an NFS mount that lasts the lifetime of a pod)
Server: xxxx.cn-shenzhen.nas.aliyuncs.com
Path: /default/default-test-nfs-pvc-pvc-65937626-deb4-11e9-b579-00163e064a2f
ReadOnly: false
Events: <none>




