Kubernetes è stato progettato per l'estensibilità. Puoi aggiungere nuove API, come le API Backup e GKE Backup Agent, a un cluster Kubernetes. Queste API sono conformi a un modello di API uniforme, il Kubernetes Resource Model (KRM).
Queste API utilizzano risorse personalizzate Kubernetes e si basano su KRM. Le API vengono utilizzate per gestire il ciclo di vita dei backup e per creare repository, criteri e piani di backup.
Endpoint di servizio
Il seguente URL è l'endpoint API per l'API Backup KRM:
https://MANAGEMENT_API_SERVER_ENDPOINT/apis/backup.gdc.goog/v1
Il seguente URL è l'endpoint API per l'API GKE Backup Agent:
https://MANAGEMENT_API_SERVER_ENDPOINT/apis/gkebackup.gke.io/v1
Sostituisci MANAGEMENT_API_SERVER_ENDPOINT
con l'endpoint del server
dell'API Management.
Documento di rilevamento
Utilizza il comando kubectl proxy --port=8001
per aprire un proxy al server API sulla
tua macchina locale. Da qui, puoi accedere al documento di rilevamento a uno dei seguenti URL:
http://127.0.0.1:8001/apis/backup.gdc.goog/v1
http://127.0.0.1:8001/apis/gkebackup.gke.io/v1
Risorsa ClusterBackupPlan
di esempio
Ecco un esempio di risorsa 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
Risorsa ProtectedApplication
di esempio
Ecco un esempio di risorsa 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
Risorsa ClusterBackupRepository
di esempio
Ecco un esempio di risorsa 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"