Il prodotto descritto in questa documentazione, Anthos Clusters on AWS (generazione precedente), è ora in modalità di manutenzione. Tutte le nuove installazioni devono utilizzare l'attuale prodotto di generazione, Cluster Anthos on AWS.
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Per configurare un bilanciatore del carico rivolto all'esterno con GKE su AWS,
devi taggare la VPC e la subnet pubblica con l'ID cluster. Se hai già taggato la VPC e la subnet, vai ad Abilitazione di Ingress.
Prima di iniziare
Prima di iniziare a utilizzare GKE su AWS, assicurati di aver eseguito le seguenti attività:
GKE su AWS richiede tag per le sottoreti che contengono gli endpoint del bilanciatore del carico. GKE su AWS applica automaticamente i tag a tutte le subnet specificate nel
spec.Networking.ServiceLoadBalancerSubnetIDs
campo della risorsa AWSCluster.
Se vuoi aggiungere altre subnet al tuo cluster utente o se devi riapplicare i tag alle subnet esistenti, svolgi i seguenti passaggi.
Dalla directory anthos-aws, utilizza
anthos-gke per cambiare contesto e passare al servizio di gestione.
cd anthos-aws
anthos-gke aws management get-credentials
Recupera l'ID della VPC AWS del tuo cluster con kubectl e memorizzalo come variabile.
Sostituisci subnet-ids con l'elenco degli ID sottorete, separati da spazi. Ad esempio,
subnet-012345678abcdef subnet-abcdef123456789 subnet-123456789abcdef.
[[["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-07-22 UTC."],[],[],null,["# Preparing AWS networking\n\nTo set up an externally facing load balancer with GKE on AWS,\nyou need to tag your VPC and public subnet with your cluster ID. If you\nhave already tagged your VPC and subnet, skip to\n[Enabling Ingress](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/ingress).\n\nBefore you begin\n----------------\n\n\nBefore you start using GKE on AWS, make sure you have performed the following tasks:\n\n- Complete the [Prerequisites](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/prerequisites).\n\n\u003c!-- --\u003e\n\n- Install a [management service](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/installing-management).\n- Create a [user cluster](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/creating-user-cluster).\n\nGKE on AWS requires tags on subnets that contain load balancer\nendpoints. GKE on AWS automatically tags all subnets specified in the\n[`spec.Networking.ServiceLoadBalancerSubnetIDs`](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/reference/awscluster#specnetworking)\nfield of the `AWSCluster` resource.\n\nIf you would like to add additional subnets to your user cluster, or if you need\nto re-apply tags to existing subnets, perform the following steps.\n\n1. From your `anthos-aws` directory, use\n `anthos-gke` to switch context to your management service.\n\n ```sh\n cd anthos-aws\n anthos-gke aws management get-credentials\n ```\n | **Note:** `anthos-gke` uses the credentials you specified when you ran `aws configure`.\n\n \u003cbr /\u003e\n\n2. Get the ID of your cluster's AWS VPC with `kubectl` and store it as a\n variable.\n\n export VPC_ID=$(\\\n env HTTPS_PROXY=http://localhost:8118 \\\n kubectl get awscluster cluster-0 -o jsonpath='{.spec.networking.vpcID}')\n\n3. Check the variables content with `echo`. The output\n resembles `vpc-12345678abcdef0`.\n\n echo $VPC_ID\n\n4. Save your cluster ID into an environment variable.\n\n export CLUSTER_ID=$(\\\n env HTTPS_PROXY=http://localhost:8118 \\\n kubectl get awscluster cluster-0 -o jsonpath='{.status.clusterID}')\n\n You can check the variable with `echo`: \n\n echo $CLUSTER_ID\n\n The response includes your cluster ID. \n\n gke-12345678\n\n5. If you installed GKE on AWS into a dedicated VPC, you can use\n the `aws` command-line tool to retrieve the subnet ID.\n\n Select from the following options:\n - Public, if you want to expose Services on your public subnet.\n - Private, if you want to expose Services on your private subnet.\n - Multiple subnets, if you want to expose Services on multiple subnets.\n\n ### Public\n\n export SUBNET_ID=$(aws ec2 describe-subnets \\\n --filters \"Name=vpc-id,Values=$VPC_ID\" \"Name=tag:Name,Values=*public*\" \\\n --query \"Subnets[*].SubnetId\" \\\n --output text)\n\n The output is an object that contains your subnet ID. It resembles\n `subnet-1234abcdefg`. You can check the variable with `echo`: \n\n echo $SUBNET_ID\n\n The response includes your subnet ID. \n\n subnet-012345678abcdef\n\n ### Private\n\n export SUBNET_ID=$(aws ec2 describe-subnets \\\n --filters \"Name=vpc-id,Values=$VPC_ID\" \"Name=tag:Name,Values=*private*\" \\\n --query \"Subnets[*].SubnetId\" \\\n --output text)\n\n The output is an object that contains your subnet ID. It resembles\n `subnet-1234abcdefg`. You can check the variable with `echo`: \n\n echo $SUBNET_ID\n\n The response includes your subnet ID. \n\n subnet-012345678abcdef\n\n ### Multiple subnets\n\n If you are using multiple subnets for your AWSNodePools\n (for example, if you use multiple availability zones), you need to\n tag your subnet IDs individually.\n | **Note:** The following commands assume your subnets have `public` or `private` in their name. If your subnets do not include this text, change the parameters of the `--filters` flag. See [Using filtering](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Filtering.html) for more information.\n\n Retrieve your list of subnet IDs with `aws ec2 describe-subnets`.\n\n To get a list of all public subnets, run the following command: \n\n aws ec2 describe-subnets \\\n --filters \"Name=vpc-id,Values=$VPC_ID\" \"Name=tag:Name,Values=*public*\" \\\n --query \"Subnets[*].SubnetId\" \\\n --output text\n\n To get a list of all private subnets, run the following command: \n\n aws ec2 describe-subnets \\\n --filters \"Name=vpc-id,Values=$VPC_ID\" \"Name=tag:Name,Values=*private*\" \\\n --query \"Subnets[*].SubnetId\" \\\n --output text\n\n The response includes your subnet IDs. \n\n subnet-012345678abcdef\n subnet-abcdef123456789\n subnet-123456789abcdef\n\n6. Tag your subnet with your cluster ID. If you have multiple subnets,\n select Multiple subnets.\n\n ### Single subnet\n\n aws ec2 create-tags \\\n --resources $SUBNET_ID \\\n --tags Key=kubernetes.io/cluster/$CLUSTER_ID,Value=shared\n\n ### Multiple subnets\n\n For each of your subnets, run the following command: \n\n aws ec2 create-tags \\\n --resources \u003cvar translate=\"no\"\u003esubnet-ids\u003c/var\u003e \\\n --tags Key=kubernetes.io/cluster/$CLUSTER_ID,Value=shared\n\n Replace \u003cvar translate=\"no\"\u003esubnet-ids\u003c/var\u003e with the list of subnet IDs, separated by\n spaces. For example,\n `subnet-012345678abcdef subnet-abcdef123456789 subnet-123456789abcdef`."]]