Controla los conflictos de recursos durante el restablecimiento
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Autopilot
Estándar
En esta página, se describe cómo configurar estrategias de manejo de conflictos para los recursos con espacio de nombres y con permisos de clúster en un plan de restablecimiento.
Cuando restableces un clúster, es posible que encuentres conflictos de recursos en las siguientes situaciones:
Restablecer a un clúster existente que ya tiene recursos aprovisionados.
Cuando un recurso de Kubernetes se administra con herramientas, como GitOps o un operador.
La copia de seguridad para GKE proporciona varias opciones para definir la administración de conflictos de recursos con espacio de nombres y centrados en el clúster que puedes especificar en un plan de restablecimiento.
Se restableció el manejo de conflictos para los recursos con permiso de clúster
Puedes configurar las siguientes opciones en el plan de restablecimiento para controlar los conflictos de un recurso con permisos de clúster:
Mantener los recursos en el clúster de destino (no destructivo): Si ya existe un recurso con el mismo nombre en el clúster de destino, déjalo como está.
Reemplazar recursos en el clúster de destino (destructivo): Si un recurso ya
existe en el clúster de destino, bórralo y restablece la copia desde la copia de seguridad.
gcloud
Actualiza un plan de restablecimiento existente para controlar el conflicto de un recurso con permisos de clúster:
CLUSTER_RESOURCE_CONFLICT_POLICY: Define cómo controlar los conflictos en el tiempo de restablecimiento de los recursos del clúster seleccionados. Usa una de las siguientes opciones:
use-existing-version: Si los recursos que se restablecen ya existen en el clúster de destino, la copia de seguridad para GKE conserva los recursos existentes.
use-backup-version: Si los recursos que se están restableciendo ya existen en el clúster de destino, la copia de seguridad para GKE reemplaza los recursos existentes por los nuevos de la copia de seguridad.
Console
Usa las siguientes instrucciones para actualizar la política de conflictos de recursos centrados en el clúster en la consola de Google Cloud:
En la consola de Google Cloud, ve a la página Google Kubernetes Engine.
En el menú de navegación, haz clic en Copia de seguridad para GKE.
Haz clic en la pestaña Planes de restablecimiento.
Haz clic en el nombre del plan de restablecimiento.
Haz clic en la pestaña Detalles.
En la sección Restablecer configuración, ve a la sección Recursos con alcance de clúster y haz clic en Editar.
En la sección Define cómo manejar los conflictos, selecciona una opción de manejo de conflictos.
Haz clic en Guardar cambios.
Restablece la administración de conflictos para recursos con espacio de nombres
En el plan de restablecimiento, puedes configurar las siguientes opciones para administrar los conflictos de un recurso con espacio de nombres. Puedes especificar el manejo de conflictos para los recursos con espacio de nombres en los siguientes niveles:
Recurso individual
Espacio de nombres y ProtectedApplication
Las siguientes son las opciones disponibles para controlar los conflictos de los recursos individuales:
Omitir combinación (no destructiva): Si ya existe un recurso específico, omite restablecerlo desde la copia de seguridad.
Volumen de reemplazo de combinación (destructivo): Si ya existe un recurso específico,omite restablecerlo, pero reemplaza el volumen persistente subyacente con la política de restablecimiento de datos de volumen. El volumen de reemplazo de combinación logra el restablecimiento solo de datos.
Reemplazo de combinación (destructivo): Si ya existe un recurso específico,
reemplázalo con el de la copia de seguridad y los datos del volumen
asociados siguiendo la política de restablecimiento de datos de volumen.
Las siguientes son las opciones disponibles para controlar los conflictos de todos los recursos que pertenecen a un espacio de nombres y ProtectedApplication:
Falla debido a un conflicto (no destructivo): Si el espacio de nombres o la ProtectedApplication destinados al restablecimiento desde una copia de seguridad que ya existe en el clúster de destino, el restablecimiento fallará.
Rollback (destructivo): Cuando el clúster de destino contiene el espacio de nombres o la ProtectedApplication que se usarán para restablecer el clúster, el grupo existente de recursos se borra antes de que se restablezcan los recursos nuevos.
gcloud
Actualiza un plan de restablecimiento existente para controlar el conflicto de un recurso con espacio de nombres:
NAMESPACED_RESOURCE_RESTORE_MODE: Define cómo controlar los conflictos de tiempo de restablecimiento para los recursos con espacio de nombres. Usa una de las siguientes opciones:
merge-skip-on-conflict: Omite los recursos individuales en conflicto.
merge-replace-volume-on-conflict: Omite los recursos individuales en conflicto, pero reemplaza los datos de volumen persistente subyacentes.
merge-replace-on-conflict: reemplaza los recursos individuales en conflicto y los datos de volumen persistente subyacentes.
fail-on-conflict: Falla en el espacio de nombres en conflicto o en ProtectedApplication.
delete-and-restore: Revierte el espacio de nombres en conflicto o ProtectedApplication.
Console
Usa las siguientes instrucciones para actualizar la política de conflictos de recursos con espacio de nombres en la consola de Google Cloud:
En la consola de Google Cloud, ve a la página Google Kubernetes Engine.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2024-12-06 (UTC)"],[],[],null,["# Handle resource conflicts during restore\n\nAutopilot Standard\n\n*** ** * ** ***\n\nThis page describes how to configure conflict handling strategies for\nnamespaced and cluster-scoped resources in a restore plan.\n\nWhen restoring to a cluster, you might encounter resource conflicts in the following scenarios:\n\n- Restoring to an existing cluster that already has resources provisioned.\n- When a Kubernetes resource is managed by tools, such as GitOps or an [operator](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/).\n\nBackup for GKE provides various options to define conflict handling for\ncluster-scoped and namespaced resources that you can specify in a [restore plan](/kubernetes-engine/docs/add-on/backup-for-gke/how-to/restore-plan#create_a_restore_plan).\n\nRestore conflict handling for cluster-scoped resources\n------------------------------------------------------\n\nYou can configure the following options in the restore plan to handle conflicts\nfor a cluster-scoped resources:\n\n- **Keep resources in target cluster (non-destructive)**: if a resource with the same name exists in the target cluster, leave it as it is.\n- **Replace resources in target cluster (destructive)**: if a resource already\n exists in the target cluster, delete it and restore the copy from the backup.\n\n | **Warning:** This option could cause unintentional data loss if used inappropriately. For example, deleting a `CustomResourceDefinition` will cause Kubernetes to delete all custom `CustomResource` of that type.\n\n### gcloud\n\nUpdate an existing restore plan to handle conflict for a cluster-scoped resource: \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 --cluster-resource-conflict-policy=\u003cvar translate=\"no\"\u003eCLUSTER_RESOURCE_CONFLICT_POLICY\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, for example `us-central1`.\n- \u003cvar translate=\"no\"\u003eCLUSTER_RESOURCE_CONFLICT_POLICY\u003c/var\u003e: defines how to handle restore-time conflicts for selected cluster resources. Use one of the following options:\n\n - \u003cvar translate=\"no\"\u003euse-existing-version\u003c/var\u003e: if the resources that are being restored already exist in the target cluster, Backup for GKE keeps the existing resources.\n - \u003cvar translate=\"no\"\u003euse-backup-version\u003c/var\u003e: if the resources that are being restored already exist in the target cluster, Backup for GKE replaces the existing resources with the new resources from the backup.\n\n### Console\n\nUse the following instructions to update cluster-scoped resources conflict policy 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 configurations** section, go to the **Cluster-scoped resources** section and click **Edit**.\n\n7. In the **Define conflict handling** section, select a conflict handling option.\n\n8. Click **Save changes**.\n\nRestore conflict handling for namespaced resources\n--------------------------------------------------\n\nIn the restore plan, you can configure the following options to manage conflict\nfor a namespaced resource. You can specify conflict handling for namespaced\nresources at the following levels:\n\n- Individual resource\n- Namespace and ProtectedApplication\n\n| **Note:** If the restore plan includes destructive policies, such as merge replace volume, merge replace, and rollback, the PV and volume continue to exist but become orphaned and unused if the reclaim policy is [Retain](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#retain). If the reclaim policy is [Delete](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#delete), the PV and volume are deleted.\n\nThe following are the available options to handle conflicts for the individual resources:\n\n- **Merge skip (non-destructive)**: if a specific resource already exists, skip restoring the resource from the backup.\n- **Merge replace volume (destructive)**: if a specific resource already exists, skip restoring that resource but replace the underlying persistent volume using the volume data restore policy. The merge replace volume achieves the data-only restore.\n- **Merge replace (destructive)**: if a specific resource already exists, replace that resource with the one from backup and the associated volume data by following the volume data restore policy.\n\nThe following are the available options to handle conflicts of all resources\nbelonging to a **Namespace** and **ProtectedApplication**:\n\n- **Fail on conflict (non-destructive)** : if namespace or [ProtectedApplication](/kubernetes-engine/docs/add-on/backup-for-gke/how-to/protected-application) targeted for restore from a backup that already exists in the target cluster, the restore fails.\n- **Rollback (destructive)** : when the target cluster contains the namespace\n or [ProtectedApplication](/kubernetes-engine/docs/add-on/backup-for-gke/how-to/protected-application) that are targeted for restore to the cluster,\n the existing group of resources is deleted before the new resources are restored.\n\n### gcloud\n\nUpdate an existing restore plan to handle conflict for a namespaced resource: \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 --namespaced-resource-restore-mode=\u003cvar translate=\"no\"\u003eNAMESPACED_RESOURCE_RESTORE_MODE\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, for example `us-central1`.\n- \u003cvar translate=\"no\"\u003eNAMESPACED_RESOURCE_RESTORE_MODE\u003c/var\u003e: defines how to\n handle restore-time conflicts for namespaced resources. Use one of the following options:\n\n - \u003cvar translate=\"no\"\u003emerge-skip-on-conflict\u003c/var\u003e: skip the individual conflicting resources.\n - \u003cvar translate=\"no\"\u003emerge-replace-volume-on-conflict\u003c/var\u003e: skip the individual conflicting resources but replace the underlying persistent volume data.\n - \u003cvar translate=\"no\"\u003emerge-replace-on-conflict\u003c/var\u003e: replace the individual conflicting resources and underlying persistent volume data.\n - \u003cvar translate=\"no\"\u003efail-on-conflict\u003c/var\u003e: to fail on conflicting namespace or [ProtectedApplication](/kubernetes-engine/docs/add-on/backup-for-gke/how-to/protected-application).\n - \u003cvar translate=\"no\"\u003edelete-and-restore\u003c/var\u003e: roll back conflicting namespace or [ProtectedApplication](/kubernetes-engine/docs/add-on/backup-for-gke/how-to/protected-application).\n\n### Console\n\nUse the following instructions to update namespaced resources conflict policy 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 configurations** section, go to the **Namespaced resources** section and click **Edit**.\n\n7. In the **Define conflict handling** section, select a conflict handling option.\n\n8. Click **Save changes**.\n\nRecommended conflict handlings for common scenarios\n---------------------------------------------------\n\nThe following table lists the recommended conflict handling strategies for certain common scenarios:\n\nWhat's next\n-----------\n\n- Learn more about [restoring a backup](/kubernetes-engine/docs/add-on/backup-for-gke/how-to/restore)."]]