Kubernetes は拡張性を考慮して設計されています。Backup API や GKE Backup Agent API などの新しい API を Kubernetes クラスタに追加できます。これらの API は、Kubernetes Resource Model(KRM)という統一された API モデルに準拠しています。
これらの API は Kubernetes カスタム リソースを使用し、KRM に依存します。API は、バックアップのライフサイクルを管理し、バックアップ リポジトリ、ポリシー、プランを作成するために使用されます。
Service エンドポイント
次の URL は、Backup KRM API の API エンドポイントです。
https://MANAGEMENT_API_SERVER_ENDPOINT/apis/backup.gdc.goog/v1
次の URL は、GKE Backup Agent API の API エンドポイントです。
https://MANAGEMENT_API_SERVER_ENDPOINT/apis/gkebackup.gke.io/v1
MANAGEMENT_API_SERVER_ENDPOINT
は、Management API サーバーのエンドポイントに置き換えます。
ディスカバリ ドキュメント
kubectl proxy --port=8001
コマンドを使用して、ローカルマシンで API サーバーへのプロキシを開きます。次のいずれかの URL でディスカバリ ドキュメントにアクセスできます。
http://127.0.0.1:8001/apis/backup.gdc.goog/v1
http://127.0.0.1:8001/apis/gkebackup.gke.io/v1
ClusterBackupPlan
リソースの例
ClusterBackupPlan
リソースの例を次に示します。
apiVersion: backup.gdc.goog/v1
kind: ClusterBackupPlan
metadata:
name: backup-plan
namespace: project-namespace
spec:
targetCluster:
targetClusterType: UserCluster
targetClusterName:
kind: "Cluster"
name: "cluster-sample"
backupSchedule:
cronSchedule: "*/30 * * * *"
paused: false
clusterBackupConfig:
backupScope:
selectedNamespaces:
namespaces: ["nginx"]
clusterBackupRepositoryName: backup-repository
retentionPolicy:
backupDeleteLockDays: 10
backupRetainDays: 10
ProtectedApplication
リソースの例
ProtectedApplication
リソースの例を次に示します。
apiVersion: gkebackup.gke.io/v1
kind: ProtectedApplication
metadata:
name: protected-application-test
namespace: applications
spec:
applicationName: protectedApplication
resourceSelection:
type: Selector
selector:
matchLabels:
app: protected
components:
- name: protect-application-deployment
resourceKind: Deployment
resourceNames:
- protected-application-deployment
strategy:
type: BackupAllRestoreAll
ClusterBackupRepository
リソースの例
ClusterBackupRepository
リソースの例を次に示します。
apiVersion: backup.gdc.goog/v1
kind: ClusterBackupRepository
metadata:
name: user-1-user
namespace: user-1-user-cluster
spec:
secretReference:
namespace: "object-storage-secret-ns"
name: "object-storage-secret"
endpoint: "https://objectstorage.google.gdch.test"
type: "S3"
s3Options:
bucket: "fully-qualified-bucket-name"
region: "us-east-1"
forcePathStyle: true
importPolicy: "ReadWrite"