Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Autopilot
Standard
Halaman ini memberikan ringkasan kebijakan pemulihan data volume. Dokumen ini juga menjelaskan cara mengonfigurasi pengikatan dan penggantian kebijakan pemulihan data volume.
Ringkasan
Kebijakan pemulihan data volume menentukan cara memulihkan data volume dari cadangan.
Anda dapat mengonfigurasinya di tingkat paket pemulihan. Kebijakan ini memiliki opsi kebijakan berikut:
Sediakan volume baru dan pulihkan data volume dari cadangan: Volume
persisten (PV) baru dipulihkan menggunakan data cadangan volume yang
sesuai dalam cadangan.
Gunakan kembali volume yang ada dan berisi data Anda: PV disediakan sebelumnya
menggunakan handle volume PV asli dalam cadangan.
Jangan pulihkan data volume: PV tidak dipulihkan. Pencadangan untuk GKE hanya
memulihkan klaim volume persisten (PVC) yang dipilih dan memprediksi
driver penyimpanan yang sesuai untuk menyediakan PV kosong secara dinamis
atau mengikatnya ke PV kosong yang telah disediakan dan dibuat secara out-of-band.
Untuk mengetahui petunjuk tentang cara membuat rencana pemulihan dengan kebijakan pemulihan data volume,
lihat Membuat rencana pemulihan.
Ada beberapa alasan mengapa Anda mungkin ingin menentukan perilaku pemulihan volume kustom selain kebijakan pemulihan data volume default:
Untuk memulihkan workload dengan lingkungan penyimpanan yang mencakup berbagai jenis volume dengan tingkat dukungan pencadangan data yang bervariasi. Misalnya, workload Anda dapat berisi volume NFS dan volume Persistent Disk.
Untuk menerapkan proses pemulihan yang berbeda ke volume tertentu.
Pencadangan untuk GKE menyediakan dua mekanisme untuk menentukan perilaku pemulihan volume kustom:
Binding khusus jenis volume, yang dapat Anda tentukan sebagai bagian dari rencana pemulihan.
Penggantian khusus volume, yang dapat Anda tentukan sebagai bagian dari pemulihan.
Proses pemilihan kebijakan pemulihan data volume
Selama proses pemulihan, Pencadangan untuk GKE memilih kebijakan pemulihan volume yang sesuai untuk setiap PersistentVolumeClaim (PVC) menggunakan urutan berikut:
Sebelum aturan transformasi diterapkan, setiap PVC yang akan dipulihkan akan melalui proses pemilihan dan menerapkan kebijakan dalam cakupan pertama.
Jika PVC tidak terikat ke PersistentVolume (PV) yang dicadangkan, hanya konfigurasi PVC yang dipulihkan. Hal ini tidak mencakup data apa pun.
Jika PVC disertakan dalam penggantian kebijakan pemulihan data volume, kebijakan penggantian akan lebih diprioritaskan.
Jika jenis volume PVC disertakan dalam pengikatan kebijakan pemulihan data volume,
kebijakan pengikatan diterapkan.
Jika tidak ada kondisi sebelumnya yang cocok, PVC akan menggunakan kebijakan pemulihan data volume default.
Binding kebijakan pemulihan data volume
Binding kebijakan pemulihan data volume memungkinkan Anda memulihkan data volume dengan kebijakan untuk jenis volume tertentu. Kebijakan ini lebih diprioritaskan daripada
kebijakan pemulihan volume default. Binding kebijakan pemulihan data volume hanya didukung untuk Persistent Disk Compute Engine.
gcloud
Tambahkan pengikatan kebijakan pemulihan data volume ke rencana pemulihan yang ada:
VOLUME_TYPE=POLICY: mengikat jenis volume yang didukung ke
kebijakan pemulihan data volume. Misalnya, gce-persistent-disk=restore-volume-data-from-backup
membuat binding yang menghasilkan volume Persistent Disk dipulihkan menggunakan
kebijakan Pulihkan data volume dari cadangan.
Konsol
Gunakan petunjuk berikut untuk menambahkan binding ke rencana pemulihan yang ada di konsol Google Cloud :
Di konsol Google Cloud , buka halaman Google Kubernetes Engine.
Di bagian Restore configuration, klik Edit di samping Cakupan.
Di bagian Define policy override for specific volume types, klik kotak centang GCE Persistent Disk.
Dari daftar Kebijakan pemulihan data volume, pilih jenis kebijakan pemulihan yang ingin Anda gunakan untuk Persistent Disk Compute Engine.
Klik Simpan perubahan.
Penggantian kebijakan pemulihan data volume
Kebijakan pemulihan data volume menggantikan cara memulihkan volume tertentu.
Volume dipilih berdasarkan namespace PVC dan nama PVC-nya. Anda dapat menyertakan
beberapa volume dalam satu penggantian.
Penggantian tidak menerapkan cakupan unik, tidak seperti pengikatan. Artinya, selama
pemulihan volume, kebijakan dari penggantian terbaru yang cocok dengan namespace dan nama volume akan digunakan.
Contoh penggantian
Contoh berikut menggantikan ns-1/test-pvc dan ns-1/test-pvc-2 untuk menggunakan
kebijakan Gunakan kembali volume yang ada dan berisi data Anda dan ns-2/test-pvc-3
untuk menggunakan kebijakan Jangan pulihkan data volume.
[[["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-01 UTC."],[],[],null,["# Define volume data restore behavior\n\nAutopilot Standard\n\n*** ** * ** ***\n\nThis page provides an overview of volume data restore policies. It also\nexplains how to configure volume data restore policy bindings and overrides.\n\nOverview\n--------\n\nThe volume data restore policy defines how to restore volume data from a backup.\nYou can configure it at the restore plan level. It has the following policy options:\n\n- **Provision new volumes and restore volume data from backup**: New persistent volumes (PVs) are restored using the corresponding volume backup data in the backup.\n- **Reuse existing volumes containing your data**: PVs are pre-provisioned using the volume handle of the original PV in the backup.\n- **Don't restore volume data**: PVs aren't restored. Backup for GKE only restores the selected persistent volume claims (PVCs) and expects the corresponding storage driver to either dynamically provision blank PVs or bind them to pre-provisioned PVs created out-of-band.\n\nFor instructions on creating a restore plan with volume data restore policy,\nsee [Create a restore plan](/kubernetes-engine/docs/add-on/backup-for-gke/how-to/restore-plan#create_a_restore_plan).\n\nThere are a few reasons why you might want to define custom volume restore\nbehavior apart from the default volume data restore policy:\n\n- To restore a workload with a storage environment that includes different types of volumes with varying levels of data backup support. For example, your workload may contain NFS volumes and Persistent Disk volumes.\n- To apply a different restore process to a specific volume.\n\nBackup for GKE provides two mechanisms for defining custom volume restore behavior:\n\n- Volume type specific bindings, which you can define as part of a [restore plan](/kubernetes-engine/docs/add-on/backup-for-gke/how-to/restore-plan#create_a_restore_plan).\n- Volume specific overrides, which you can define as part of a [restore](/kubernetes-engine/docs/add-on/backup-for-gke/how-to/restore#create_a_restore).\n\nVolume data restore policy selection process\n--------------------------------------------\n\nDuring the restore process, Backup for GKE selects the appropriate volume\nrestore policy for each PersistentVolumeClaim (PVC) using the following sequence:\n\n1. Before any transformation rules are applied, each PVC to be restored moves through a selection process and applies the first in-scope policy.\n2. If the PVC is not bound to a backed up PersistentVolume (PV), only the PVC configuration is restored. This doesn't include any data.\n3. If the PVC is included in a volume data restore policy override, the override policy takes precedence.\n4. If the PVC's volume type is included in a volume data restore policy binding, the binding policy is applied.\n5. If none of the earlier conditions match, the PVC uses the default volume data restore policy.\n\n| **Note:** If the **Provision new volumes and restore volume data from backup** policy is applied to a volume without a volume backup, Backup for GKE restores the PVC configuration without data.\n\nVolume data restore policy bindings\n-----------------------------------\n\nThe volume data restore policy bindings let you restore volume data with a\npolicy for a specific volume type. This policy takes precedence over the\ndefault volume restore policy. The volume data restore policy binding is only\nsupported for Compute Engine Persistent Disks. \n\n### gcloud\n\nAdd volume data restore policy bindings to an existing restore plan: \n\n gcloud beta container backup-restore restore-plans update \u003cvar translate=\"no\"\u003eRESTORE_PLAN\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n --location=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --volume-data-restore-policy-bindings=[\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nv\"\u003eVOLUME_TYPE\u003c/span\u003e\u003cspan class=\"devsite-syntax-o\"\u003e=\u003c/span\u003ePOLICY,...\u003c/var\u003e]\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eRESTORE_PLAN\u003c/var\u003e: the name of the restore plan that you want to update.\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of your Google Cloud project.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the [compute region](/compute/docs/regions-zones#available) for the resource, such as `us-central1`.\n- \u003cvar translate=\"no\"\u003eVOLUME_TYPE=POLICY\u003c/var\u003e: binds a supported volume type to a volume data restore policy. For example, `gce-persistent-disk=restore-volume-data-from-backup` creates a binding that results in Persistent Disk volumes being restored using the **Restore volume data from backup** policy.\n\n### Console\n\nUse the following instructions to add bindings to an existing restore plan in the Google Cloud console:\n\n1. In the Google Cloud console, go to the **Google Kubernetes Engine** page.\n\n [Go to Google Kubernetes Engine](https://console.cloud.google.com/kubernetes/list)\n2. In the navigation menu, click **Backup for GKE**.\n\n3. Click the **Restore plans** tab.\n\n4. Click the restore plan name.\n\n5. Click the **Details** tab.\n\n6. In the **Restore configuration** section, click **Edit** that is next to **Scope**.\n\n7. In the **Define policy override for specific volume types** section,\n click the **GCE Persistent Disk** checkbox.\n\n8. From the **Volume data restore policy** list, choose a restore policy\n type that you want to use for Compute Engine Persistent Disk.\n\n9. Click **Save changes**.\n\nVolume data restore policy overrides\n------------------------------------\n\nThe volume data restore policy overrides define how to restore specific volumes.\nVolumes are selected by their PVC namespaces and PVC names. You can include\nmultiple volumes in a single override.\n\nOverrides don't enforce unique scoping, unlike bindings. This means that during\nvolume restoration, the policy from the latest override that matches a volume's\nnamespace and name is used.\n\n### Override example\n\nThe following example overrides `ns-1/test-pvc` and `ns-1/test-pvc-2` to use\nthe **Reuse existing volumes containing your data** policy and `ns-2/test-pvc-3`\nto use the **Don't restore volume data** policy. \n\n volumeDataRestorePolicyOverrides:\n - policy: REUSE_VOLUME_HANDLE_FROM_BACKUP\n selectedPvcs:\n namespacedNames:\n - namespace: ns-1\n name: test-pvc\n - namespace: ns-1\n name: test-pvc-2\n - policy: NO_VOLUME_DATA_RESTORATION\n selectedPvcs:\n namespacedNames:\n - namespace: ns-2\n name: test-pvc-3\n\n### gcloud\n\nCreate a restore with overrides: \n\n gcloud beta container backup-restore restores create \u003cvar translate=\"no\"\u003eRESTORE\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n --location=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --restore-plan=\u003cvar translate=\"no\"\u003eRESTORE_PLAN\u003c/var\u003e \\\n --backup=\u003cvar translate=\"no\"\u003eBACKUP\u003c/var\u003e \\\n --volume-data-restore-policy-overrides-file=\u003cvar translate=\"no\"\u003eOVERRIDES_FILE\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eRESTORE\u003c/var\u003e: the name of the restore that you want to create.\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of your Google Cloud project.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the [compute region](/compute/docs/regions-zones#available) of the parent restore plan.\n- \u003cvar translate=\"no\"\u003eRESTORE_PLAN\u003c/var\u003e: the name of the parent restore plan this restore is derived from.\n- \u003cvar translate=\"no\"\u003eBACKUP\u003c/var\u003e: the backup to restore.\n- \u003cvar translate=\"no\"\u003eOVERRIDES_FILE\u003c/var\u003e: the path to a YAML file that defines overrides in the schema as seen in the example.\n\n### Console\n\nTo create a volume data restore policy override, you need to provide the\nPVC name, PVC namespace, and a restore policy.\n\nUse the following instructions to create a restore with overrides in the Google Cloud console:\n\n1. In the Google Cloud console, go to the **Google Kubernetes Engine** page.\n\n [Go to Google Kubernetes Engine](https://console.cloud.google.com/kubernetes/list)\n2. In the navigation menu, click **Backup for GKE**.\n\n3. Click the **Backups** tab.\n\n4. In the list of backups, find the backup that you want to restore and click **Set up a restore**.\n\n5. Choose a restore plan from the list of plans that apply to this backup.\n\n6. In the **Name the restore** section, enter a name and optional description for the restore.\n\n7. In the **Override volume data restore policy** section, click **Add policy**\n and complete the following for each override:\n\n 1. In **PVC name**, enter the name of the PVC.\n 2. In **Namespace**, enter the namespace of the PVC.\n 3. From the **Volume restore policy** list, choose how to restore that PVC's volume data.\n8. Click **Restore**.\n\nWhat's next\n-----------\n\n- Learn more about [restoring a backup](/kubernetes-engine/docs/add-on/backup-for-gke/how-to/restore)."]]