Crea una copia de seguridad y restablece los datos del notebook
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Google Distributed Cloud (GDC) con aislamiento de aire te permite crear copias de seguridad y restablecer datos desde el directorio principal de tus instancias de JupyterLab.
En esta página, se describe cómo crear y restablecer copias de seguridad de los datos de los notebooks de Vertex AI Workbench. Si eres nuevo en Vertex AI, obtén más información sobre Vertex AI Workbench.
Antes de comenzar
Para obtener los permisos que necesitas para copiar los datos restablecidos, pídele al administrador de IAM de tu organización que te otorgue el rol de desarrollador de clúster de usuarios (user-cluster-developer).
Crea una copia de seguridad y restablece los datos de la instancia de JupyterLab
Define aplicaciones protegidas para crear una copia de seguridad del directorio principal de una instancia individual de JupyterLab o de los directorios principales de todas las instancias de JupyterLab de un proyecto a la vez.
Crea un recurso personalizado ProtectedApplication en el clúster en el que deseas programar copias de seguridad. Los planes de copia de seguridad y restablecimiento usan aplicaciones protegidas para seleccionar recursos. Para obtener información sobre cómo crear aplicaciones protegidas, consulta Estrategias de protección de aplicaciones.
El recurso personalizado ProtectedApplication contiene los siguientes campos:
Campo
Descripción
resourceSelection
Es la forma en que el objeto ProtectedApplication selecciona recursos para copias de seguridad o restablecimientos.
type
Es el método para seleccionar recursos. Un tipo Selector indica que se deben seleccionar los recursos con etiquetas coincidentes.
selector
Son las reglas de selección. Este campo contiene los siguientes subcampos:
matchLabels
Son las etiquetas que usa el objeto ProtectedApplication para hacer coincidir los recursos. Este campo contiene los siguientes subcampos:
app.kubernetes.io/part-of
Nombre de una aplicación de nivel superior de la que forma parte esta. Selecciona Vertex AI Workbench como la aplicación de alto nivel para las instancias de JupyterLab.
app.kubernetes.io/component
Es el componente dentro de la arquitectura. Selecciona recursos de Vertex AI Workbench que proporcionen almacenamiento para las instancias de JupyterLab.
app.kubernetes.io/instance
Es un nombre único que identifica la instancia de una aplicación. Reduce el alcance para seleccionar una instancia de JupyterLab. El valor es el mismo que el nombre de la instancia de JupyterLab en la consola de GDC.
Usa el recurso personalizado ProtectedApplication para seleccionar el almacenamiento de una sola instancia de JupyterLab o de todas las instancias de JupyterLab en un proyecto, como en los siguientes ejemplos:
Selecciona el almacenamiento de una sola instancia de JupyterLab:
En el siguiente ejemplo, se muestra un recurso personalizado ProtectedApplication que selecciona el almacenamiento para una instancia de JupyterLab llamada my-instance-name en el espacio de nombres my-project:
Selecciona el almacenamiento de todas las instancias de JupyterLab:
En el siguiente ejemplo, se muestra un recurso personalizado ProtectedApplication que selecciona el almacenamiento para todas las instancias de JupyterLab en el espacio de nombres my-project:
Copia los datos restablecidos en una nueva instancia de JupyterLab
Sigue estos pasos para copiar los datos restablecidos del recurso PersistentVolumeClaim de una instancia de JupyterLab a una instancia nueva de JupyterLab:
[[["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: 2025-09-04 (UTC)"],[[["\u003cp\u003eGoogle Distributed Cloud (GDC) air-gapped allows for the creation of backups and restoration of data from the home directory of JupyterLab instances.\u003c/p\u003e\n"],["\u003cp\u003eA \u003ccode\u003eProtectedApplication\u003c/code\u003e custom resource is used to define which JupyterLab instances, or their storage, will be included in backup and restore operations.\u003c/p\u003e\n"],["\u003cp\u003eYou can create backups for a single JupyterLab instance or for all JupyterLab instances within a project by selecting the appropriate labels within the \u003ccode\u003eProtectedApplication\u003c/code\u003e custom resource.\u003c/p\u003e\n"],["\u003cp\u003eRestored data must be transferred to a new JupyterLab instance, as settings on the original \u003ccode\u003eNotebook\u003c/code\u003e custom resource are not backed up, and the process involves getting pod and image details, and creating a new pod for data access and copying.\u003c/p\u003e\n"],["\u003cp\u003eThe restored data is located in the \u003ccode\u003e/home/jovyan/restore\u003c/code\u003e directory of the new JupyterLab instance, accessible after transferring the data from the restored \u003ccode\u003ePersistentVolumeClaim\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Create a backup and restore notebook data\n\nGoogle Distributed Cloud (GDC) air-gapped lets you create backups and restore data from the\nhome directory of your JupyterLab instances.\n\nThis page describes creating and restoring backups of Vertex AI Workbench\nnotebook data. If you are new to Vertex AI,\n[learn more about Vertex AI Workbench](/distributed-cloud/hosted/docs/latest/gdch/application/ao-user/vertex-ai-workbench-intro).\n| **Note:** Vertex AI Workbench doesn't support backing up the settings on the `Notebook` custom resource of the JupyterLab instance. You must create new JupyterLab instances and transfer the restored data into that instance.\n\nBefore you begin\n----------------\n\nTo get the permissions that you need to copy restored data, ask your\nOrganization IAM Admin to grant you the User Cluster\nDeveloper (`user-cluster-developer`) role.\n\nCreate a backup and restore JupyterLab instance data\n----------------------------------------------------\n\nDefine protected applications to create a backup of the home directory of an\nindividual JupyterLab instance or the home directories of all JupyterLab instances\nin a project at once.\n\nCreate a `ProtectedApplication` custom resource in the cluster where you want to\nschedule backups. Backup and restore plans use protected applications to select\nresources. For information about creating protected applications, see\n[Protected application strategies](/distributed-cloud/hosted/docs/latest/gdch/platform-application/pa-ao-operations/protected-application-strategies).\n\nThe `ProtectedApplication` custom resource contains the following fields:\n\nUse the `ProtectedApplication` custom resource to select the storage of a single\nJupyterLab instance or all JupyterLab instances in a project, as in the following\nexamples:\n\n- **Select the storage of a single JupyterLab instance**:\n\n The following example shows a `ProtectedApplication` custom resource that\n selects the storage for a JupyterLab instance named `my-instance-name` in\n the `my-project` namespace: \n\n apiVersion: gkebackup.gke.io/v1\n kind: ProtectedApplication\n metadata:\n name: my-protected-application\n namespace: my-project\n spec:\n resourceSelection:\n type: Selector\n selector:\n matchLabels:\n app.kubernetes.io/part-of: vtxwb\n app.kubernetes.io/component: storage\n app.kubernetes.io/instance: my-instance-name\n\n- **Select the storage of all JupyterLab instances**:\n\n The following example shows a `ProtectedApplication` custom resource that\n selects the storage for all JupyterLab instances in the `my-project` namespace: \n\n apiVersion: gkebackup.gke.io/v1\n kind: ProtectedApplication\n metadata:\n name: my-protected-application\n namespace: my-project\n spec:\n resourceSelection:\n type: Selector\n selector:\n matchLabels:\n app.kubernetes.io/part-of: vtxwb\n app.kubernetes.io/component: storage\n\n This example doesn't contain the `app.kubernetes.io/instance` label because\n it selects all JupyterLab instances.\n\nTo create a backup and restore data from a JupyterLab instance,\n[plan a set of backups](/distributed-cloud/hosted/docs/latest/gdch/platform-application/pa-ao-operations/plan-backups)\nand [plan a set of restores](/distributed-cloud/hosted/docs/latest/gdch/platform-application/pa-ao-operations/plan-restores)\nusing the `ProtectedApplication` custom resource you defined.\n\nCopy restored data to a new JupyterLab instance\n-----------------------------------------------\n\nFollow these steps to copy restored data from the `PersistentVolumeClaim`\nresource of a JupyterLab instance to a new JupyterLab instance:\n\n1. [Meet the prerequisites](#before-you-begin).\n2. [Create a JupyterLab notebook](/distributed-cloud/hosted/docs/latest/gdch/application/ao-user/vertex-ai-workbench#create-notebook) associated with a JupyterLab instance to copy restored data.\n3. Get the pod name of the JupyterLab instance where you created the notebook:\n\n kubectl get pods -l notebook-name=\u003cvar translate=\"no\"\u003eINSTANCE_NAME\u003c/var\u003e -n \u003cvar translate=\"no\"\u003ePROJECT_NAMESPACE\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eINSTANCE_NAME\u003c/var\u003e: the name of the JupyterLab instance you configured.\n - \u003cvar translate=\"no\"\u003ePROJECT_NAMESPACE\u003c/var\u003e: the project namespace where you created the JupyterLab instance.\n4. Get the name of the image that the JupyterLab instance is running:\n\n kubectl get pods \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e -n \u003cvar translate=\"no\"\u003ePROJECT_NAMESPACE\u003c/var\u003e -o jsonpath=\"{.spec.containers[0].image}\"\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e: the pod name of the JupyterLab instance.\n - \u003cvar translate=\"no\"\u003ePROJECT_NAMESPACE\u003c/var\u003e: the project namespace where you created the JupyterLab instance.\n5. Find the name of the `PersistentVolumeClaim` resource that was restored:\n\n kubectl get pvc -l app.kubernetes.io/part-of=vtxwb,app.kubernetes.io/component=storage,app.kubernetes.io/instance=\u003cvar translate=\"no\"\u003eRESTORED_INSTANCE_NAME\u003c/var\u003e -n \u003cvar translate=\"no\"\u003ePROJECT_NAMESPACE\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eRESTORED_INSTANCE_NAME\u003c/var\u003e: the name of the JupyterLab instance that you restored.\n - \u003cvar translate=\"no\"\u003ePROJECT_NAMESPACE\u003c/var\u003e: the project namespace where you created the JupyterLab instance.\n6. Create a YAML file named `vtxwb-data.yaml` with the following content:\n\n apiVersion: v1\n kind: Pod\n metadata:\n name: vtxwb-data\n namespace: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003ePROJECT_NAMESPACE\u003c/span\u003e\u003c/var\u003e\n labels:\n aiplatform.gdc.goog/service-type: workbench\n spec:\n containers:\n - args:\n - sleep infinity\n command:\n - bash\n - -c\n image: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eIMAGE_NAME\u003c/span\u003e\u003c/var\u003e\n imagePullPolicy: IfNotPresent\n name: vtxwb-data\n resources:\n limits:\n cpu: \"1\"\n memory: 1Gi\n requests:\n cpu: \"1\"\n memory: 1Gi\n terminationMessagePath: /dev/termination-log\n terminationMessagePolicy: File\n volumeMounts:\n - mountPath: /home/jovyan\n name: restore-data\n workingDir: /home/jovyan\n volumes:\n - name: restore-data\n persistentVolumeClaim:\n claimName: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eRESTORED_PVC_NAME\u003c/span\u003e\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_NAMESPACE\u003c/var\u003e: the project namespace where you created the JupyterLab instance.\n - \u003cvar translate=\"no\"\u003eIMAGE_NAME\u003c/var\u003e: the name of the container image that the JupyterLab instance is running.\n - \u003cvar translate=\"no\"\u003eRESTORED_PVC_NAME\u003c/var\u003e: the name of the restored `PersistentVolumeClaim` resource.\n\n | **Note:** The name of the home directory of your JupyterLab instances is `/home/jovyan`.\n7. Create a new pod for your restored `PersistentVolumeClaim` resource:\n\n kubectl apply -f ./vtxwb-data --kubeconfig \u003cvar translate=\"no\"\u003eKUBECONFIG_PATH\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eKUBECONFIG_PATH\u003c/var\u003e with the path of the\n kubeconfig file in the cluster.\n8. Wait for the `vtxwb-data` pod to reach the `RUNNING` state.\n\n9. Copy your restored data to a new JupyterLab instance:\n\n kubectl cp \u003cvar translate=\"no\"\u003ePROJECT_NAMESPACE\u003c/var\u003e/vtxwb-data:/home/jovyan ./restore --kubeconfig \u003cvar translate=\"no\"\u003eKUBECONFIG_PATH\u003c/var\u003e\n\n kubectl cp ./restore \u003cvar translate=\"no\"\u003ePROJECT_NAMESPACE\u003c/var\u003e/\u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e:/home/jovyan/restore --kubeconfig \u003cvar translate=\"no\"\u003eKUBECONFIG_PATH\u003c/var\u003e\n\n rm ./restore\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_NAMESPACE\u003c/var\u003e: the project namespace where you created the JupyterLab instance.\n - \u003cvar translate=\"no\"\u003eKUBECONFIG_PATH\u003c/var\u003e: the path of the kubeconfig file in the cluster.\n - \u003cvar translate=\"no\"\u003ePOD_NAME\u003c/var\u003e: the pod name of the JupyterLab instance.\n\n After copying the data, your restored data is available in the\n `/home/jovyan/restore` directory.\n10. Delete the pod that you created to access your restored data:\n\n kubectl delete pod vtxwb-data -n my-namespace` --kubeconfig \u003cvar translate=\"no\"\u003eKUBECONFIG_PATH\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eKUBECONFIG_PATH\u003c/var\u003e with the path of the kubeconfig file in the cluster."]]