Menyesuaikan pencadangan dan pemulihan untuk aplikasi
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menjelaskan cara menggunakan resource ProtectedApplication untuk menyesuaikan perilaku pencadangan dan pemulihan di Google Distributed Cloud (GDC) yang terisolasi.
Langkah-langkah yang dijelaskan di halaman ini bersifat opsional dan tidak diperlukan agar Anda berhasil mengonfigurasi pencadangan dan pemulihan untuk beban kerja Anda. Resource ProtectedApplication adalah resource Kubernetes opsional dalam namespace yang menyesuaikan pencadangan dan pemulihan aplikasi stateful individual. Tanpa resource ProtectedApplication, batasan berikut berlaku:
Anda membatasi perincian cakupan pencadangan dan pemulihan ke tingkat namespace.
Tidak ada operasi flush dan quiesce yang terjadi pada workload selama eksekusi pencadangan.Hal ini dapat menyebabkan mesin virtual dengan beberapa disk tidak konsisten setelah pemulihan.
Resource ProtectedApplication adalah resource namespace Kubernetes opsional yang digunakan untuk menyesuaikan pencadangan dan pemulihan aplikasi stateful individual.
Resource ProtectedApplication menentukan resource Kubernetes mana yang termasuk dalam
instance aplikasi. Anda dapat menyiapkan orkestrasi khusus secara manual menggunakan perintah kubectl untuk membuat cadangan dan memulihkan aplikasi tersebut dalam skenario berikut:
Untuk mengidentifikasi sekumpulan resource dalam namespace yang dapat dicadangkan atau dipulihkan secara terpisah dari resource lain dalam namespace tersebut. ProtectedApplication adalah entitas namespace yang paling terperinci yang dapat Anda identifikasi untuk cakupan pencadangan atau pemulihan.
Untuk menyediakan orkestrasi pencadangan khusus setiap kali
ProtectedApplication berada dalam cakupan pencadangan. Khususnya, jika
ProtectedApplication berisi resource PersistentVolumeClaim (PVC)
baik secara langsung maupun melalui template dari StatefulSet, Anda dapat
menjalankan hook sebelum dan setelah mencadangkan volume. Hook adalah perintah yang berjalan di container aplikasi. Hook ini sering digunakan untuk operasi flush, quiesce, atau unquiesce, dan menyediakan pencadangan yang konsisten dengan aplikasi.
Sebelum memulai
Untuk menggunakan resource ProtectedApplication, Anda harus memiliki:
Anda harus menentukan resource ProtectedApplication sebelum membuat rencana pencadangan. Untuk mengetahui informasi selengkapnya, lihat Merencanakan serangkaian pencadangan.
Peran akses dan identitas yang diperlukan:
Untuk pengguna Administrator Platform (PA):
Admin Pencadangan Cluster Pengguna: mengelola resource pencadangan seperti rencana pencadangan dan pemulihan di cluster pengguna. Minta Admin IAM Organisasi Anda untuk memberi Anda peran User Cluster Backup Admin (user-cluster-backup-admin).
Untuk pengguna Operator Aplikasi (AO):
Pembuat Cadangan: membuat cadangan dan pemulihan manual. Minta Admin IAM Project Anda untuk memberi Anda peran Pembuat Cadangan (backup-creator).
Untuk mengetahui informasi selengkapnya, lihat Definisi peran.
Men-deploy resource aplikasi yang dilindungi
Berikut adalah contoh spesifikasi Deployment dengan resource ProtectedApplication yang mencadangkan
semua resource yang terkait dengan aplikasi selama pencadangan, dan memulihkan
semua resource selama pemulihan:
Menentukan cara mengidentifikasi resource yang termasuk dalam aplikasi
yang dilindungi:
type: Tentukan salah satu dari:
ApplicationName: Mencadangkan aplikasi sig-apps
dalam namespace yang sama.
Selector: Mencadangkan resource yang cocok dengan
pemilih tertentu dalam namespace yang sama.
applicationName: Jika type adalah
ApplicationName, menentukan nama Aplikasi sig-apps
dalam namespace yang sama.
selector: Jika type adalah
Selector, menentukan pemilih label
untuk memilih resource dalam namespace yang sama.
components
Daftar komponen untuk aplikasi yang dilindungi, seperti deployment atau set stateful:
name: Nama unik komponen.
resourceKind: Pilih antara Deployment atau
StatefulSet.
resourceNames: Daftar nama yang mengidentifikasi
resourceKind di namespace.
strategy: Detail tambahan tentang cara mencadangkan atau memulihkan komponen ini. Untuk mengetahui informasi selengkapnya, lihat Strategi aplikasi yang dilindungi.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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)."]]