使用Trident Protect AppVault 物件來管理儲存桶。
Trident Protect 的儲存桶自訂資源 (CR) 稱為 AppVault。AppVault 物件是儲存桶的聲明性 Kubernetes 工作流程表示。AppVault CR 包含儲存桶在保護作業(例如備份、快照、復原作業和SnapMirror複製)中所使用的必要配置。只有管理員才能建立應用保險庫。
在對應用程式執行資料保護操作時,您需要手動或使用命令列建立 AppVault CR,並且 AppVault CR 需要位於安裝了Trident Protect 的叢集上。 AppVault CR 是針對您的環境的;您可以參考此頁面上的範例來建立 AppVault CR。
設定 AppVault 驗證和密碼
在建立 AppVault CR 之前,您必須確保 AppVault 和您選擇的資料移動器可以向提供者和任何相關資源進行驗證。
資料移動器儲存庫密碼
當您使用 CR 或Trident Protect CLI 外掛程式建立 AppVault 物件時,您可以選擇性地指示Trident Protect 使用包含 Restic 和 Kopia 儲存庫加密自訂密碼的 Kubernetes secret。如果您不指定金鑰, Trident Protect 將使用預設密碼。
-
手動建立 AppVault CR 時,使用 spec.dataMoverPasswordSecretRef 欄位指定金鑰。
-
使用Trident Protect CLI 建立 AppVault 物件時,請使用 `--data-mover-password-secret-ref`用於指定密鑰的參數。
建立資料移動者儲存庫密碼機密
請參考以下範例建立密碼密鑰。建立 AppVault 物件時,您可以指示Trident Protect 使用此金鑰向資料移動器儲存庫進行驗證。
|
|
視您使用的資料移動器而定,您只需要加入該資料移動器的對應密碼。例如,如果您使用 Restic ,而且不打算在未來使用 Kopia ,則在建立機密時,只能包含 Restic 密碼。 |
---
apiVersion: v1
data:
KOPIA_PASSWORD: <base64-encoded-password>
RESTIC_PASSWORD: <base64-encoded-password>
kind: Secret
metadata:
name: my-optional-data-mover-secret
namespace: trident-protect
type: Opaque
kubectl create secret generic my-optional-data-mover-secret \
--from-literal=KOPIA_PASSWORD=<plain-text-password> \
--from-literal=RESTIC_PASSWORD=<plain-text-password> \
-n trident-protect
S3 相容於儲存 IAM 權限
當您存取與 S3 相容的儲存空間(例如 Amazon S3、通用 S3)時, "StorageGRID S3" , 或者 "ONTAP S3"使用Trident Protect 時,您需要確保提供的使用者憑證具有存取儲存桶的必要權限。以下是授予使用Trident Protect 進行存取所需的最低權限的政策範例。您可以將此策略套用至管理 S3 相容儲存桶策略的使用者。
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:ListBucket",
"s3:DeleteObject"
],
"Resource": "*"
}
]
}
有關 Amazon S3 策略的更多信息,請參閱 "Amazon S3 文檔" 。
適用於雲端供應商的 AppVault 主要世代範例
定義 AppVault CR 時,您需要加入認證,才能存取供應商託管的資源。您產生認證金鑰的方式會因供應商而異。以下是多個提供者的命令列金鑰產生範例。您可以使用下列範例來建立每個雲端供應商認證的金鑰。
kubectl create secret generic <secret-name> \
--from-file=credentials=<mycreds-file.json> \
-n trident-protect
kubectl create secret generic <secret-name> \
--from-literal=accessKeyID=<objectstorage-accesskey> \
--from-literal=secretAccessKey=<amazon-s3-trident-protect-src-bucket-secret> \
-n trident-protect
kubectl create secret generic <secret-name> \
--from-literal=accountKey=<secret-name> \
-n trident-protect
kubectl create secret generic <secret-name> \
--from-literal=accessKeyID=<objectstorage-accesskey> \
--from-literal=secretAccessKey=<generic-s3-trident-protect-src-bucket-secret> \
-n trident-protect
kubectl create secret generic <secret-name> \
--from-literal=accessKeyID=<objectstorage-accesskey> \
--from-literal=secretAccessKey=<ontap-s3-trident-protect-src-bucket-secret> \
-n trident-protect
kubectl create secret generic <secret-name> \
--from-literal=accessKeyID=<objectstorage-accesskey> \
--from-literal=secretAccessKey=<storagegrid-s3-trident-protect-src-bucket-secret> \
-n trident-protect
AppVault 建立範例
以下是每個提供者的 AppVault 定義範例。
AppVault CR 範例
您可以使用下列 CR 範例,為每個雲端供應商建立 AppVault 物件。
|
|
|
apiVersion: protect.trident.netapp.io/v1
kind: AppVault
metadata:
name: gcp-trident-protect-src-bucket
namespace: trident-protect
spec:
dataMoverPasswordSecretRef: my-optional-data-mover-secret
providerType: GCP
providerConfig:
gcp:
bucketName: trident-protect-src-bucket
projectID: project-id
providerCredentials:
credentials:
valueFromSecret:
key: credentials
name: gcp-trident-protect-src-bucket-secret
---
apiVersion: protect.trident.netapp.io/v1
kind: AppVault
metadata:
name: amazon-s3-trident-protect-src-bucket
namespace: trident-protect
spec:
dataMoverPasswordSecretRef: my-optional-data-mover-secret
providerType: AWS
providerConfig:
s3:
bucketName: trident-protect-src-bucket
endpoint: s3.example.com
proxyURL: http://10.1.1.1:3128
providerCredentials:
accessKeyID:
valueFromSecret:
key: accessKeyID
name: s3-secret
secretAccessKey:
valueFromSecret:
key: secretAccessKey
name: s3-secret
sessionToken:
valueFromSecret:
key: sessionToken
name: s3-secret
apiVersion: protect.trident.netapp.io/v1
kind: AppVault
metadata:
name: azure-trident-protect-src-bucket
namespace: trident-protect
spec:
dataMoverPasswordSecretRef: my-optional-data-mover-secret
providerType: Azure
providerConfig:
azure:
accountName: account-name
bucketName: trident-protect-src-bucket
providerCredentials:
accountKey:
valueFromSecret:
key: accountKey
name: azure-trident-protect-src-bucket-secret
apiVersion: protect.trident.netapp.io/v1
kind: AppVault
metadata:
name: generic-s3-trident-protect-src-bucket
namespace: trident-protect
spec:
dataMoverPasswordSecretRef: my-optional-data-mover-secret
providerType: GenericS3
providerConfig:
s3:
bucketName: trident-protect-src-bucket
endpoint: s3.example.com
proxyURL: http://10.1.1.1:3128
providerCredentials:
accessKeyID:
valueFromSecret:
key: accessKeyID
name: s3-secret
secretAccessKey:
valueFromSecret:
key: secretAccessKey
name: s3-secret
apiVersion: protect.trident.netapp.io/v1
kind: AppVault
metadata:
name: ontap-s3-trident-protect-src-bucket
namespace: trident-protect
spec:
dataMoverPasswordSecretRef: my-optional-data-mover-secret
providerType: OntapS3
providerConfig:
s3:
bucketName: trident-protect-src-bucket
endpoint: s3.example.com
proxyURL: http://10.1.1.1:3128
providerCredentials:
accessKeyID:
valueFromSecret:
key: accessKeyID
name: s3-secret
secretAccessKey:
valueFromSecret:
key: secretAccessKey
name: s3-secret
apiVersion: protect.trident.netapp.io/v1
kind: AppVault
metadata:
name: storagegrid-s3-trident-protect-src-bucket
namespace: trident-protect
spec:
dataMoverPasswordSecretRef: my-optional-data-mover-secret
providerType: StorageGridS3
providerConfig:
s3:
bucketName: trident-protect-src-bucket
endpoint: s3.example.com
proxyURL: http://10.1.1.1:3128
providerCredentials:
accessKeyID:
valueFromSecret:
key: accessKeyID
name: s3-secret
secretAccessKey:
valueFromSecret:
key: secretAccessKey
name: s3-secret
使用Trident Protect CLI 建立 AppVault 的範例
您可以使用下列 CLI 命令範例,為每個供應商建立 AppVault CRS 。
|
|
|
tridentctl-protect create vault GCP <vault-name> \
--bucket <mybucket> \
--project <my-gcp-project> \
--secret <secret-name>/credentials \
--data-mover-password-secret-ref <my-optional-data-mover-secret> \
-n trident-protect
tridentctl-protect create vault AWS <vault-name> \
--bucket <bucket-name> \
--secret <secret-name> \
--endpoint <s3-endpoint> \
--data-mover-password-secret-ref <my-optional-data-mover-secret> \
-n trident-protect
tridentctl-protect create vault Azure <vault-name> \
--account <account-name> \
--bucket <bucket-name> \
--secret <secret-name> \
--data-mover-password-secret-ref <my-optional-data-mover-secret> \
-n trident-protect
tridentctl-protect create vault GenericS3 <vault-name> \
--bucket <bucket-name> \
--secret <secret-name> \
--endpoint <s3-endpoint> \
--data-mover-password-secret-ref <my-optional-data-mover-secret> \
-n trident-protect
tridentctl-protect create vault OntapS3 <vault-name> \
--bucket <bucket-name> \
--secret <secret-name> \
--endpoint <s3-endpoint> \
--data-mover-password-secret-ref <my-optional-data-mover-secret> \
-n trident-protect
tridentctl-protect create vault StorageGridS3 <vault-name> \
--bucket <bucket-name> \
--secret <secret-name> \
--endpoint <s3-endpoint> \
--data-mover-password-secret-ref <my-optional-data-mover-secret> \
-n trident-protect
檢視 AppVault 資訊
您可以使用Trident Protect CLI 外掛程式查看有關您在叢集上建立的 AppVault 物件的資訊。
-
檢視 AppVault 物件的內容:
tridentctl-protect get appvaultcontent gcp-vault \ --show-resources all \ -n trident-protect-
輸出範例 * :
+-------------+-------+----------+-----------------------------+---------------------------+ | CLUSTER | APP | TYPE | NAME | TIMESTAMP | +-------------+-------+----------+-----------------------------+---------------------------+ | | mysql | snapshot | mysnap | 2024-08-09 21:02:11 (UTC) | | production1 | mysql | snapshot | hourly-e7db6-20240815180300 | 2024-08-15 18:03:06 (UTC) | | production1 | mysql | snapshot | hourly-e7db6-20240815190300 | 2024-08-15 19:03:06 (UTC) | | production1 | mysql | snapshot | hourly-e7db6-20240815200300 | 2024-08-15 20:03:06 (UTC) | | production1 | mysql | backup | hourly-e7db6-20240815180300 | 2024-08-15 18:04:25 (UTC) | | production1 | mysql | backup | hourly-e7db6-20240815190300 | 2024-08-15 19:03:30 (UTC) | | production1 | mysql | backup | hourly-e7db6-20240815200300 | 2024-08-15 20:04:21 (UTC) | | production1 | mysql | backup | mybackup5 | 2024-08-09 22:25:13 (UTC) | | | mysql | backup | mybackup | 2024-08-09 21:02:52 (UTC) | +-------------+-------+----------+-----------------------------+---------------------------+
-
-
(可選)要查看每個資源的 AppVaultPath ,請使用標誌
--show-paths。只有在Trident Protect helm 安裝中指定了叢集名稱時,表格第一列中的叢集名稱才可用。例如:
--set clusterName=production1。
移除 AppVault
您可以隨時移除 AppVault 物件。
|
|
刪除 AppVault 物件之前,請勿移除 finalizers AppVault CR 中的機碼。如果您這麼做,可能會導致 AppVault 貯體中的剩餘資料,以及叢集中的孤立資源。
|
請確定您已刪除要刪除的 AppVault 所使用的所有快照和備份 CRS 。
-
移除 AppVault 物件,以要移除的 AppVault 物件名稱取代
appvault-name:kubectl delete appvault <appvault-name> \ -n trident-protect
-
移除 AppVault 物件,以要移除的 AppVault 物件名稱取代
appvault-name:tridentctl-protect delete appvault <appvault-name> \ -n trident-protect