Stay organized with collections
Save and categorize content based on your preferences.
This page describes how to use ProtectedApplication resources to customize the behavior of backup and restores in Google Distributed Cloud (GDC) air-gapped.
The 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:
You restrict the backup and restore scope granularity to the namespace level.
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.
ProtectedApplication resources are optional Kubernetes namespace resources
used to customize the backup and restore of individual stateful applications.
The ProtectedApplication resource defines which Kubernetes resources belong to
an application instance. You can manually set up a specialized orchestration
using the kubectl command to create a backup and restore of those applications in the following
scenarios:
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.
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.
Before you begin
To use ProtectedApplication resources, you must have the following:
You must define the ProtectedApplication resource before creating a backup plan. For more information, see Plan a set of backups.
The necessary identity and access role:
For Platform Administrator (PA) users:
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.
For Application Operator (AO) users:
Backup Creator: creates manual backups and restores. Ask your Project IAM Admin to grant you the Backup Creator (backup-creator) role.
Here is an example of a Deployment specification with a ProtectedApplication resource that backs up
all of the resources associated with the application during backup, and restores
all resources during the restore:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-29 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)."]]