91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

NFS-Client-Provisioner部署

發布時間:2020-06-21 02:37:40 來源:網絡 閱讀:920 作者:蘭朝亞 欄目:系統運維

部署NFS-Client Provisioner的初衷,就是為了根據PVC的需求自動創建符合要求的PV。
首先,必須擁有自己的NFS Server, 而且k8s集群能夠正常訪問之。

之后,在k8s master上應用以下yaml文件:
1 RBAC.yaml

apiVersion: v1
kind: ServiceAccount
metadata:
  name: nfs-client-provisioner
  # replace with namespace where provisioner is deployed
  namespace: nfs-client-provisioner
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: nfs-client-provisioner-runner
rules:
  - 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: run-nfs-client-provisioner
subjects:
  - kind: ServiceAccount
    name: nfs-client-provisioner
    # replace with namespace where provisioner is deployed
    namespace: nfs-client-provisioner
roleRef:
  kind: ClusterRole
  name: nfs-client-provisioner-runner
  apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: leader-locking-nfs-client-provisioner
    # replace with namespace where provisioner is deployed
  namespace: nfs-client-provisioner
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-provisioner
subjects:
  - kind: ServiceAccount
    name: nfs-client-provisioner
    # replace with namespace where provisioner is deployed
    namespace: nfs-client-provisioner
roleRef:
  kind: Role
  name: leader-locking-nfs-client-provisioner
  apiGroup: rbac.authorization.k8s.io

2 Deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nfs-client-provisioner
  labels:
    app: nfs-client-provisioner
  # replace with namespace where provisioner is deployed
  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: zbb.test/nfs
            - name: NFS_SERVER
              value: 10.0.0.31
            - name: NFS_PATH
              value: /netshare
      volumes:
        - name: nfs-client-root
          nfs:
            server: 10.0.0.31
            path: /netshare

注意修改env和volumes中關于NFS Server的參數

3 storageclass.yaml

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: managed-nfs-storage
provisioner: zbb.test/nfs # or choose another name, must match deployment's env PROVISIONER_NAME'
parameters:
  archiveOnDelete: "false"

注意:
1) storageclass中的provisioner必須與deployment中的定義一致!
2) 如果不把nfs-client-provisioner部署到默認名稱空間中,需要將“# replace with namespace where provisioner is deployed”標注的namespace全部改為目標namespace名稱
3)Storagelass的名稱可以修改成自己想要的

查看已部署的Storagelass:

# kubectl get storageclass
# kubectl get cs

(參考<2>)將managednfs-storage這個storageclass設置為kubernetes的默認存儲后端:

# kubectl patch storageclass managed-nfs-storage -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

由此, 部署完成, 下面給出個測試示例:
4 test-pvc.yaml

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: test-claim
  annotations:
    volume.beta.kubernetes.io/storage-class: "managed-nfs-storage"
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 1Mi

5 test-pod.yaml

kind: Pod
apiVersion: v1
metadata:
  name: test-pod
spec:
  containers:
  - name: test-pod
    image: busybox:1.24
    command:
      - "/bin/sh"
    args:
      - "-c"
      - "touch /mnt/SUCCESS && exit 0 || exit 1"
    volumeMounts:
      - name: nfs-pvc
        mountPath: "/mnt"
  restartPolicy: "Never"
  volumes:
    - name: nfs-pvc
      persistentVolumeClaim:
        claimName: test-claim

到此, 可以查詢測試結果,測試完成
此后就可以使用NFS動態供給PV啦,不需要手工創建咯

測試平臺:kubernetes 1.16.3
OS: CentOS Linux release 7.7.1908 (Core)

參考資料:
<1> https://github.com/kubernetes-incubator/external-storage/tree/master/nfs-client
<2> https://www.cnblogs.com/robinunix/p/11133032.html

在此向參考資料的作者表示感謝!!

向AI問一下細節
推薦閱讀:
  1. sybase部署
  2. Django部署

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

漯河市| 水城县| 鹤山市| 大理市| 龙泉市| 霍邱县| 衡水市| 军事| 迭部县| 普洱| 玉山县| 通榆县| 晋宁县| 岱山县| 黄平县| 台山市| 察雅县| 林西县| 郧西县| 平山县| 许昌市| 洞口县| 尚义县| 五大连池市| 上蔡县| 宜城市| 龙州县| 剑河县| 宜昌市| 南昌县| 江西省| 湖口县| 满洲里市| 科技| 嘉义县| 仁布县| 通山县| 武邑县| 万源市| 尤溪县| 东乡族自治县|