您好,登錄后才能下訂單哦!
這篇文章主要介紹“如何使用NAS動態(tài)存儲卷創(chuàng)建有狀態(tài)應用”,在日常操作中,相信很多人在如何使用NAS動態(tài)存儲卷創(chuàng)建有狀態(tài)應用問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”如何使用NAS動態(tài)存儲卷創(chuàng)建有狀態(tài)應用”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
目前動態(tài)生成NAS存儲卷的實現(xiàn):在一個已有文件系統(tǒng)上,自動生成子文件系統(tǒng)(子目錄),并生成目標存儲卷(PV);
生成的PV名字為:pvc-${pv-uid}
registry.cn-hangzhou.aliyuncs.com/acs/alicloud-nas-controller:v3.1.0-k8s1.11
部署前要先創(chuàng)建一個NAS文件系統(tǒng),并添加掛載點。注意:掛載點需要和集群處于同一個VPC內(nèi)部。
部署模板中,創(chuàng)建Storageclass的時候可以定義reclaimPolicy類型,可以為Retain或者Delete;
根據(jù)自己NAS掛載點修改NFS_SERVER、server的值;
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: alicloud-nas mountOptions: - vers=4.0 provisioner: alicloud/nas reclaimPolicy: Retain --- kind: Deployment apiVersion: extensions/v1beta1 metadata: name: alicloud-nas-controller namespace: kube-system spec: replicas: 1 strategy: type: Recreate template: metadata: labels: app: alicloud-nas-controller spec: tolerations: - effect: NoSchedule operator: Exists key: node-role.kubernetes.io/master - effect: NoSchedule operator: Exists key: node.cloudprovider.kubernetes.io/uninitialized nodeSelector: node-role.kubernetes.io/master: "" serviceAccount: admin containers: - name: alicloud-nas-controller image: registry.cn-hangzhou.aliyuncs.com/acs/alicloud-nas-controller:v3.1.0-k8s1.11 volumeMounts: - mountPath: /persistentvolumes name: nfs-client-root env: - name: PROVISIONER_NAME value: alicloud/nas - name: NFS_SERVER value: 0cd8b4a576-mmi32.cn-hangzhou.nas.aliyuncs.com - name: NFS_PATH value: / volumes: - name: nfs-client-root nfs: server: 0cd8b4a576-mmi32.cn-hangzhou.nas.aliyuncs.com path: /
apiVersion: apps/v1beta1 kind: StatefulSet metadata: name: web spec: serviceName: "nginx" replicas: 2 template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:alpine volumeMounts: - mountPath: "/data" name: html volumeClaimTemplates: - metadata: name: html spec: accessModes: - ReadWriteOnce storageClassName: alicloud-nas resources: requests: storage: 2Gi
# kubectl get pv NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE pvc-945ca15d-e0ab-11e8-9d2f-00163e145c08 2Gi RWO Retain Bound default/html-web-0 alicloud-nas-retain 13m pvc-9a162bb2-e0ab-11e8-9d2f-00163e145c08 2Gi RWO Retain Bound
到此,關于“如何使用NAS動態(tài)存儲卷創(chuàng)建有狀態(tài)應用”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續(xù)學習更多相關知識,請繼續(xù)關注億速云網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。