apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: nfs-sc annotations: storageclass.kubernetes.io/is-default-class: "true" provisioner: nfs-client allowVolumeExpansion: True parameters: archiveOnDelete: "true" --- apiVersion: apps/v1 kind: Deployment metadata: name: nfs-client labels: app: nfs-client namespace: default spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: nfs-client template: metadata: labels: app: nfs-client spec: serviceAccountName: nfs-client containers: - name: nfs-client #image: registry.cn-hangzhou.aliyuncs.com/lfy_k8s_images/nfs-subdir-external-provisioner:v4.0.2 #image: registry.cn-hangzhou.aliyuncs.com/zhengyu1992/nfs-subdir-external-provisioner:v4.0.2 image: harbor.uenpay.com/base/nfs-subdir-external-provisioner:v4.0.2 # resources: # limits: # cpu: 10m # requests: # cpu: 10m volumeMounts: - name: nfs-client-root mountPath: /persistentvolumes env: - name: PROVISIONER_NAME value: nfs-client - name: NFS_SERVER value: 192.168.31.189 - name: NFS_PATH value: /data/nfs volumes: - name: nfs-client-root nfs: server: 192.168.31.189 path: /data/nfs --- apiVersion: v1 kind: ServiceAccount metadata: name: nfs-client namespace: default --- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: nfs-client-runner rules: - apiGroups: [""] resources: ["nodes"] verbs: ["get", "list", "watch"] - apiGroups: [""] resources: ["persistentvolumes"] verbs: ["get", "list", "watch", "create", "delete"] - apiGroups: [""] resources: ["persistentvolumeclaims"] verbs: ["get", "list", "watch", "update"] - apiGroups: ["storage.k8s.io"] resources: ["storageclasses"] verbs: ["get", "list", "watch"] - apiGroups: [""] resources: ["events"] verbs: ["create", "update", "patch"] --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: nfs-client-runner-binding subjects: - kind: ServiceAccount name: nfs-client namespace: default roleRef: kind: ClusterRole name: nfs-client-runner apiGroup: rbac.authorization.k8s.io --- kind: Role apiVersion: rbac.authorization.k8s.io/v1 metadata: name: leader-locking-nfs-client namespace: default rules: - apiGroups: [""] resources: ["endpoints"] verbs: ["get", "list", "watch", "create", "update", "patch"] --- kind: RoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: leader-locking-nfs-client namespace: default subjects: - kind: ServiceAccount name: nfs-client namespace: default roleRef: kind: Role name: leader-locking-nfs-client apiGroup: rbac.authorization.k8s.io