Ringkasan Backup API

Kubernetes dirancang untuk ekstensibilitas. Anda dapat menambahkan API baru seperti API Pencadangan dan Agen Pencadangan GKE ke cluster Kubernetes. API ini sesuai dengan model API yang seragam, yaitu Model Resource Kubernetes (KRM).

API ini menggunakan resource kustom Kubernetes dan mengandalkan KRM. API ini digunakan untuk mengelola siklus proses pencadangan, dan untuk membuat repositori, kebijakan, dan rencana pencadangan.

Endpoint Service

URL berikut adalah endpoint API untuk Backup KRM API:

https://MANAGEMENT_API_SERVER_ENDPOINT/apis/backup.gdc.goog/v1

URL berikut adalah endpoint API untuk GKE Backup Agent API:

https://MANAGEMENT_API_SERVER_ENDPOINT/apis/gkebackup.gke.io/v1

Ganti MANAGEMENT_API_SERVER_ENDPOINT dengan endpoint server Management API.

Dokumen Discovery

Gunakan perintah kubectl proxy --port=8001 untuk membuka proxy ke server API di mesin lokal Anda. Dari sana, Anda dapat mengakses dokumen penemuan di salah satu URL berikut:

  • http://127.0.0.1:8001/apis/backup.gdc.goog/v1
  • http://127.0.0.1:8001/apis/gkebackup.gke.io/v1

Contoh resource ClusterBackupPlan

Berikut adalah contoh resource 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

Contoh resource ProtectedApplication

Berikut adalah contoh resource 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

Contoh resource ClusterBackupRepository

Berikut adalah contoh resource 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"