-
Notifications
You must be signed in to change notification settings - Fork 0
CloudNative: nfs
x893675 edited this page Aug 9, 2020
·
1 revision
yum install nfs-utils
mkdir -p /nfs/data
-
chmod -R 777 /nfs/data
- 若挂载磁盘的话执行:
mkfs.xfs /dev/sdb
mount /dev/sdb /nfs/data
echo "/dev/sdb /nfs/data xfs defaults 0 0" >> /etc/fstab
- 若挂载磁盘的话执行:
echo "/nfs/data *(rw,no_root_squash,sync)" > /etc/exports
exportfs -r
systemctl enable nfs --now
-
kubectl apply -f https://raw.githubusercontent.com/kubernetes-incubator/external-storage/master/nfs-client/deploy/rbac.yaml
-
部署nfs-client-provisioner
# 修改${NODE_IP}, 执行kubectl apply -f xx apiVersion: apps/v1 kind: Deployment metadata: name: nfs-client-provisioner labels: app: nfs-client-provisioner namespace: default spec: replicas: 1 selector: matchLabels: app: nfs-client-provisioner strategy: type: Recreate selector: matchLabels: app: nfs-client-provisioner template: metadata: labels: app: nfs-client-provisioner spec: serviceAccountName: nfs-client-provisioner containers: - name: nfs-client-provisioner image: quay.io/external_storage/nfs-client-provisioner:latest volumeMounts: - name: nfs-client-root mountPath: /persistentvolumes env: - name: PROVISIONER_NAME value: fuseim.pri/ifs - name: NFS_SERVER value: ${NODE_IP} - name: NFS_PATH value: /nfs/data volumes: - name: nfs-client-root nfs: server: ${NODE_IP} path: /nfs/data
-
创建storage class
#执行kubectl apply -f xx apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: nfs provisioner: fuseim.pri/ifs parameters: archiveOnDelete: "false" reclaimPolicy: Delete
-
设置nfs为默认sc:
kubectl patch storageclass nfs -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'