展開Volume
Astra Trident可讓Kubernetes使用者在建立磁碟區之後擴充磁碟區。尋找擴充iSCSI和NFS磁碟區所需組態的相關資訊。
展開iSCSI Volume
您可以使用「SCSI資源配置程式」來擴充iSCSI持續磁碟區(PV)。
iSCSI Volume 擴充受、、 solidfire-san`驅動程式支援 `ontap-san 、 `ontap-san-economy`需要 Kubernetes 1.16 及更新版本。
|
步驟1:設定StorageClass以支援Volume擴充
編輯 StorageClass 定義以將欄位設定 allowVolumeExpansion`為 `true
。
cat storageclass-ontapsan.yaml --- apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: ontap-san provisioner: csi.trident.netapp.io parameters: backendType: "ontap-san" allowVolumeExpansion: True
對於已存在的 StorageClass 、請編輯以加入 `allowVolumeExpansion`參數。
步驟2:使用您建立的StorageClass建立一個永久虛擬儲存設備
編輯 PVC 定義並更新、 `spec.resources.requests.storage`以反映新的所需尺寸、該尺寸必須大於原始尺寸。
cat pvc-ontapsan.yaml kind: PersistentVolumeClaim apiVersion: v1 metadata: name: san-pvc spec: accessModes: - ReadWriteOnce resources: requests: storage: 1Gi storageClassName: ontap-san
Astra Trident會建立持續磁碟區(PV)、並將其與此持續磁碟區宣告(PVc)建立關聯。
kubectl get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE san-pvc Bound pvc-8a814d62-bd58-4253-b0d1-82f2885db671 1Gi RWO ontap-san 8s kubectl get pv NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE pvc-8a814d62-bd58-4253-b0d1-82f2885db671 1Gi RWO Delete Bound default/san-pvc ontap-san 10s
步驟3:定義一個連接至PVc的Pod
將 PV 附加至 Pod 、以便調整大小。調整iSCSI PV的大小有兩種情況:
-
如果PV附加至Pod、Astra Trident會在儲存後端擴充磁碟區、重新掃描裝置、並重新調整檔案系統的大小。
-
嘗試調整未附加PV的大小時、Astra Trident會在儲存後端上擴充磁碟區。在將永久虛擬磁碟綁定至Pod之後、Trident會重新掃描裝置並重新調整檔案系統的大小。然後、Kubernetes會在擴充作業成功完成後、更新PVc大小。
在此範例中,會建立使用的 Pod san-pvc
。
kubectl get pod NAME READY STATUS RESTARTS AGE ubuntu-pod 1/1 Running 0 65s kubectl describe pvc san-pvc Name: san-pvc Namespace: default StorageClass: ontap-san Status: Bound Volume: pvc-8a814d62-bd58-4253-b0d1-82f2885db671 Labels: <none> Annotations: pv.kubernetes.io/bind-completed: yes pv.kubernetes.io/bound-by-controller: yes volume.beta.kubernetes.io/storage-provisioner: csi.trident.netapp.io Finalizers: [kubernetes.io/pvc-protection] Capacity: 1Gi Access Modes: RWO VolumeMode: Filesystem Mounted By: ubuntu-pod
步驟 4 :展開 PV
若要調整從 1Gi 建立到 2Gi 的 PV 大小、請編輯 PVC 定義並將更新 `spec.resources.requests.storage`為 2Gi 。
kubectl edit pvc san-pvc # Please edit the object below. Lines beginning with a '#' will be ignored, # and an empty file will abort the edit. If an error occurs while saving this file will be # reopened with the relevant failures. # apiVersion: v1 kind: PersistentVolumeClaim metadata: annotations: pv.kubernetes.io/bind-completed: "yes" pv.kubernetes.io/bound-by-controller: "yes" volume.beta.kubernetes.io/storage-provisioner: csi.trident.netapp.io creationTimestamp: "2019-10-10T17:32:29Z" finalizers: - kubernetes.io/pvc-protection name: san-pvc namespace: default resourceVersion: "16609" selfLink: /api/v1/namespaces/default/persistentvolumeclaims/san-pvc uid: 8a814d62-bd58-4253-b0d1-82f2885db671 spec: accessModes: - ReadWriteOnce resources: requests: storage: 2Gi ...
步驟 5 :驗證擴充
您可以檢查PVc、PV和Astra Trident Volume的大小、以正確驗證擴充作業:
kubectl get pvc san-pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE san-pvc Bound pvc-8a814d62-bd58-4253-b0d1-82f2885db671 2Gi RWO ontap-san 11m kubectl get pv NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE pvc-8a814d62-bd58-4253-b0d1-82f2885db671 2Gi RWO Delete Bound default/san-pvc ontap-san 12m tridentctl get volumes -n trident +------------------------------------------+---------+---------------+----------+--------------------------------------+--------+---------+ | NAME | SIZE | STORAGE CLASS | PROTOCOL | BACKEND UUID | STATE | MANAGED | +------------------------------------------+---------+---------------+----------+--------------------------------------+--------+---------+ | pvc-8a814d62-bd58-4253-b0d1-82f2885db671 | 2.0 GiB | ontap-san | block | a9b7bfff-0505-4e31-b6c5-59f492e02d33 | online | true | +------------------------------------------+---------+---------------+----------+--------------------------------------+--------+---------+
展開NFS Volume
Astra Trident 支援在、、 ontap-nas-economy
、 ontap-nas-flexgroup
gcp-cvs`和 `azure-netapp-files`後端上佈建的 NFS PV 的 Volume 擴充 `ontap-nas
。
步驟1:設定StorageClass以支援Volume擴充
若要調整 NFS PV 的大小、管理員必須先將欄位設定為 true
、以設定儲存類別以允許擴充磁碟區 allowVolumeExpansion
:
cat storageclass-ontapnas.yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: ontapnas provisioner: csi.trident.netapp.io parameters: backendType: ontap-nas allowVolumeExpansion: true
如果您已經建立了沒有此選項的儲存類別、只要使用編輯現有的儲存類別、即可進行 kubectl edit storageclass
Volume 擴充。
步驟2:使用您建立的StorageClass建立一個永久虛擬儲存設備
cat pvc-ontapnas.yaml kind: PersistentVolumeClaim apiVersion: v1 metadata: name: ontapnas20mb spec: accessModes: - ReadWriteOnce resources: requests: storage: 20Mi storageClassName: ontapnas
Astra Trident應為此PVC建立20MiB NFS PV:
kubectl get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE ontapnas20mb Bound pvc-08f3d561-b199-11e9-8d9f-5254004dfdb7 20Mi RWO ontapnas 9s kubectl get pv pvc-08f3d561-b199-11e9-8d9f-5254004dfdb7 NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE pvc-08f3d561-b199-11e9-8d9f-5254004dfdb7 20Mi RWO Delete Bound default/ontapnas20mb ontapnas 2m42s
步驟 3 :展開 PV
若要將新建立的 20MiB PV 調整為 1GiB 、請編輯 PVC 並設定 `spec.resources.requests.storage`為 1GiB :
kubectl edit pvc ontapnas20mb # Please edit the object below. Lines beginning with a '#' will be ignored, # and an empty file will abort the edit. If an error occurs while saving this file will be # reopened with the relevant failures. # apiVersion: v1 kind: PersistentVolumeClaim metadata: annotations: pv.kubernetes.io/bind-completed: "yes" pv.kubernetes.io/bound-by-controller: "yes" volume.beta.kubernetes.io/storage-provisioner: csi.trident.netapp.io creationTimestamp: 2018-08-21T18:26:44Z finalizers: - kubernetes.io/pvc-protection name: ontapnas20mb namespace: default resourceVersion: "1958015" selfLink: /api/v1/namespaces/default/persistentvolumeclaims/ontapnas20mb uid: c1bd7fa5-a56f-11e8-b8d7-fa163e59eaab spec: accessModes: - ReadWriteOnce resources: requests: storage: 1Gi ...
步驟 4 :驗證擴充
您可以檢查PVc、PV和Astra Trident Volume的大小、以正確驗證調整大小:
kubectl get pvc ontapnas20mb NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE ontapnas20mb Bound pvc-08f3d561-b199-11e9-8d9f-5254004dfdb7 1Gi RWO ontapnas 4m44s kubectl get pv pvc-08f3d561-b199-11e9-8d9f-5254004dfdb7 NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE pvc-08f3d561-b199-11e9-8d9f-5254004dfdb7 1Gi RWO Delete Bound default/ontapnas20mb ontapnas 5m35s tridentctl get volume pvc-08f3d561-b199-11e9-8d9f-5254004dfdb7 -n trident +------------------------------------------+---------+---------------+----------+--------------------------------------+--------+---------+ | NAME | SIZE | STORAGE CLASS | PROTOCOL | BACKEND UUID | STATE | MANAGED | +------------------------------------------+---------+---------------+----------+--------------------------------------+--------+---------+ | pvc-08f3d561-b199-11e9-8d9f-5254004dfdb7 | 1.0 GiB | ontapnas | file | c5a6f6a4-b052-423b-80d4-8fb491a14a22 | online | true | +------------------------------------------+---------+---------------+----------+--------------------------------------+--------+---------+