Specifica l'ordine di ripristino delle risorse durante il ripristino
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Autopilot
Standard
Questa pagina descrive come specificare l'ordine in cui Backup per GKE
deve ripristinare diversi GroupKind durante un'operazione di ripristino.
Panoramica
Per impostazione predefinita, Backup per GKE ripristina i GroupKind noti in un ordine che
soddisfa i requisiti di dipendenza tra le risorse. Tuttavia, se sono presenti risorse aggiuntive
che devono essere ripristinate in un ordine specifico, puoi utilizzare la funzionalità di ordinamento del ripristino
per specificare l'ordine richiesto definendo le dipendenze tra le risorse
interessate.
Durante un'operazione di creazione o aggiornamento di un piano di ripristino, puoi specificare un elenco di
dipendenze GroupKind personalizzate. Per rappresentare una dipendenza tra due risorse personalizzate, specifica i due GroupKind seguenti:
GroupKind soddisfacente: questo GroupKind soddisfa le dipendenze e deve
essere ripristinato prima del GroupKind richiedente. Nella console Google Cloud , questo GroupKind è denominato Primo gruppo di API e Primo tipo di oggetto.
Richiede GroupKind: questo GroupKind dipende dal GroupKind soddisfacente
da ripristinare per primo. Nella console Google Cloud , questo GroupKind è denominato
campi Secondo gruppo di API e Secondo tipo di oggetto.
Backup per GKE prende un elenco di dipendenze personalizzate e le
dipendenze predefinite e le combina per generare un ordine di ripristino GroupKind.
Dipendenze predefinite
La tabella seguente elenca le dipendenze di accoppiamento predefinite tra le risorse GroundKind soddisfacenti
e richieste. Quando definisci un ordine di ripristino,
Backup per GKE ripristina tutti i GroundKind soddisfacenti prima di richiedere GroupKind.
Ad esempio, Backup per GKE ripristina sempre tutti i storage.k8s.io/StorageClass
prima di PersistentVolumeClaims.
L'ordinamento di ripristino predefinito gestisce anche i casi di base, ad esempio il ripristino
degli spazi dei nomi prima di tutte le risorse con spazio dei nomi e il ripristino di CustomResourceDefinitions
prima di qualsiasi CustomResources.
Segui queste istruzioni per aggiungere dipendenze GroupKind personalizzate a un piano di ripristino.
Consulta l'elenco delle dipendenze predefinite per tutte le dipendenze GroupKind
già gestite da Backup per GKE e che non devono essere specificate.
gcloud
Crea un file YAML per definire l'ordine di ripristino. Puoi utilizzare il seguente esempio di YAML.
L'esempio seguente indica che stable.example.com/First deve essere
ripristinato prima di stable.example.com/Second e che stable.example.com/Second
deve essere ripristinato prima di stable.example.com/Third.
Nel menu di navigazione, fai clic su Backup per GKE.
Fai clic sulla scheda Ripristina piani.
Fai clic sul nome del piano di ripristino.
Fai clic sulla scheda Dettagli.
Fai clic su Modifica accanto a Ripristina ordine.
Fai clic su Aggiungi set di ordini.
Nella sezione Elemento 1, inserisci Primo gruppo di API 1 e Primo tipo di oggetto 1
seguito da Secondo gruppo di API 2 e Secondo tipo di oggetto 2 nell'ordine
in cui ripristinare le risorse.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# Specify resource restore ordering during restoration\n\nAutopilot Standard\n\n*** ** * ** ***\n\nThis page describes how to specify the order in which Backup for GKE\nshould restore different GroupKinds during a restore operation.\n\nOverview\n--------\n\nBy default, Backup for GKE restores well-known GroupKinds in an order that\nfulfills dependency requirements among resources. However, if there are additional\nresources that need restoring in a specific order, you can use the restore ordering\nfeature to specify the required order by defining dependencies between the affected\nresources.\n\nDuring a restore plan create or update operation, you can specify a list of\ncustom GroupKind dependencies. To represent a dependency between two custom\nresources, specify the following two GroupKinds:\n\n- Satisfying GroupKind: this GroupKind satisfies the dependencies and must be restored before the requiring GroupKind. In the Google Cloud console, this GroupKind is termed as the **First API group** and **First object kind** fields.\n- Requiring GroupKind: this GroupKind depends on the satisfying GroupKind to be restored first. In the Google Cloud console, this GroupKind is termed as the **Second API group** and **Second object kind** fields.\n\nBackup for GKE takes a list of custom dependencies and the\n[default dependencies](#default) and combines them to generate a GroupKind restore order.\n\nDefault dependencies\n--------------------\n\nThe following table lists the default pairing dependencies between satisfying\nand requiring GroundKind resources. When defining a restoring order,\nBackup for GKE restores all satisfying GroundKinds before Requiring GroupKinds.\nFor example, Backup for GKE always restores all `storage.k8s.io/StorageClass`\nbefore `PersistentVolumeClaims`.\n\nThe default restore ordering also handles basic cases, such as restoring\nnamespaces before all namespaced resources and restoring `CustomResourceDefinitions`\nbefore any `CustomResources`.\n\nDefine resource restore ordering\n--------------------------------\n\nUse the following instructions to add custom GroupKind dependencies to a restore plan.\nRefer to the list of [default dependencies](#default) for all GroupKind dependencies\nthat are already handled by Backup for GKE and don't need to be specified. \n\n### gcloud\n\n1. Create a YAML file to define restore order. You can use the following YAML example.\n\n The following example indicates that `stable.example.com/First` must be\n restored before `stable.example.com/Second` and that `stable.example.com/Second`\n must be restored before `stable.example.com/Third`. \n\n restoreOrder:\n groupKindDependencies:\n - satisfying:\n resourceGroup: stable.example.com\n resourceKind: First\n requiring:\n resourceGroup: stable.example.com\n resourceKind: Second\n - satisfying:\n resourceGroup: stable.example.com\n resourceKind: Second\n requiring:\n resourceGroup: stable.example.com\n resourceKind: Third\n\n2. Define a restore order using the restore order file you created.\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 --restore_order_file=\u003cvar translate=\"no\"\u003eRESTORE_ORDER_FILE\u003c/var\u003e\n\n Replace 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 of the parent restore plan.\n- \u003cvar translate=\"no\"\u003eRESTORE_ORDER_FILE\u003c/var\u003e: the path to the YAML file containing the GroupKind dependencies, as shown in the earlier example.\n\n### Console\n\nUse the following instructions to add order 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. Click **Edit** that is next to the **Restore order**.\n\n7. Click **Add order set**.\n\n8. In the Item 1 section, enter **First API group 1** and **First object kind 1**\n followed by **Second API group 2** and **Second object kind 2** the order\n in which the resources to be restored.\n\n9. Click **Save changes**.\n\nWhat's next\n-----------\n\n- Learn more about [restoring a backup](/kubernetes-engine/docs/add-on/backup-for-gke/how-to/restore)."]]