Administra cargas de trabajo de contenedores de GPU
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Puedes habilitar y administrar los recursos de la unidad de procesamiento de gráficos (GPU) en tus contenedores. Por ejemplo, es posible que prefieras ejecutar notebooks de inteligencia artificial (IA) y aprendizaje automático (AA) en un entorno de GPU. La compatibilidad con GPU está habilitada de forma predeterminada en el dispositivo aislado de Google Distributed Cloud (GDC).
Antes de comenzar
Para implementar GPUs en tus contenedores, debes tener lo siguiente:
El rol de administrador de espacio de nombres (namespace-admin) para implementar cargas de trabajo de GPU en el espacio de nombres de tu proyecto
Es la ruta de acceso a kubeconfig para el clúster de Kubernetes de Bare Metal.
Accede y genera el archivo kubeconfig si no tienes uno.
Configura un contenedor para que use recursos de GPU
Para usar GPUs en un contenedor, completa los siguientes pasos:
Confirma que los nodos de tu clúster de Kubernetes admitan la asignación de recursos de GPU:
kubectldescribenodesNODE_NAME
Reemplaza NODE_NAME por el nodo que administra las GPUs que deseas inspeccionar.
El resultado pertinente es similar al siguiente fragmento:
Agrega los campos .containers.resources.requests y .containers.resources.limits a la especificación del contenedor. Dado que tu clúster de Kubernetes ya está configurado con máquinas con GPU, la configuración es la misma para todas las cargas de trabajo:
CONTAINER_IMAGE: Es la imagen del contenedor para acceder a las máquinas con GPU. Debes incluir la ruta de acceso al registro de contenedores y la versión de la imagen, como REGISTRY_PATH/hello-app:1.0.
Los contenedores también requieren permisos adicionales para acceder a las GPUs. Para cada contenedor que solicite GPUs, agrega los siguientes permisos a la especificación del contenedor:
[[["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)"],[],[],null,["# Manage GPU container workloads\n\nYou can enable and manage graphics processing unit (GPU) resources on your\ncontainers. For example, you might prefer running artificial intelligence (AI)\nand machine learning (ML) notebooks in a GPU environment. GPU support\nis enabled by default in Google Distributed Cloud (GDC) air-gapped appliance.\n\nBefore you begin\n----------------\n\nTo deploy GPUs to your containers, you must have the following:\n\n- The Namespace Admin role (`namespace-admin`) to deploy GPU workloads in\n your project namespace.\n\n- The kubeconfig path for the bare metal Kubernetes cluster.\n [Sign in and generate](/distributed-cloud/hosted/docs/latest/appliance/platform/pa-user/iam/sign-in#kubernetes-cluster-kubeconfig)\n the kubeconfig file if you don't have one.\n\nConfigure a container to use GPU resources\n------------------------------------------\n\nTo use GPUs in a container, complete the following steps:\n\n1. Confirm your Kubernetes cluster nodes support your GPU resource allocation:\n\n kubectl describe nodes \u003cvar translate=\"no\"\u003eNODE_NAME\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eNODE_NAME\u003c/var\u003e with the node managing the GPUs\n you want to inspect.\n\n The relevant output is similar to the following snippet: \n\n Capacity:\n nvidia.com/gpu-pod-NVIDIA_A100_80GB_PCIE: 1\n Allocatable:\n nvidia.com/gpu-pod-NVIDIA_A100_80GB_PCIE: 1\n\n2. Add the `.containers.resources.requests` and `.containers.resources.limits`\n fields to your container spec. Since your Kubernetes cluster is preconfigured\n with GPU machines, the configuration is the same for all workloads:\n\n ...\n containers:\n - name: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eCONTAINER_NAME\u003c/span\u003e\u003c/var\u003e\n image: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eCONTAINER_IMAGE\u003c/span\u003e\u003c/var\u003e\n resources:\n requests:\n nvidia.com/gpu-pod-NVIDIA_A100_80GB_PCIE: 1\n limits:\n nvidia.com/gpu-pod-NVIDIA_A100_80GB_PCIE: 1\n ...\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e: the name of the container.\n - \u003cvar translate=\"no\"\u003eCONTAINER_IMAGE\u003c/var\u003e: the container image to access the GPU machines. You must include the container registry path and version of the image, such as \u003cvar class=\"readonly\" translate=\"no\"\u003eREGISTRY_PATH\u003c/var\u003e`/hello-app:1.0`.\n3. Containers also require additional permissions to access GPUs. For each\n container that requests GPUs, add the following permissions to your\n container spec:\n\n ...\n securityContext:\n seLinuxOptions:\n type: unconfined_t\n ...\n\n4. Apply your container manifest file:\n\n kubectl apply -f \u003cvar translate=\"no\"\u003eCONTAINER_MANIFEST_FILE\u003c/var\u003e \\\n -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n --kubeconfig \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCONTAINER_MANIFEST_FILE\u003c/var\u003e: the YAML file for your container workload custom resource.\n - \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace in which to deploy the container workloads.\n - \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for the bare metal Kubernetes cluster to which you're deploying container workloads.\n5. Verify that your pods are running and are using the GPUs:\n\n kubectl get pods -A | grep \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e \\\n -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n --kubeconfig \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e\n\n The relevant output is similar to the following snippet: \n\n Port: 80/TCP\n Host Port: 0/TCP\n State: Running\n Ready: True\n Restart Count: 0\n Limits:\n nvidia.com/gpu-pod-NVIDIA_A100_80GB_PCIE: 1\n Requests:\n nvidia.com/gpu-pod-NVIDIA_A100_80GB_PCIE: 1"]]