Kubernetes 叢集對 NetApp Disaster Recovery 的需求
在為 Kubernetes 設定 NetApp Disaster Recovery 之前,請先準備好每個 Kubernetes 叢集。保護通常適用於來源叢集和分隔的目的地叢集,因此請在叢集對中的每個叢集上完成這些程序。
先決條件
在開始之前,請確保您的 Kubernetes 叢集和 ONTAP 叢集已完成設定。
Kubernetes 叢集
對於每個 Kubernetes 叢集,請確保:
-
您擁有每個 Kubernetes 叢集的管理員 `kubectl`存取權。
-
您可以在執行安裝指令的地方使用 Helm 3。
ONTAP 需求
對於每個 ONTAP 叢集,請確保您已設定下列資源:
-
管理 LIF:供 Trident 用於管理 API 存取。
-
資料(NFS)LIF:用於 Volume 的 NFS 流量。
-
SVM 名稱:託管 Volume 的儲存設備虛擬機器。
-
憑證:Trident 使用的帳戶,通常 `admin`或 SVM 範圍的帳戶。
-
工作節點必須能夠存取 ONTAP 管理和資料 LIF。
-
如果使用
autoExportPolicy與 CIDR 限制,請包含您的節點子網路。
安裝 NetApp Trident CSI
如果您已經安裝了 Trident,請使用指令驗證安裝
kubectl get pods -n trident。如果安裝成功,您會在幾分鐘後看到 Trident 控制器、節點 Pod(DaemonSet),而 operator 的狀態為 `Running`狀態。
配置 ONTAP 後端和 Trident StorageClass
建立 Kubernetes Secret
在命名空間中建立 Kubernetes Secret:
+
kubectl create secret generic trident-ontap-secret -n <namespace> \
--from-literal=username=<adminOrOtherUsername> \
--from-literal=password='<YOUR_ONTAP_PASSWORD>'
如需詳細資訊,請參閱"在命名空間中建立 Kubernetes Secret"。
建立 TridentBackendConfig
套用指向您的 SVM 的連結:https://docs.netapp.com/us-en/trident/trident-use/backend-kubectl.html#step-2-create-the-tridentbackendconfig-cr[TridentBackendConfig。例如:
apiVersion: trident.netapp.io/v1
kind: TridentBackendConfig
metadata:
name: <name>
namespace: <trident>
spec:
version: 1
backendName: <name>
storageDriverName: <driverName>
managementLIF: <MANAGEMENT_LIF_IP>
dataLIF: <DATA_LIF_IP>
svm: <SVM_NAME>
autoExportPolicy: true
autoExportCIDRs:
- 0.0.0.0/0
credentials:
name: trident-ontap-secret
您可以使用命令 `kubectl get TridentBackendConfig -n trident`驗證組態。如果組態成功、 `phase`輸出應顯示為 Bound 、而 `status`應顯示為 Success 。如果狀態為 Failed 、請檢閱步驟以"取得更多詳細資料"解決任何問題、例如不正確的認證資料或網路連線能力。
設定儲存類別
"建立儲存類別物件"。使用配置器 csi.trident.netapp.io。例如:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: <name>
provisioner: csi.trident.netapp.io
parameters:
backendType: "<type>"
storagePools: "<pool>:.*"
reclaimPolicy: Delete
volumeBindingMode: Immediate
allowVolumeExpansion: true
您可以選擇將某個儲存類別標記為叢集預設儲存類別。每個叢集只能指定一個預設儲存類別。
kubectl patch storageclass ontap-backend \
-p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
Trident Protect 複製的應用程式 PVC 必須使用透過 Trident 提供的儲存空間(此 StorageClass 或您使用正確的 storagePools / 選擇器定義的其他儲存)。
要讓 Trident Protect 能夠複製您的應用程式資料,應用程式必須使用來自 Trident 管理的 ONTAP 磁碟區的儲存。您可以使用此儲存類別或其他儲存類別,但必須將其設定為透過 Trident 使用 ONTAP 後端。
配置磁碟區群組快照自訂資源定義(CRD)
安裝 "快照 CRD 和快照控制器"。這些安裝是 Trident Protect 中 Volume 快照的必要條件。
使用以下命令驗證自訂資源定義:
kubectl get crd volumesnapshots.snapshot.storage.k8s.io
kubectl get crd volumesnapshotcontents.snapshot.storage.k8s.io
kubectl get crd volumesnapshotclasses.snapshot.storage.k8s.io
設定磁碟區群組快照
kubectl patch volumesnapshotclasses.snapshot.storage.k8s.io trident-snapshotclass \
-p '{"metadata": {"annotations":{"snapshot.storage.kubernetes.io/is-default-class":"true"}}}' \
--type=merge
您可以選擇將磁碟區快照類別指定為預設類別。如果您需要將孤立的 Kubernetes 快照物件保留在 ONTAP 上的快照,請使用 deletionPolicy: Retain。
驗證摘要
| 檢查 | 命令 | 預期輸出 |
|---|---|---|
Trident 正在執行 |
|
Trident 運作正常 |
後端運作正常 |
|
綁定/成功 |
儲存設備已公開 |
|
輸出包括您的 Trident 類別 |
Snapshot API |
|
CRD 存在;列出 Trident 驅動程式 |
驗證所有資源狀態後,使用 Trident StorageClass 部署"移轉"您的工作負載。當您"將 Kubernetes 叢集新增至站台"時,Disaster Recovery 會提供在叢集上安裝 Trident Protect 並將其註冊到 Disaster Recovery 環境的說明。
請參閱安裝 Trident Protect 的說明。
-
建立 Trident 保護命名空間:
kubectl create namespace trident-protect -
使用用戶端 ID 和用戶端密碼建立 Kubernetes 密碼,以建立 OCCM 驗證認證。
kubectl create secret generic occmauthcreds --namespace=trident-protect --from-literal=client_id=<clientID> --from-literal=client_secret=<clientSecret> -
新增或更新 helm 儲存庫:
helm repo add --force-update netapp-trident-protect https://netapp.github.io/trident-protect-helm-chart -
安裝或升級 Trident Protect 和 Trident Protect Connector:
helm upgrade --install trident-protect netapp-trident-protect/trident-protect-console \
--version 100.2605.0-console --namespace trident-protect --set clusterName=<clusterName> --set trident-protect.cbs.accountID=<accountID> --set trident-protect.cbs.agentID=<agentID> --set trident-protect.cbs.proxySecretName=occmauthcreds --set trident-protect.cbs.proxyHostIP=<IPaddress>