Esta documentación es para la versión actual de GKE en AWS, publicada en noviembre de 2021. Consulta las notas de la versión para obtener más información.
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
En esta página, se explica cómo puedes habilitar el emulador de IMDS, que emula el servicio de metadatos de la instancia de AWS (IMDS). Puedes ejecutar el emulador como un archivo adicional para permitir que las cargas de trabajo heredadas se ejecuten en grupos de nodos de GKE en AWS. Si tienes cargas de trabajo heredadas que no admiten Workload Identity directamente, usa este emulador para acceder a los datos de IMDS.
Limitaciones
Tu clúster debe usar la versión 1.24 de Kubernetes o posterior.
El servidor del emulador de IMDS solo entrega solicitudes de credenciales (API_VERSION/meta-data/iam/security-credentials/). Todas las demás solicitudes de metadatos devuelven un error 404.
Una implementación de sidecar requiere que el contenedor init tenga las capacidades de contexto de seguridadNET_ADMIN y NET_RAW.
Si no estás seguro de si el contenedor tiene estos contextos, consulta a tu equipo de seguridad.
El token de AWS STS puede durar una hora. El token de rol de los metadatos de EC2 puede durar 24 horas. Esto no debería afectar el uso del emulador, pero es posible que debas saber esta información durante una auditoría de seguridad.
El emulador de IMDS solo emula las respuestas de IMDSv1. IMDSv2 no es compatible.
Habilita el emulador
Para habilitar el emulador de IMDS, agrega una etiqueta y una anotación a los metadatos de un Pod. También puedes habilitar el emulador mediante Deployment, DaemonSet o cualquier otro recurso que cree pods:
[[["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-07-01 (UTC)"],[],[],null,["# Enable the IMDS emulator\n\nThis page explains how you can enable the IMDS emulator, which emulates the AWS\ninstance metadata service (IMDS). You can run the\nemulator as a sidecar to enable legacy workloads to run in\nGKE on AWS node pools. If you have legacy workloads that don't\nsupport Workload Identity Federation for GKE directly, use this emulator to access IMDS data.\n\nLimitations\n-----------\n\n- Your cluster must use a Kubernetes version of 1.24 or later.\n- The emulator is not supported in the [previous generation](/kubernetes-engine/multi-cloud/docs/aws/previous-generation) of GKE on AWS.\n- The IMDS emulator server only serves credential requests (`API_VERSION/meta-data/iam/security-credentials/`). All other metadata requests return a 404 error.\n- A sidecar deployment requires the init container to have the `NET_ADMIN` and `NET_RAW` [security context capacities](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/). If you're not sure if the container has these contexts, consult your security team.\n- The AWS STS token can last for one hour. The role token from EC2 metadata can last for 24 hours. This shouldn't affect your usage of the emulator, but you might need to know this information during a security audit.\n- The IMDS emulator only emulates IMDSv1 responses. IMDSv2 is not supported.\n\nEnable the emulator\n-------------------\n\nTo enable the IMDS emulator, add a label and an annotation to metadata for a\nPod. You can also enable the emulator using a Deployment, DaemonSet, or any\nother resource that creates Pods:\n\n1. Add the following label and value to your Pod:\n\n gkemulticloud.googleapis.com/aws-imds-emulator-enabled: \"True\"\n\n The only acceptable value for this label is `True`. All other values\n (including `true` with a lowercase `t`) disable the emulator.\n2. Add the following annotation to your Pod:\n\n gkemulticloud.googleapis.com/aws-imds-emulator-role-arn: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eARN_ROLE\u003c/span\u003e\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eARN_ROLE\u003c/var\u003e with an Amazon Resource Name\n (ARN) that specifies the role that you want the resource to have.\n\n### Example\n\nThe following example is a Pod with the IMDS emulator enabled: \n\n apiVersion: v1\n kind: Pod\n metadata:\n name: nginx\n labels:\n gkemulticloud.googleapis.com/aws-imds-emulator-enabled: \"True\"\n annotations:\n gkemulticloud.googleapis.com/aws-imds-emulator-role-arn: \"arn:aws:iam::123456789012:role/my-example-role\"\n spec:\n serviceAccountName: my-sa\n containers:\n - name: nginx\n image: nginx"]]