Sicherung und Wiederherstellung für eine Anwendung anpassen
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Auf dieser Seite wird beschrieben, wie Sie ProtectedApplication-Ressourcen verwenden, um das Verhalten von Sicherungen und Wiederherstellungen in Google Distributed Cloud (GDC) Air-Gapped anzupassen.
Die auf dieser Seite beschriebenen Schritte sind optional und nicht erforderlich, um die Sicherung und Wiederherstellung für Ihre Arbeitslasten zu konfigurieren. ProtectedApplication-Ressourcen sind optionale Kubernetes-Ressourcen in Namespaces, mit denen die Sicherung und Wiederherstellung einzelner zustandsorientierter Anwendungen angepasst werden kann. Ohne ProtectedApplication-Ressourcen gelten die folgenden Einschränkungen:
Sie beschränken die Granularität des Sicherungs- und Wiederherstellungsbereichs auf die Namespace-Ebene.
Während der Sicherung werden keine Flush- und Quiesce-Vorgänge für Arbeitslasten ausgeführt.Dies kann dazu führen, dass virtuelle Maschinen mit mehreren Festplatten nach der Wiederherstellung nicht absturzkonsistent sind.
ProtectedApplication-Ressourcen sind optionale Kubernetes-Namespace-Ressourcen, die zum Anpassen der Sicherung und Wiederherstellung einzelner zustandsorientierter Anwendungen verwendet werden.
Die ProtectedApplication-Ressource definiert, welche Kubernetes-Ressourcen zu einer Anwendungsinstanz gehören. Sie können eine spezielle Orchestrierung manuell einrichten, indem Sie mit dem Befehl kubectl eine Sicherung und Wiederherstellung dieser Anwendungen in den folgenden Szenarien erstellen:
Eine Reihe von Ressourcen in einem Namespace bestimmen, die unabhängig von den anderen Ressourcen in diesem Namespace gesichert oder wiederhergestellt werden können. Ein ProtectedApplication ist die kleinste Namespace-Einheit, die Sie für einen Sicherungs- oder Wiederherstellungsbereich angeben können.
Um eine spezielle Sicherungsorchestrierung bereitzustellen, wenn ProtectedApplication in den Bereich einer Sicherung fällt. Insbesondere wenn die ProtectedApplicationPersistentVolumeClaim-Ressourcen (PersistentVolumeClaim) direkt oder über eine Vorlage aus einem StatefulSet enthält, können Sie Hooks vor und nach dem Sichern der Volumes ausführen. Hooks sind Befehle, die in Anwendungscontainern ausgeführt werden. Diese Hooks werden häufig für Flush-, Quiesce- oder Unquiesce-Vorgänge verwendet und bieten eine anwendungskonsistente Sicherung.
Hinweise
Damit Sie ProtectedApplication-Ressourcen verwenden können, benötigen Sie Folgendes:
Sie müssen die ProtectedApplication-Ressource definieren, bevor Sie einen Sicherungsplan erstellen können. Weitere Informationen finden Sie unter Eine Reihe von Sicherungen planen.
Die erforderliche Identitäts- und Zugriffsrolle:
Für Nutzer mit der Rolle „Plattformadministrator“:
Administrator für Sicherungen von Nutzerclustern: Verwaltet Sicherungsressourcen wie Sicherungs- und Wiederherstellungspläne in Nutzerclustern. Bitten Sie Ihren IAM-Administrator der Organisation, Ihnen die Rolle „User Cluster Backup Admin“ (user-cluster-backup-admin) zuzuweisen.
Für Nutzer mit der Rolle „Application Operator“ (AO):
Backup Creator: Erstellt manuelle Sicherungen und führt Wiederherstellungen durch. Bitten Sie Ihren Projekt-IAM-Administrator, Ihnen die Rolle „Backup Creator“ (backup-creator) zuzuweisen.
Das folgende Beispiel zeigt eine Deployment-Spezifikation mit einer ProtectedApplication-Ressource, die alle Ressourcen sichert, die der Anwendung während der Sicherung zugeordnet wurden, und alle Ressourcen während der Wiederherstellung wiederherstellt:
Definiert, wie Ressourcen identifiziert werden, die zur geschützten Anwendung gehören:
type: Geben Sie eine der folgenden Optionen an:
ApplicationName: Sichert eine sig-apps-Anwendung im selben Namespace.
Selector: Sichert Ressourcen, die einem bestimmten Selektor innerhalb desselben Namespace entsprechen.
applicationName: Wenn type gleich ApplicationName ist, wird der Name der sig-apps-Anwendung im selben Namespace angegeben.
selector: Wenn typeSelector ist, wird der Label-Selektor angegeben, mit dem Ressourcen im selben Namespace ausgewählt werden.
components
Die Liste der Komponenten für die geschützte Anwendung, z. B. Bereitstellungen oder zustandsorientierte Sets:
name: Der eindeutige Name der Komponente.
resourceKind: Wählen Sie zwischen Deployment oder StatefulSet aus.
resourceNames: Die Liste der Namen, die die resourceKind im Namespace identifizieren.
strategy: Zusätzliche Informationen zum Sichern oder Wiederherstellen dieser Komponente. Weitere Informationen finden Sie unter Strategien für geschützte Anwendungen.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003e\u003ccode\u003eProtectedApplication\u003c/code\u003e resources are optional Kubernetes resources used to customize the backup and restore process for individual stateful applications in Google Distributed Cloud (GDC) air-gapped.\u003c/p\u003e\n"],["\u003cp\u003eUsing \u003ccode\u003eProtectedApplication\u003c/code\u003e allows for fine-grained control over backup and restore scope at the application level, enabling independent backup and restore of specific sets of resources within a namespace.\u003c/p\u003e\n"],["\u003cp\u003eThese resources can facilitate specialized backup orchestration, including running hooks for flush and quiesce operations, leading to more application-consistent backups, especially for workloads with \u003ccode\u003ePersistentVolumeClaim\u003c/code\u003e (PVC) resources.\u003c/p\u003e\n"],["\u003cp\u003eTo utilize \u003ccode\u003eProtectedApplication\u003c/code\u003e, it must be defined before the creation of a backup plan, and users must have the necessary identity and access role permissions, such as User Cluster Backup Admin or Backup Creator.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eProtectedApplication\u003c/code\u003e resources use a \u003ccode\u003eresourceSelection\u003c/code\u003e field to identify the application resource, allowing it to use an \u003ccode\u003eApplicationName\u003c/code\u003e or \u003ccode\u003eSelector\u003c/code\u003e, additionally it has a \u003ccode\u003ecomponents\u003c/code\u003e field that allows to customize the backup process.\u003c/p\u003e\n"]]],[],null,["# Customize backup and restore for an application\n\nThis page describes how to use `ProtectedApplication` resources to customize the behavior of backup and restores in Google Distributed Cloud (GDC) air-gapped.\n\nThe steps described on this page are optional and are not required to successfully configure backup and restoration for your workloads. `ProtectedApplication` resources are optional Kubernetes resources in namespaces that customize the backup and restore of individual stateful applications. Without `ProtectedApplication` resources, the following restrictions apply:\n\n- You restrict the backup and restore scope granularity to the namespace level.\n- No flush and quiesce operations occur on workloads during backup execution.This might result in virtual machines with multiple disks not being crash-consistent after restoration.\n\n`ProtectedApplication` resources are optional Kubernetes namespace resources\nused to customize the backup and restore of individual stateful applications.\nThe `ProtectedApplication` resource defines which Kubernetes resources belong to\nan application instance. You can manually set up a specialized orchestration\nusing the `kubectl` command to create a backup and restore of those applications in the following\nscenarios:\n\n- To identify a set of resources in a namespace that might be backed up or restored independently of the other resources in that namespace. A `ProtectedApplication` is the most fine-grained namespace entity that you can identify for a backup or restore scope.\n- To provide specialized backup orchestration whenever the `ProtectedApplication` falls within the scope of a backup. In particular, if the `ProtectedApplication` contains `PersistentVolumeClaim` (PVC) resources either directly or through a template from a `StatefulSet`, you can run *hooks* before and after backing up the volumes. Hooks are commands that run in application containers. These hooks are often used for flush, quiesce, or unquiesce operations, and provide an application-consistent backup.\n\nBefore you begin\n----------------\n\nTo use `ProtectedApplication` resources, you must have the following:\n\n- You must define the `ProtectedApplication` resource before creating a backup plan. For more information, see [Plan a set of backups](/distributed-cloud/hosted/docs/latest/gdch/platform-application/pa-ao-operations/cluster-backup/plan-backups).\n- The necessary identity and access role:\n\n - For Platform Administrator (PA) users:\n - User Cluster Backup Admin: manages backup resources such as backup and restore plans in user clusters. Ask your Organization IAM Admin to grant you the User Cluster Backup Admin (`user-cluster-backup-admin`) role.\n - For Application Operator (AO) users:\n - Backup Creator: creates manual backups and restores. Ask your Project IAM Admin to grant you the Backup Creator (`backup-creator`) role.\n - For more information, see [Role definitions](/distributed-cloud/hosted/docs/latest/gdch/platform/pa-user/iam/role-definitions).\n\nDeploy protected application resources\n--------------------------------------\n\nHere is an example of a `Deployment` specification with a `ProtectedApplication` resource that backs up\nall of the resources associated with the application during backup, and restores\nall resources during the restore: \n\n apiVersion: v1\n kind: Namespace\n metadata:\n name: \"applications\"\n ---\n apiVersion: apps/v1\n kind: Deployment\n metadata:\n name: protected-application-deployment\n namespace: applications\n labels:\n app: protected\n spec:\n selector:\n matchLabels:\n app: nginx\n replicas: 2\n template:\n metadata:\n labels:\n app: nginx\n spec:\n containers:\n - name: nginx\n image: nginx:1.14.2\n ports:\n - containerPort: 80\n ---\n apiVersion: apps/v1\n kind: Deployment\n metadata:\n name: unprotected-application-deployment\n namespace: applications\n labels:\n app: unprotected\n spec:\n selector:\n matchLabels:\n app: nginx\n replicas: 2\n template:\n metadata:\n labels:\n app: nginx\n spec:\n containers:\n - name: nginx\n image: nginx:1.14.2\n ports:\n - containerPort: 80\n ---\n\n apiVersion: gkebackup.gke.io/v1\n kind: ProtectedApplication\n metadata:\n name: protected-application-test\n namespace: applications\n spec:\n applicationName: protectedApplication\n resourceSelection:\n type: Selector\n selector:\n matchLabels:\n app: protected\n components:\n - name: protect-application-deployment\n resourceKind: Deployment\n resourceNames:\n - protected-application-deployment\n strategy:\n type: BackupAllRestoreAll\n\nSpecify the `ProtectedApplication` in the list of\n`selectedApplications` in the `backupScope`. For example: \n\n apiVersion: backup.gdc.goog/v1\n kind: BackupPlan\n metadata:\n name: protected-application-backupplan-test\n namespace: applications\n spec:\n clusterName: \"cluster-sample\"\n backupSchedule:\n cronSchedule: \"*/30 * * * *\"\n paused: true\n backupConfig:\n backupScope:\n selectedApplications:\n namespacedNames:\n - name: protected-application-test\n namespace: applications\n backupRepository: \"backup-repository\"\n retentionPolicy:\n backupDeleteLockDays: 10\n backupRetainDays: 10\n\nThis example includes the following values:\n\nWhat's next\n-----------\n\n- To select a protected application strategy, see [Protected application strategies](/distributed-cloud/hosted/docs/latest/gdch/platform-application/pa-ao-operations/protected-application-strategies)."]]