Sono disponibili altri esempi AWS SDK nel repository AWS Doc SDK
Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
Esempi di utilizzo di Amazon EKS AWS CLI
I seguenti esempi di codice mostrano come eseguire azioni e implementare scenari comuni utilizzando AWS Command Line Interface con Amazon EKS.
Le operazioni sono estratti di codice da programmi più grandi e devono essere eseguite nel contesto. Sebbene le operazioni mostrino come richiamare le singole funzioni del servizio, è possibile visualizzarle contestualizzate negli scenari correlati.
Ogni esempio include un collegamento al codice sorgente completo, dove puoi trovare istruzioni su come configurare ed eseguire il codice nel contesto.
Argomenti
Azioni
Il seguente esempio di codice mostra come utilizzareassociate-access-policy.
- AWS CLI
-
Associare una politica di accesso e il relativo ambito alla voce di accesso del cluster
Quanto segue
associate-access-policyassocia una politica di accesso e il relativo ambito alla voce di accesso del cluster specificato.aws eks associate-access-policy \ --cluster-nameeks-customer\ --principal-arnarn:aws:iam::111122223333:role/Admin\ --policy-arnarn:aws:eks::aws:cluster-access-policy/AmazonEKSEditPolicy\ --access-scopetype=namespace,namespaces=defaultOutput:
{ "clusterName": "eks-customer", "principalArn": "arn:aws:iam::111122223333:role/Admin", "associatedAccessPolicy": { "policyArn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSEditPolicy", "accessScope": { "type": "namespace", "namespaces": [ "default" ] }, "associatedAt": "2025-05-24T15:59:51.981000-05:00", "modifiedAt": "2025-05-24T15:59:51.981000-05:00" } }Per ulteriori informazioni, consulta Associare le politiche di accesso alle voci di accesso nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta AssociateAccessPolicy AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareassociate-encryption-config.
- AWS CLI
-
Per associare una configurazione di crittografia a un cluster esistente
L'
associate-encryption-configesempio seguente abilita la crittografia su un cluster EKS esistente che non ha già la crittografia abilitata.aws eks associate-encryption-config \ --cluster-namemy-eks-cluster\ --encryption-config '[{"resources":["secrets"],"provider":{"keyArn":"arn:aws:kms:region-code:account:key/key"}}]'Output:
{ "update": { "id": "3141b835-8103-423a-8e68-12c2521ffa4d", "status": "InProgress", "type": "AssociateEncryptionConfig", "params": [ { "type": "EncryptionConfig", "value": "[{\"resources\":[\"secrets\"],\"provider\":{\"keyArn\":\"arn:aws:kms:region-code:account:key/key\"}}]" } ], "createdAt": "2024-03-14T11:01:26.297000-04:00", "errors": [] } }Per ulteriori informazioni, consulta Attivazione della crittografia segreta su un cluster esistente nella Guida per l'utente di Amazon EKS.
-
Per i dettagli sull'API, consulta AssociateEncryptionConfig AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareassociate-identity-provider-config.
- AWS CLI
-
Associa un provider di identità al tuo cluster Amazon EKS
L'
associate-identity-provider-configesempio seguente associa un provider di identità al tuo cluster Amazon EKS.aws eks associate-identity-provider-config \ --cluster-namemy-eks-cluster\ --oidc 'identityProviderConfigName=my-identity-provider,issuerUrl=https://oidc.eks.us-east-2.amazonaws.com/id/38D6A4619A0A69E342B113ED7F1A7652,clientId=kubernetes,usernameClaim=email,usernamePrefix=my-username-prefix,groupsClaim=my-claim,groupsPrefix=my-groups-prefix,requiredClaims={Claim1=value1,Claim2=value2}' \ --tagsenv=devOutput:
{ "update": { "id": "8c6c1bef-61fe-42ac-a242-89412387b8e7", "status": "InProgress", "type": "AssociateIdentityProviderConfig", "params": [ { "type": "IdentityProviderConfig", "value": "[{\"type\":\"oidc\",\"name\":\"my-identity-provider\"}]" } ], "createdAt": "2024-04-11T13:46:49.648000-04:00", "errors": [] }, "tags": { "env": "dev" } }Per ulteriori informazioni, consulta Autenticare gli utenti del cluster da un provider di identità OpenID Connect - Associare un provider di identità OIDC nella Guida per l'utente di Amazon EKS.
-
Per i dettagli sull'API, consulta AssociateIdentityProviderConfig
Command Reference.AWS CLI
-
Il seguente esempio di codice mostra come utilizzarecreate-access-entry.
- AWS CLI
-
Esempio 1: creare la voce di accesso per il cluster EKS
L'
create-access-entryesempio seguente crea una voce di accesso che consente a un principale IAM di accedere al cluster EKS.aws eks create-access-entry \ --cluster-nameeks-customer\ --principal-arnarn:aws:iam::111122223333:user/eks-userOutput:
{ "accessEntry": { "clusterName": "eks-customer", "principalArn": "arn:aws:iam::111122223333:user/eks-user", "kubernetesGroups": [], "accessEntryArn": "arn:aws:eks:us-west-2:111122223333:access-entry/eks-customer/user/111122223333/eks-user/a1b2c3d4-5678-90ab-cdef-a6506e3d36p0", "createdAt": "2025-04-14T22:45:48.097000-05:00", "modifiedAt": "2025-04-14T22:45:48.097000-05:00", "tags": {}, "username": "arn:aws:iam::111122223333:user/eks-user", "type": "STANDARD" } }Per ulteriori informazioni, consulta Creare voci di accesso nella Amazon EKS User Guide.
Esempio 2: creare la voce di accesso per il cluster EKS specificando il tipo di accesso
L'
create-access-entryesempio seguente crea una voce di accesso di tipoEC2_LINUXnel cluster EKS. Per impostazione predefinita, viene creata una voce diSTANDARDaccesso di tipo. Oltre all'impostazione predefinita, se specifichiamo altri tipi di accesso, è necessario passare un ARN del ruolo IAM nella CLI.aws eks create-access-entry \ --cluster-nameeks-customer\ --principal-arnarn:aws:iam::111122223333:role/admin-test-ip\ --typeEC2_LINUXOutput:
{ "accessEntry": { "clusterName": "eks-customer", "principalArn": "arn:aws:iam::111122223333:role/admin-test-ip", "kubernetesGroups": [ "system:nodes" ], "accessEntryArn": "arn:aws:eks:us-west-2:111122223333:access-entry/eks-customer/role/111122223333/admin-test-ip/accb5418-f493-f390-3e6e-c3f19f725fcp", "createdAt": "2025-05-06T19:42:45.453000-05:00", "modifiedAt": "2025-05-06T19:42:45.453000-05:00", "tags": {}, "username": "system:node:{{EC2PrivateDNSName}}", "type": "EC2_LINUX" } }Per ulteriori informazioni, consulta Creare voci di accesso nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta CreateAccessEntry AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarecreate-addon.
- AWS CLI
-
Esempio 1: creare un componente aggiuntivo Amazon EKS con una versione compatibile predefinita per la rispettiva versione del cluster EKS
Il seguente comando di
create-addonesempio crea un componente aggiuntivo Amazon EKS con una versione compatibile predefinita per la rispettiva versione del cluster EKS.aws eks create-addon \ --cluster-namemy-eks-cluster\ --addon-namemy-eks-addon\ --service-account-role-arnarn:aws:iam::111122223333:role/role-nameOutput:
{ "addon": { "addonName": "my-eks-addon", "clusterName": "my-eks-cluster", "status": "CREATING", "addonVersion": "v1.15.1-eksbuild.1", "health": { "issues": [] }, "addonArn": "arn:aws:eks:us-east-2:111122223333:addon/my-eks-cluster/my-eks-addon/1ec71ee1-b9c2-8915-4e17-e8be0a55a149", "createdAt": "2024-03-14T12:20:03.264000-04:00", "modifiedAt": "2024-03-14T12:20:03.283000-04:00", "serviceAccountRoleArn": "arn:aws:iam::111122223333:role/role-name", "tags": {} } }Per ulteriori informazioni, consulta Managing Amazon EKS add-ons - Creating an add-on nella Amazon EKS User Guide.
Esempio 2: creare un componente aggiuntivo Amazon EKS con una versione aggiuntiva specifica
Il comando di
create-addonesempio seguente crea un componente aggiuntivo Amazon EKS con una versione aggiuntiva specifica.aws eks create-addon \ --cluster-namemy-eks-cluster\ --addon-namemy-eks-addon\ --service-account-role-arnarn:aws:iam::111122223333:role/role-name\ --addon-versionv1.16.4-eksbuild.2Output:
{ "addon": { "addonName": "my-eks-addon", "clusterName": "my-eks-cluster", "status": "CREATING", "addonVersion": "v1.16.4-eksbuild.2", "health": { "issues": [] }, "addonArn": "arn:aws:eks:us-east-2:111122223333:addon/my-eks-cluster/my-eks-addon/34c71ee6-7738-6c8b-c6bd-3921a176b5ff", "createdAt": "2024-03-14T12:30:24.507000-04:00", "modifiedAt": "2024-03-14T12:30:24.521000-04:00", "serviceAccountRoleArn": "arn:aws:iam::111122223333:role/role-name", "tags": {} } }Per ulteriori informazioni, consulta Managing Amazon EKS add-ons - Creating an add-on nella Amazon EKS User Guide.
Esempio 3: creare un componente aggiuntivo Amazon EKS con valori di configurazione personalizzati e risolvere i dettagli dei conflitti
Il seguente comando di
create-addonesempio crea un componente aggiuntivo Amazon EKS con valori di configurazione personalizzati e risolve i dettagli dei conflitti.aws eks create-addon \ --cluster-namemy-eks-cluster\ --addon-namemy-eks-addon\ --service-account-role-arnarn:aws:iam::111122223333:role/role-name\ --addon-versionv1.16.4-eksbuild.2\ --configuration-values '{"resources":{"limits":{"cpu":"100m"}}}' \ --resolve-conflictsOVERWRITEOutput:
{ "addon": { "addonName": "my-eks-addon", "clusterName": "my-eks-cluster", "status": "CREATING", "addonVersion": "v1.16.4-eksbuild.2", "health": { "issues": [] }, "addonArn": "arn:aws:eks:us-east-2:111122223333:addon/my-eks-cluster/my-eks-addon/a6c71ee9-0304-9237-1be8-25af1b0f1ffb", "createdAt": "2024-03-14T12:35:58.313000-04:00", "modifiedAt": "2024-03-14T12:35:58.327000-04:00", "serviceAccountRoleArn": "arn:aws:iam::111122223333:role/role-name", "tags": {}, "configurationValues": "{\"resources\":{\"limits\":{\"cpu\":\"100m\"}}}" } }Per ulteriori informazioni, consulta Managing Amazon EKS add-ons - Creating an add-on nella Amazon EKS User Guide.
Esempio 4: creare un componente aggiuntivo Amazon EKS con file di valori di configurazione JSON personalizzati
Il seguente comando di
create-addonesempio crea un componente aggiuntivo Amazon EKS con valori di configurazione personalizzati e risolve i dettagli dei conflitti.aws eks create-addon \ --cluster-namemy-eks-cluster\ --addon-namemy-eks-addon\ --service-account-role-arnarn:aws:iam::111122223333:role/role-name\ --addon-versionv1.16.4-eksbuild.2\ --configuration-values 'file://configuration-values.json' \ --resolve-conflictsOVERWRITE\ --tags '{"eks-addon-key-1": "value-1" , "eks-addon-key-2": "value-2"}'Contenuto di
configuration-values.json.{ "resources": { "limits": { "cpu": "150m" } }, "env": { "AWS_VPC_K8S_CNI_LOGLEVEL": "ERROR" } }Output:
{ "addon": { "addonName": "my-eks-addon", "clusterName": "my-eks-cluster", "status": "CREATING", "addonVersion": "v1.16.4-eksbuild.2", "health": { "issues": [] }, "addonArn": "arn:aws:eks:us-east-2:111122223333:addon/my-eks-cluster/my-eks-addon/d8c71ef8-fbd8-07d0-fb32-6a7be19ececd", "createdAt": "2024-03-14T13:10:51.763000-04:00", "modifiedAt": "2024-03-14T13:10:51.777000-04:00", "serviceAccountRoleArn": "arn:aws:iam::111122223333:role/role-name", "tags": { "eks-addon-key-1": "value-1", "eks-addon-key-2": "value-2" }, "configurationValues": "{\n \"resources\": {\n \"limits\": {\n \"cpu\": \"150m\"\n }\n },\n \"env\": {\n \"AWS_VPC_K8S_CNI_LOGLEVEL\": \"ERROR\"\n }\n}" } }Per ulteriori informazioni, consulta Managing Amazon EKS add-ons - Creating an add-on nella Amazon EKS User Guide.
Esempio 5: creare un componente aggiuntivo Amazon EKS con file di valori di configurazione YAML personalizzati
Il seguente comando di
create-addonesempio crea un componente aggiuntivo Amazon EKS con valori di configurazione personalizzati e risolve i dettagli dei conflitti.aws eks create-addon \ --cluster-namemy-eks-cluster\ --addon-namemy-eks-addon\ --service-account-role-arnarn:aws:iam::111122223333:role/role-name\ --addon-versionv1.16.4-eksbuild.2\ --configuration-values 'file://configuration-values.yaml' \ --resolve-conflictsOVERWRITE\ --tags '{"eks-addon-key-1": "value-1" , "eks-addon-key-2": "value-2"}'Contenuto di
configuration-values.yaml.resources: limits: cpu: '100m' env: AWS_VPC_K8S_CNI_LOGLEVEL: 'DEBUG'Output:
{ "addon": { "addonName": "my-eks-addon", "clusterName": "my-eks-cluster", "status": "CREATING", "addonVersion": "v1.16.4-eksbuild.2", "health": { "issues": [] }, "addonArn": "arn:aws:eks:us-east-2:111122223333:addon/my-eks-cluster/my-eks-addon/d4c71efb-3909-6f36-a548-402cd4b5d59e", "createdAt": "2024-03-14T13:15:45.220000-04:00", "modifiedAt": "2024-03-14T13:15:45.237000-04:00", "serviceAccountRoleArn": "arn:aws:iam::111122223333:role/role-name", "tags": { "eks-addon-key-3": "value-3", "eks-addon-key-4": "value-4" }, "configurationValues": "resources:\n limits:\n cpu: '100m'\nenv:\n AWS_VPC_K8S_CNI_LOGLEVEL: 'INFO'" } }Per ulteriori informazioni, consulta Managing Amazon EKS add-ons - Creating an add-on nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta AWS CLI Command CreateAddon
Reference.
-
Il seguente esempio di codice mostra come utilizzarecreate-cluster.
- AWS CLI
-
Per creare un nuovo cluster
Questo comando di esempio crea un cluster denominato
prodnella regione predefinita.Comando:
aws eks create-cluster --nameprod\ --role-arnarn:aws:iam::012345678910:role/eks-service-role-AWSServiceRoleForAmazonEKS-J7ONKE3BQ4PI\ --resources-vpc-configsubnetIds=subnet-6782e71e,subnet-e7e761ac,securityGroupIds=sg-6979fe18Output:
{ "cluster": { "name": "prod", "arn": "arn:aws:eks:us-west-2:012345678910:cluster/prod", "createdAt": 1527808069.147, "version": "1.10", "roleArn": "arn:aws:iam::012345678910:role/eks-service-role-AWSServiceRoleForAmazonEKS-J7ONKE3BQ4PI", "resourcesVpcConfig": { "subnetIds": [ "subnet-6782e71e", "subnet-e7e761ac" ], "securityGroupIds": [ "sg-6979fe18" ], "vpcId": "vpc-950809ec" }, "status": "CREATING", "certificateAuthority": {} } }Per creare un nuovo cluster con accesso privato agli endpoint e registrazione abilitati
Questo comando di esempio crea un cluster denominato
examplenell'area predefinita con l'accesso pubblico agli endpoint disabilitato, l'accesso privato agli endpoint abilitato e tutti i tipi di registrazione abilitati.Comando:
aws eks create-cluster --nameexample--kubernetes-version1.12\ --role-arnarn:aws:iam::012345678910:role/example-cluster-ServiceRole-1XWBQWYSFRE2Q\ --resources-vpc-configsubnetIds=subnet-0a188dccd2f9a632f,subnet-09290d93da4278664,subnet-0f21dd86e0e91134a,subnet-0173dead68481a583,subnet-051f70a57ed6fcab6,subnet-01322339c5c7de9b4,securityGroupIds=sg-0c5b580845a031c10,endpointPublicAccess=false,endpointPrivateAccess=true\ --logging '{"clusterLogging":[{"types":["api","audit","authenticator","controllerManager","scheduler"],"enabled":true}]}'Output:
{ "cluster": { "name": "example", "arn": "arn:aws:eks:us-west-2:012345678910:cluster/example", "createdAt": 1565804921.901, "version": "1.12", "roleArn": "arn:aws:iam::012345678910:role/example-cluster-ServiceRole-1XWBQWYSFRE2Q", "resourcesVpcConfig": { "subnetIds": [ "subnet-0a188dccd2f9a632f", "subnet-09290d93da4278664", "subnet-0f21dd86e0e91134a", "subnet-0173dead68481a583", "subnet-051f70a57ed6fcab6", "subnet-01322339c5c7de9b4" ], "securityGroupIds": [ "sg-0c5b580845a031c10" ], "vpcId": "vpc-0f622c01f68d4afec", "endpointPublicAccess": false, "endpointPrivateAccess": true }, "logging": { "clusterLogging": [ { "types": [ "api", "audit", "authenticator", "controllerManager", "scheduler" ], "enabled": true } ] }, "status": "CREATING", "certificateAuthority": {}, "platformVersion": "eks.3" } }-
Per i dettagli sull'API, consulta Command CreateCluster
Reference AWS CLI .
-
Il seguente esempio di codice mostra come utilizzarecreate-fargate-profile.
- AWS CLI
-
Esempio 1: creazione del profilo EKS Fargate per un selettore con un namespace
L'
create-fargate-profileesempio seguente crea un profilo EKS Fargate per un selettore con un namespace.aws eks create-fargate-profile \ --cluster-namemy-eks-cluster\ --pod-execution-role-arnarn:aws:iam::111122223333:role/role-name\ --fargate-profile-namemy-fargate-profile\ --selectors '[{"namespace": "default"}]'Output:
{ "fargateProfile": { "fargateProfileName": "my-fargate-profile", "fargateProfileArn": "arn:aws:eks:us-east-2:111122223333:fargateprofile/my-eks-cluster/my-fargate-profile/a2c72bca-318e-abe8-8ed1-27c6d4892e9e", "clusterName": "my-eks-cluster", "createdAt": "2024-03-19T12:38:47.368000-04:00", "podExecutionRoleArn": "arn:aws:iam::111122223333:role/role-name", "subnets": [ "subnet-09d912bb63ef21b9a", "subnet-04ad87f71c6e5ab4d", "subnet-0e2907431c9988b72" ], "selectors": [ { "namespace": "default" } ], "status": "CREATING", "tags": {} } }Per ulteriori informazioni, consulta Profilo AWS Fargate - Creazione di un profilo Fargate nella Guida per l'utente di Amazon EKS.
Esempio 2: creazione del profilo EKS Fargate per un selettore con namespace ed etichette
L'
create-fargate-profileesempio seguente crea un profilo EKS Fargate per un selettore con uno spazio dei nomi e delle etichette.aws eks create-fargate-profile \ --cluster-namemy-eks-cluster\ --pod-execution-role-arnarn:aws:iam::111122223333:role/role-name\ --fargate-profile-namemy-fargate-profile\ --selectors '[{"namespace": "default", "labels": {"labelname1": "labelvalue1"}}]'Output:
{ "fargateProfile": { "fargateProfileName": "my-fargate-profile", "fargateProfileArn": "arn:aws:eks:us-east-2:111122223333:fargateprofile/my-eks-cluster/my-fargate-profile/88c72bc7-e8a4-fa34-44e4-2f1397224bb3", "clusterName": "my-eks-cluster", "createdAt": "2024-03-19T12:33:48.125000-04:00", "podExecutionRoleArn": "arn:aws:iam::111122223333:role/role-name", "subnets": [ "subnet-09d912bb63ef21b9a", "subnet-04ad87f71c6e5ab4d", "subnet-0e2907431c9988b72" ], "selectors": [ { "namespace": "default", "labels": { "labelname1": "labelvalue1" } } ], "status": "CREATING", "tags": {} } }Per ulteriori informazioni, consulta Profilo AWS Fargate - Creazione di un profilo Fargate nella Guida per l'utente di Amazon EKS.
Esempio 3: creazione del profilo EKS Fargate per un selettore con namespace ed etichette, insieme IDs alle sottoreti in cui lanciare un Pod.
L'
create-fargate-profileesempio seguente crea il profilo EKS Fargate per un selettore con uno spazio dei nomi e delle etichette, insieme IDs alle sottoreti in cui lanciare un Pod.aws eks create-fargate-profile \ --cluster-namemy-eks-cluster\ --pod-execution-role-arnarn:aws:iam::111122223333:role/role-name\ --fargate-profile-namemy-fargate-profile\ --selectors '[{"namespace": "default", "labels": {"labelname1": "labelvalue1"}}]' \ --subnets '["subnet-09d912bb63ef21b9a", "subnet-04ad87f71c6e5ab4d", "subnet-0e2907431c9988b72"]'Output:
{ "fargateProfile": { "fargateProfileName": "my-fargate-profile", "fargateProfileArn": "arn:aws:eks:us-east-2:111122223333:fargateprofile/my-eks-cluster/my-fargate-profile/e8c72bc8-e87b-5eb6-57cb-ed4fe57577e3", "clusterName": "my-eks-cluster", "createdAt": "2024-03-19T12:35:58.640000-04:00", "podExecutionRoleArn": "arn:aws:iam::111122223333:role/role-name", "subnets": [ "subnet-09d912bb63ef21b9a", "subnet-04ad87f71c6e5ab4d", "subnet-0e2907431c9988b72" ], "selectors": [ { "namespace": "default", "labels": { "labelname1": "labelvalue1" } } ], "status": "CREATING", "tags": {} } }Per ulteriori informazioni, consulta Profilo AWS Fargate - Creazione di un profilo Fargate nella Guida per l'utente di Amazon EKS.
Esempio 4: creazione del profilo EKS Fargate per un selettore con più namespace ed etichette, insieme IDs a sottoreti in cui lanciare un Pod
L'
create-fargate-profileesempio seguente crea un profilo EKS Fargate per un selettore con più namespace ed etichette, insieme IDs a sottoreti in cui lanciare un Pod.aws eks create-fargate-profile \ --cluster-namemy-eks-cluster\ --pod-execution-role-arnarn:aws:iam::111122223333:role/role-name\ --fargate-profile-namemy-fargate-profile\ --selectors '[{"namespace": "default1", "labels": {"labelname1": "labelvalue1", "labelname2": "labelvalue2"}}, {"namespace": "default2", "labels": {"labelname1": "labelvalue1", "labelname2": "labelvalue2"}}]' \ --subnets '["subnet-09d912bb63ef21b9a", "subnet-04ad87f71c6e5ab4d", "subnet-0e2907431c9988b72"]' \ --tags '{"eks-fargate-profile-key-1": "value-1" , "eks-fargate-profile-key-2": "value-2"}'Output:
{ "fargateProfile": { "fargateProfileName": "my-fargate-profile", "fargateProfileArn": "arn:aws:eks:us-east-2:111122223333:fargateprofile/my-eks-cluster/my-fargate-profile/4cc72bbf-b766-8ee6-8d29-e62748feb3cd", "clusterName": "my-eks-cluster", "createdAt": "2024-03-19T12:15:55.271000-04:00", "podExecutionRoleArn": "arn:aws:iam::111122223333:role/role-name", "subnets": [ "subnet-09d912bb63ef21b9a", "subnet-04ad87f71c6e5ab4d", "subnet-0e2907431c9988b72" ], "selectors": [ { "namespace": "default1", "labels": { "labelname2": "labelvalue2", "labelname1": "labelvalue1" } }, { "namespace": "default2", "labels": { "labelname2": "labelvalue2", "labelname1": "labelvalue1" } } ], "status": "CREATING", "tags": { "eks-fargate-profile-key-2": "value-2", "eks-fargate-profile-key-1": "value-1" } } }Per ulteriori informazioni, consulta Profilo AWS Fargate - Creazione di un profilo Fargate nella Guida per l'utente di Amazon EKS.
Esempio 5: creazione del profilo EKS Fargate con un selettore di caratteri jolly per namespace ed etichette, insieme IDs alle sottoreti in cui lanciare un Pod
L'
create-fargate-profileesempio seguente crea un profilo EKS Fargate per un selettore con più namespace ed etichette, insieme IDs a sottoreti in cui lanciare un Pod.aws eks create-fargate-profile \ --cluster-namemy-eks-cluster\ --pod-execution-role-arnarn:aws:iam::111122223333:role/role-name\ --fargate-profile-namemy-fargate-profile\ --selectors '[{"namespace": "prod*", "labels": {"labelname*?": "*value1"}}, {"namespace": "*dev*", "labels": {"labelname*?": "*value*"}}]' \ --subnets '["subnet-09d912bb63ef21b9a", "subnet-04ad87f71c6e5ab4d", "subnet-0e2907431c9988b72"]' \ --tags '{"eks-fargate-profile-key-1": "value-1" , "eks-fargate-profile-key-2": "value-2"}'Output:
{ "fargateProfile": { "fargateProfileName": "my-fargate-profile", "fargateProfileArn": "arn:aws:eks:us-east-2:111122223333:fargateprofile/my-eks-cluster/my-fargate-profile/e8c72bd6-5966-0bfe-b77b-1802893e5a6f", "clusterName": "my-eks-cluster", "createdAt": "2024-03-19T13:05:20.550000-04:00", "podExecutionRoleArn": "arn:aws:iam::111122223333:role/role-name", "subnets": [ "subnet-09d912bb63ef21b9a", "subnet-04ad87f71c6e5ab4d", "subnet-0e2907431c9988b72" ], "selectors": [ { "namespace": "prod*", "labels": { "labelname*?": "*value1" } }, { "namespace": "*dev*", "labels": { "labelname*?": "*value*" } } ], "status": "CREATING", "tags": { "eks-fargate-profile-key-2": "value-2", "eks-fargate-profile-key-1": "value-1" } } }Per ulteriori informazioni, consulta Profilo AWS Fargate - Creazione di un profilo Fargate nella Guida per l'utente di Amazon EKS.
-
Per i dettagli sull'API, consulta AWS CLI Command CreateFargateProfile
Reference.
-
Il seguente esempio di codice mostra come utilizzarecreate-nodegroup.
- AWS CLI
-
Esempio 1: crea un gruppo di nodi gestito per un cluster Amazon EKS
L'
create-nodegroupesempio seguente crea un gruppo di nodi gestiti per un cluster Amazon EKS.aws eks create-nodegroup \ --cluster-namemy-eks-cluster\ --nodegroup-namemy-eks-nodegroup\ --node-rolearn:aws:iam::111122223333:role/role-name\ --subnets"subnet-0e2907431c9988b72""subnet-04ad87f71c6e5ab4d""subnet-09d912bb63ef21b9a"\ --scaling-configminSize=1,maxSize=3,desiredSize=1\ --regionus-east-2Output:
{ "nodegroup": { "nodegroupName": "my-eks-nodegroup", "nodegroupArn": "arn:aws:eks:us-east-2:111122223333:nodegroup/my-eks-cluster/my-eks-nodegroup/bac7550f-b8b8-5fbb-4f3e-7502a931119e", "clusterName": "my-eks-cluster", "version": "1.26", "releaseVersion": "1.26.12-20240329", "createdAt": "2024-04-04T13:19:32.260000-04:00", "modifiedAt": "2024-04-04T13:19:32.260000-04:00", "status": "CREATING", "capacityType": "ON_DEMAND", "scalingConfig": { "minSize": 1, "maxSize": 3, "desiredSize": 1 }, "instanceTypes": [ "t3.medium" ], "subnets": [ "subnet-0e2907431c9988b72, subnet-04ad87f71c6e5ab4d, subnet-09d912bb63ef21b9a" ], "amiType": "AL2_x86_64", "nodeRole": "arn:aws:iam::111122223333:role/role-name", "diskSize": 20, "health": { "issues": [] }, "updateConfig": { "maxUnavailable": 1 }, "tags": {} } }Per ulteriori informazioni, consulta Creazione di un gruppo di nodi gestiti nella Guida per l'utente di Amazon EKS.
Esempio 2: crea un gruppo di nodi gestito per un cluster Amazon EKS con tipi di istanze e dimensioni del disco personalizzati
L'
create-nodegroupesempio seguente crea un gruppo di nodi gestiti per un cluster Amazon EKS con tipi di istanze e dimensioni del disco personalizzati.aws eks create-nodegroup \ --cluster-namemy-eks-cluster\ --nodegroup-namemy-eks-nodegroup\ --node-rolearn:aws:iam::111122223333:role/role-name\ --subnets"subnet-0e2907431c9988b72""subnet-04ad87f71c6e5ab4d""subnet-09d912bb63ef21b9a"\ --scaling-configminSize=1,maxSize=3,desiredSize=1\ --capacity-typeON_DEMAND\ --instance-types 'm5.large' \ --disk-size50\ --regionus-east-2Output:
{ "nodegroup": { "nodegroupName": "my-eks-nodegroup", "nodegroupArn": "arn:aws:eks:us-east-2:111122223333:nodegroup/my-eks-cluster/my-eks-nodegroup/c0c7551b-e4f9-73d9-992c-a450fdb82322", "clusterName": "my-eks-cluster", "version": "1.26", "releaseVersion": "1.26.12-20240329", "createdAt": "2024-04-04T13:46:07.595000-04:00", "modifiedAt": "2024-04-04T13:46:07.595000-04:00", "status": "CREATING", "capacityType": "ON_DEMAND", "scalingConfig": { "minSize": 1, "maxSize": 3, "desiredSize": 1 }, "instanceTypes": [ "m5.large" ], "subnets": [ "subnet-0e2907431c9988b72", "subnet-04ad87f71c6e5ab4d", "subnet-09d912bb63ef21b9a" ], "amiType": "AL2_x86_64", "nodeRole": "arn:aws:iam::111122223333:role/role-name", "diskSize": 50, "health": { "issues": [] }, "updateConfig": { "maxUnavailable": 1 }, "tags": {} } }Per ulteriori informazioni, consulta Creazione di un gruppo di nodi gestiti nella Guida per l'utente di Amazon EKS.
Esempio 3: crea un gruppo di nodi gestito per un cluster Amazon EKS con tipi di istanza personalizzati, dimensione del disco, tipo ami, tipo di capacità, update-config, etichette, caratteri e tag.
L'
create-nodegroupesempio seguente crea un gruppo di nodi gestito per un cluster Amazon EKS con tipi di istanza personalizzati, dimensione del disco, ami-type, capacity-type, update-config, etichette, taints e tag.aws eks create-nodegroup \ --cluster-namemy-eks-cluster\ --nodegroup-namemy-eks-nodegroup\ --node-rolearn:aws:iam::111122223333:role/role-name\ --subnets"subnet-0e2907431c9988b72""subnet-04ad87f71c6e5ab4d""subnet-09d912bb63ef21b9a"\ --scaling-configminSize=1,maxSize=5,desiredSize=4\ --instance-types 't3.large' \ --disk-size50\ --ami-typeAL2_x86_64\ --capacity-typeSPOT\ --update-configmaxUnavailable=2\ --labels '{"my-eks-nodegroup-label-1": "value-1" , "my-eks-nodegroup-label-2": "value-2"}' \ --taints '{"key": "taint-key-1" , "value": "taint-value-1", "effect": "NO_EXECUTE"}' \ --tags '{"my-eks-nodegroup-key-1": "value-1" , "my-eks-nodegroup-key-2": "value-2"}'Output:
{ "nodegroup": { "nodegroupName": "my-eks-nodegroup", "nodegroupArn": "arn:aws:eks:us-east-2:111122223333:nodegroup/my-eks-cluster/my-eks-nodegroup/88c75524-97af-0cb9-a9c5-7c0423ab5314", "clusterName": "my-eks-cluster", "version": "1.26", "releaseVersion": "1.26.12-20240329", "createdAt": "2024-04-04T14:05:07.940000-04:00", "modifiedAt": "2024-04-04T14:05:07.940000-04:00", "status": "CREATING", "capacityType": "SPOT", "scalingConfig": { "minSize": 1, "maxSize": 5, "desiredSize": 4 }, "instanceTypes": [ "t3.large" ], "subnets": [ "subnet-0e2907431c9988b72", "subnet-04ad87f71c6e5ab4d", "subnet-09d912bb63ef21b9a" ], "amiType": "AL2_x86_64", "nodeRole": "arn:aws:iam::111122223333:role/role-name", "labels": { "my-eks-nodegroup-label-2": "value-2", "my-eks-nodegroup-label-1": "value-1" }, "taints": [ { "key": "taint-key-1", "value": "taint-value-1", "effect": "NO_EXECUTE" } ], "diskSize": 50, "health": { "issues": [] }, "updateConfig": { "maxUnavailable": 2 }, "tags": { "my-eks-nodegroup-key-1": "value-1", "my-eks-nodegroup-key-2": "value-2" } } }Per ulteriori informazioni, consulta Creazione di un gruppo di nodi gestiti nella Guida per l'utente di Amazon EKS.
-
Per i dettagli sull'API, consulta CreateNodegroup AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarecreate-pod-identity-association.
- AWS CLI
-
Esempio 1: creare un'associazione EKS Pod Identity nel cluster EKS
L'
create-pod-identity-associationesempio seguente crea un'associazione EKS Pod Identity tra un account di servizio nel cluster EKS e un ruolo IAM.aws eks create-pod-identity-association \ --cluster-nameeks-customer\ --namespacedefault\ --service-accountdefault\ --role-arnarn:aws:iam::111122223333:role/my-roleOutput:
{ "association": { "clusterName": "eks-customer", "namespace": "default", "serviceAccount": "default", "roleArn": "arn:aws:iam::111122223333:role/my-role", "associationArn": "arn:aws:eks:us-west-2:111122223333:podidentityassociation/eks-customer/a-8mvwvh57cu74mgcst", "associationId": "a-8mvwvh57cu74mgcst", "tags": {}, "createdAt": "2025-05-24T19:40:13.961000-05:00", "modifiedAt": "2025-05-24T19:40:13.961000-05:00" } }Per ulteriori informazioni, consulta Scopri come EKS Pod Identity concede ai pod l'accesso ai AWS servizi nella Amazon EKS User Guide.
Esempio 2: creare un'associazione EKS Pod Identity nel cluster EKS con tag
Quanto segue
create-pod-identity-associationcrea un'associazione EKS Pod Identity tra un account di servizio e un ruolo IAM nel cluster EKS con tag.aws eks create-pod-identity-association \ --cluster-nameeks-customer\ --namespacedefault\ --service-accountdefault\ --role-arnarn:aws:iam::111122223333:role/my-role\ --tagsKey1=value1,Key2=value2Output:
{ "association": { "clusterName": "eks-customer", "namespace": "default", "serviceAccount": "default", "roleArn": "arn:aws:iam::111122223333:role/my-role", "associationArn": "arn:aws:eks:us-west-2:111122223333:podidentityassociation/eks-customer/a-9njjin9gfghecgoda", "associationId": "a-9njjin9gfghecgoda", "tags": { "Key2": "value2", "Key1": "value1" }, "createdAt": "2025-05-24T19:52:14.135000-05:00", "modifiedAt": "2025-05-24T19:52:14.135000-05:00" } }Per ulteriori informazioni, consulta Scopri come EKS Pod Identity concede ai pod l'accesso ai AWS servizi nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta AWS CLI Command CreatePodIdentityAssociation
Reference.
-
Il seguente esempio di codice mostra come utilizzaredelete-access-entry.
- AWS CLI
-
Per eliminare una voce di accesso associata al cluster
Quanto segue
delete-access-entryelimina una voce di accesso associata al cluster EKS denominatoeks-customer.aws eks delete-access-entry \ --cluster-nameeks-customer\ --principal-arnarn:aws:iam::111122223333:role/AdminQuesto comando non produce alcun output.
Per ulteriori informazioni, consulta Eliminare le voci di accesso nella Guida per l'utente di Amazon EKS.
-
Per i dettagli sull'API, consulta DeleteAccessEntry AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredelete-addon.
- AWS CLI
-
Esempio 1. Eliminare un componente aggiuntivo Amazon EKS ma conservare il software aggiuntivo nel cluster EKS
Il comando di
delete-addonesempio seguente elimina un componente aggiuntivo Amazon EKS ma conserva il software aggiuntivo sul cluster EKS.aws eks delete-addon \ --cluster-namemy-eks-cluster\ --addon-namemy-eks-addon\ --preserveOutput:
{ "addon": { "addonName": "my-eks-addon", "clusterName": "my-eks-cluster", "status": "DELETING", "addonVersion": "v1.9.3-eksbuild.7", "health": { "issues": [] }, "addonArn": "arn:aws:eks:us-east-2:111122223333:addon/my-eks-cluster/my-eks-addon/a8c71ed3-944e-898b-9167-c763856af4b8", "createdAt": "2024-03-14T11:49:09.009000-04:00", "modifiedAt": "2024-03-14T12:03:49.776000-04:00", "tags": {} } }Per ulteriori informazioni, consulta Gestione dei componenti aggiuntivi di Amazon EKS - Eliminazione di un componente aggiuntivo in Amazon EKS.
Esempio 2. Eliminare un componente aggiuntivo Amazon EKS e anche eliminare il software aggiuntivo dal cluster EKS
Il comando di
delete-addonesempio seguente elimina un componente aggiuntivo Amazon EKS ed elimina anche il software aggiuntivo dal cluster EKS.aws eks delete-addon \ --cluster-namemy-eks-cluster\ --addon-namemy-eks-addonOutput:
{ "addon": { "addonName": "my-eks-addon", "clusterName": "my-eks-cluster", "status": "DELETING", "addonVersion": "v1.15.1-eksbuild.1", "health": { "issues": [] }, "addonArn": "arn:aws:eks:us-east-2:111122223333:addon/my-eks-cluster/my-eks-addon/bac71ed1-ec43-3bb6-88ea-f243cdb58954", "createdAt": "2024-03-14T11:45:31.983000-04:00", "modifiedAt": "2024-03-14T11:58:40.136000-04:00", "serviceAccountRoleArn": "arn:aws:iam::111122223333:role/role-name", "tags": {} } }Per ulteriori informazioni, consulta Gestione dei componenti aggiuntivi di Amazon EKS - Eliminazione di un componente aggiuntivo in Amazon EKS.
-
Per i dettagli sull'API, consulta Command DeleteAddon
Reference AWS CLI .
-
Il seguente esempio di codice mostra come utilizzaredelete-cluster.
- AWS CLI
-
Eliminare un piano di controllo del cluster Amazon EKS
L'
delete-clusteresempio seguente elimina un piano di controllo del cluster Amazon EKS.aws eks delete-cluster \ --namemy-eks-clusterOutput:
{ "cluster": { "name": "my-eks-cluster", "arn": "arn:aws:eks:us-east-2:111122223333:cluster/my-eks-cluster", "createdAt": "2024-03-14T11:31:44.348000-04:00", "version": "1.27", "endpoint": "https://DALSJ343KE23J3RN45653DSKJTT647TYD.yl4.us-east-2.eks.amazonaws.com", "roleArn": "arn:aws:iam::111122223333:role/eksctl-my-eks-cluster-cluster-ServiceRole-zMF6CBakwwbW", "resourcesVpcConfig": { "subnetIds": [ "subnet-0fb75d2d8401716e7", "subnet-02184492f67a3d0f9", "subnet-04098063527aab776", "subnet-0e2907431c9988b72", "subnet-04ad87f71c6e5ab4d", "subnet-09d912bb63ef21b9a" ], "securityGroupIds": [ "sg-0c1327f6270afbb36" ], "clusterSecurityGroupId": "sg-01c84d09d70f39a7f", "vpcId": "vpc-0012b8e1cc0abb17d", "endpointPublicAccess": true, "endpointPrivateAccess": true, "publicAccessCidrs": [ "0.0.0.0/0" ] }, "kubernetesNetworkConfig": { "serviceIpv4Cidr": "10.100.0.0/16", "ipFamily": "ipv4" }, "logging": { "clusterLogging": [ { "types": [ "api", "audit", "authenticator", "controllerManager", "scheduler" ], "enabled": true } ] }, "identity": { "oidc": { "issuer": "https://oidc.eks.us-east-2.amazonaws.com/id/DALSJ343KE23J3RN45653DSKJTT647TYD" } }, "status": "DELETING", "certificateAuthority": { "data": "XXX_CA_DATA_XXX" }, "platformVersion": "eks.16", "tags": { "aws:cloudformation:stack-name": "eksctl-my-eks-cluster-cluster", "alpha.eksctl.io/cluster-name": "my-eks-cluster", "karpenter.sh/discovery": "my-eks-cluster", "aws:cloudformation:stack-id": "arn:aws:cloudformation:us-east-2:111122223333:stack/eksctl-my-eks-cluster-cluster/e752ea00-e217-11ee-beae-0a9599c8c7ed", "auto-delete": "no", "eksctl.cluster.k8s.io/v1alpha1/cluster-name": "my-eks-cluster", "EKS-Cluster-Name": "my-eks-cluster", "alpha.eksctl.io/cluster-oidc-enabled": "true", "aws:cloudformation:logical-id": "ControlPlane", "alpha.eksctl.io/eksctl-version": "0.173.0-dev+a7ee89342.2024-03-01T03:40:57Z", "Name": "eksctl-my-eks-cluster-cluster/ControlPlane" }, "accessConfig": { "authenticationMode": "API_AND_CONFIG_MAP" } } }Per ulteriori informazioni, consulta Eliminazione di un cluster Amazon EKS nella Guida per l'utente di Amazon EKS.
-
Per i dettagli sull'API, consulta DeleteCluster AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredelete-fargate-profile.
- AWS CLI
-
Esempio 1: creazione del profilo EKS Fargate per un selettore con un namespace
L'
delete-fargate-profileesempio seguente crea un profilo EKS Fargate per un selettore con un namespace.aws eks delete-fargate-profile \ --cluster-namemy-eks-cluster\ --fargate-profile-namemy-fargate-profileOutput:
{ "fargateProfile": { "fargateProfileName": "my-fargate-profile", "fargateProfileArn": "arn:aws:eks:us-east-2:111122223333:fargateprofile/my-eks-cluster/my-fargate-profile/1ac72bb3-3fc6-2631-f1e1-98bff53bed62", "clusterName": "my-eks-cluster", "createdAt": "2024-03-19T11:48:39.975000-04:00", "podExecutionRoleArn": "arn:aws:iam::111122223333:role/role-name", "subnets": [ "subnet-09d912bb63ef21b9a", "subnet-04ad87f71c6e5ab4d", "subnet-0e2907431c9988b72" ], "selectors": [ { "namespace": "default", "labels": { "foo": "bar" } } ], "status": "DELETING", "tags": {} } }Per ulteriori informazioni, consulta Profilo AWS Fargate - Eliminazione di un Fargate nella Guida per l'utente di Amazon EKS.
-
Per i dettagli sull'API, consulta Command DeleteFargateProfile
Reference AWS CLI .
-
Il seguente esempio di codice mostra come utilizzaredelete-nodegroup.
- AWS CLI
-
Esempio 1: eliminare un gruppo di nodi gestito per un cluster Amazon EKS
L'
delete-nodegroupesempio seguente elimina un gruppo di nodi gestiti per un cluster Amazon EKS.aws eks delete-nodegroup \ --cluster-namemy-eks-cluster\ --nodegroup-namemy-eks-nodegroupOutput:
{ "nodegroup": { "nodegroupName": "my-eks-nodegroup", "nodegroupArn": "arn:aws:eks:us-east-2:111122223333:nodegroup/my-eks-cluster/my-eks-nodegroup/1ec75f5f-0e21-dcc0-b46e-f9c442685cd8", "clusterName": "my-eks-cluster", "version": "1.26", "releaseVersion": "1.26.12-20240329", "createdAt": "2024-04-08T13:25:15.033000-04:00", "modifiedAt": "2024-04-08T13:25:31.252000-04:00", "status": "DELETING", "capacityType": "SPOT", "scalingConfig": { "minSize": 1, "maxSize": 5, "desiredSize": 4 }, "instanceTypes": [ "t3.large" ], "subnets": [ "subnet-0e2907431c9988b72", "subnet-04ad87f71c6e5ab4d", "subnet-09d912bb63ef21b9a" ], "amiType": "AL2_x86_64", "nodeRole": "arn:aws:iam::111122223333:role/role-name", "labels": { "my-eks-nodegroup-label-2": "value-2", "my-eks-nodegroup-label-1": "value-1" }, "taints": [ { "key": "taint-key-1", "value": "taint-value-1", "effect": "NO_EXECUTE" } ], "diskSize": 50, "health": { "issues": [] }, "updateConfig": { "maxUnavailable": 2 }, "tags": { "my-eks-nodegroup-key-1": "value-1", "my-eks-nodegroup-key-2": "value-2" } } }-
Per i dettagli sull'API, consulta DeleteNodegroup AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredelete-pod-identity-association.
- AWS CLI
-
Per eliminare l'associazione EKS Pod Identity
L'
delete-pod-identity-associationesempio seguente elimina l'associazione EKS Pod Identity con l'ID dell'associazionea-9njjin9gfghecgocddal cluster EKS denominatoeks-customer.aws eks delete-pod-identity-association \ --cluster-nameeks-customer\ --association-ida-9njjin9gfghecgocdOutput:
{ "association": { "clusterName": "eks-customer", "namespace": "default", "serviceAccount": "default", "roleArn": "arn:aws:iam::111122223333:role/s3-role", "associationArn": "arn:aws:eks:us-west-2:111122223333:podidentityassociation/eks-customer/a-9njjin9gfghecgocd", "associationId": "a-9njjin9gfghecgocd", "tags": { "Key2": "value2", "Key1": "value1" }, "createdAt": "2025-05-24T19:52:14.135000-05:00", "modifiedAt": "2025-05-25T21:10:56.923000-05:00" } }Per ulteriori informazioni, consulta Scopri come EKS Pod Identity concede ai pod l'accesso ai AWS servizi nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta AWS CLI Command DeletePodIdentityAssociation
Reference.
-
Il seguente esempio di codice mostra come utilizzarederegister-cluster.
- AWS CLI
-
Annullare la registrazione di un cluster connesso per rimuoverlo dal piano di controllo di Amazon EKS
L'
deregister-clusteresempio seguente annulla la registrazione di un cluster connesso per rimuoverlo dal piano di controllo di Amazon EKS.aws eks deregister-cluster \ --namemy-eks-anywhere-clusterOutput:
{ "cluster": { "name": "my-eks-anywhere-cluster", "arn": "arn:aws:eks:us-east-2:111122223333:cluster/my-eks-anywhere-cluster", "createdAt": "2024-04-12T12:38:37.561000-04:00", "status": "DELETING", "tags": {}, "connectorConfig": { "activationId": "dfb5ad28-13c3-4e26-8a19-5b2457638c74", "activationExpiry": "2024-04-15T12:38:37.082000-04:00", "provider": "EKS_ANYWHERE", "roleArn": "arn:aws:iam::111122223333:role/AmazonEKSConnectorAgentRole" } } }Per ulteriori informazioni, consulta Annullamento della registrazione di un cluster nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta AWS CLI Command DeregisterCluster
Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-access-entry.
- AWS CLI
-
Per descrivere la voce di accesso per il cluster EKS
L'
describe-access-entryesempio seguente descrive una voce di accesso per il cluster EKS.aws eks describe-access-entry \ --cluster-nameeks-customer\ --principal-arnarn:aws:iam::111122223333:user/eks-admin-userOutput:
{ "accessEntry": { "clusterName": "eks-customer", "principalArn": "arn:aws:iam::111122223333:user/eks-admin-user", "kubernetesGroups": [], "accessEntryArn": "arn:aws:eks:us-west-2:111122223333:access-entry/eks-customer/user/111122223333/eks-admin-user/0acb1bc6-cb0a-ede6-11ae-a6506e3d36p0", "createdAt": "2025-04-14T22:45:48.097000-05:00", "modifiedAt": "2025-04-14T22:45:48.097000-05:00", "tags": {}, "username": "arn:aws:iam::111122223333:user/eks-admin-user", "type": "STANDARD" } }Per ulteriori informazioni, consulta Concedere agli utenti IAM l'accesso a Kubernetes con le voci di accesso EKS nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta Command DescribeAccessEntry
Reference AWS CLI .
-
Il seguente esempio di codice mostra come utilizzaredescribe-addon-configuration.
- AWS CLI
-
Esempio 1: opzioni di configurazione disponibili durante la creazione o l'aggiornamento di Amazon vpc-cni AddOns
L'
describe-addon-configurationesempio seguente restituisce tutti gli schemi di configurazione disponibili che usi quando un componente aggiuntivo viene creato o aggiornato per il componente aggiuntivo vpc-cni con la rispettiva versione.aws eks describe-addon-configuration \ --addon-namevpc-cni\ --addon-versionv1.15.1-eksbuild.1Output:
{ "addonName": "vpc-cni", "addonVersion": "v1.15.1-eksbuild.1", "configurationSchema": "{\"$ref\":\"#/definitions/VpcCni\",\"$schema\":\"http://json-schema.org/draft-06/schema#\",\"definitions\":{\"Affinity\":{\"type\":[\"object\",\"null\"]},\"EniConfig\":{\"additionalProperties\":false,\"properties\":{\"create\":{\"type\":\"boolean\"},\"region\":{\"type\":\"string\"},\"subnets\":{\"additionalProperties\":{\"additionalProperties\":false,\"properties\":{\"id\":{\"type\":\"string\"},\"securityGroups\":{\"items\":{\"type\":\"string\"},\"type\":\"array\"}},\"required\":[\"id\"],\"type\":\"object\"},\"minProperties\":1,\"type\":\"object\"}},\"required\":[\"create\",\"region\",\"subnets\"],\"type\":\"object\"},\"Env\":{\"additionalProperties\":false,\"properties\":{\"ADDITIONAL_ENI_TAGS\":{\"type\":\"string\"},\"ANNOTATE_POD_IP\":{\"format\":\"boolean\",\"type\":\"string\"},\"AWS_EC2_ENDPOINT\":{\"type\":\"string\"},\"AWS_EXTERNAL_SERVICE_CIDRS\":{\"type\":\"string\"},\"AWS_MANAGE_ENIS_NON_SCHEDULABLE\":{\"format\":\"boolean\",\"type\":\"string\"},\"AWS_VPC_CNI_NODE_PORT_SUPPORT\":{\"format\":\"boolean\",\"type\":\"string\"},\"AWS_VPC_ENI_MTU\":{\"format\":\"integer\",\"type\":\"string\"},\"AWS_VPC_K8S_CNI_CUSTOM_NETWORK_CFG\":{\"format\":\"boolean\",\"type\":\"string\"},\"AWS_VPC_K8S_CNI_EXCLUDE_SNAT_CIDRS\":{\"type\":\"string\"},\"AWS_VPC_K8S_CNI_EXTERNALSNAT\":{\"format\":\"boolean\",\"type\":\"string\"},\"AWS_VPC_K8S_CNI_LOGLEVEL\":{\"type\":\"string\"},\"AWS_VPC_K8S_CNI_LOG_FILE\":{\"type\":\"string\"},\"AWS_VPC_K8S_CNI_RANDOMIZESNAT\":{\"type\":\"string\"},\"AWS_VPC_K8S_CNI_VETHPREFIX\":{\"type\":\"string\"},\"AWS_VPC_K8S_PLUGIN_LOG_FILE\":{\"type\":\"string\"},\"AWS_VPC_K8S_PLUGIN_LOG_LEVEL\":{\"type\":\"string\"},\"CLUSTER_ENDPOINT\":{\"type\":\"string\"},\"DISABLE_INTROSPECTION\":{\"format\":\"boolean\",\"type\":\"string\"},\"DISABLE_LEAKED_ENI_CLEANUP\":{\"format\":\"boolean\",\"type\":\"string\"},\"DISABLE_METRICS\":{\"format\":\"boolean\",\"type\":\"string\"},\"DISABLE_NETWORK_RESOURCE_PROVISIONING\":{\"format\":\"boolean\",\"type\":\"string\"},\"DISABLE_POD_V6\":{\"format\":\"boolean\",\"type\":\"string\"},\"ENABLE_BANDWIDTH_PLUGIN\":{\"format\":\"boolean\",\"type\":\"string\"},\"ENABLE_POD_ENI\":{\"format\":\"boolean\",\"type\":\"string\"},\"ENABLE_PREFIX_DELEGATION\":{\"format\":\"boolean\",\"type\":\"string\"},\"ENABLE_V4_EGRESS\":{\"format\":\"boolean\",\"type\":\"string\"},\"ENABLE_V6_EGRESS\":{\"format\":\"boolean\",\"type\":\"string\"},\"ENI_CONFIG_ANNOTATION_DEF\":{\"type\":\"string\"},\"ENI_CONFIG_LABEL_DEF\":{\"type\":\"string\"},\"INTROSPECTION_BIND_ADDRESS\":{\"type\":\"string\"},\"IP_COOLDOWN_PERIOD\":{\"format\":\"integer\",\"type\":\"string\"},\"MAX_ENI\":{\"format\":\"integer\",\"type\":\"string\"},\"MINIMUM_IP_TARGET\":{\"format\":\"integer\",\"type\":\"string\"},\"POD_SECURITY_GROUP_ENFORCING_MODE\":{\"type\":\"string\"},\"WARM_ENI_TARGET\":{\"format\":\"integer\",\"type\":\"string\"},\"WARM_IP_TARGET\":{\"format\":\"integer\",\"type\":\"string\"},\"WARM_PREFIX_TARGET\":{\"format\":\"integer\",\"type\":\"string\"}},\"title\":\"Env\",\"type\":\"object\"},\"Init\":{\"additionalProperties\":false,\"properties\":{\"env\":{\"$ref\":\"#/definitions/InitEnv\"}},\"title\":\"Init\",\"type\":\"object\"},\"InitEnv\":{\"additionalProperties\":false,\"properties\":{\"DISABLE_TCP_EARLY_DEMUX\":{\"format\":\"boolean\",\"type\":\"string\"},\"ENABLE_V6_EGRESS\":{\"format\":\"boolean\",\"type\":\"string\"}},\"title\":\"InitEnv\",\"type\":\"object\"},\"Limits\":{\"additionalProperties\":false,\"properties\":{\"cpu\":{\"type\":\"string\"},\"memory\":{\"type\":\"string\"}},\"title\":\"Limits\",\"type\":\"object\"},\"NodeAgent\":{\"additionalProperties\":false,\"properties\":{\"enableCloudWatchLogs\":{\"format\":\"boolean\",\"type\":\"string\"},\"enablePolicyEventLogs\":{\"format\":\"boolean\",\"type\":\"string\"},\"healthProbeBindAddr\":{\"format\":\"integer\",\"type\":\"string\"},\"metricsBindAddr\":{\"format\":\"integer\",\"type\":\"string\"}},\"title\":\"NodeAgent\",\"type\":\"object\"},\"Resources\":{\"additionalProperties\":false,\"properties\":{\"limits\":{\"$ref\":\"#/definitions/Limits\"},\"requests\":{\"$ref\":\"#/definitions/Limits\"}},\"title\":\"Resources\",\"type\":\"object\"},\"Tolerations\":{\"additionalProperties\":false,\"items\":{\"type\":\"object\"},\"type\":\"array\"},\"VpcCni\":{\"additionalProperties\":false,\"properties\":{\"affinity\":{\"$ref\":\"#/definitions/Affinity\"},\"enableNetworkPolicy\":{\"format\":\"boolean\",\"type\":\"string\"},\"enableWindowsIpam\":{\"format\":\"boolean\",\"type\":\"string\"},\"eniConfig\":{\"$ref\":\"#/definitions/EniConfig\"},\"env\":{\"$ref\":\"#/definitions/Env\"},\"init\":{\"$ref\":\"#/definitions/Init\"},\"livenessProbeTimeoutSeconds\":{\"type\":\"integer\"},\"nodeAgent\":{\"$ref\":\"#/definitions/NodeAgent\"},\"readinessProbeTimeoutSeconds\":{\"type\":\"integer\"},\"resources\":{\"$ref\":\"#/definitions/Resources\"},\"tolerations\":{\"$ref\":\"#/definitions/Tolerations\"}},\"title\":\"VpcCni\",\"type\":\"object\"}},\"description\":\"vpc-cni\"}" }Esempio 2: opzioni di configurazione disponibili durante la creazione o l'aggiornamento di Amazon cordns AddOns
L'
describe-addon-configurationesempio seguente restituisce tutto lo schema di configurazione disponibile che usi quando un componente aggiuntivo viene creato o aggiornato per il componente aggiuntivo coredns con la rispettiva versione.aws eks describe-addon-configuration \ --addon-namecoredns\ --addon-versionv1.8.7-eksbuild.4Output:
{ "addonName": "coredns", "addonVersion": "v1.8.7-eksbuild.4", "configurationSchema": "{\"$ref\":\"#/definitions/Coredns\",\"$schema\":\"http://json-schema.org/draft-06/schema#\",\"definitions\":{\"Coredns\":{\"additionalProperties\":false,\"properties\":{\"computeType\":{\"type\":\"string\"},\"corefile\":{\"description\":\"Entire corefile contents to use with installation\",\"type\":\"string\"},\"nodeSelector\":{\"additionalProperties\":{\"type\":\"string\"},\"type\":\"object\"},\"replicaCount\":{\"type\":\"integer\"},\"resources\":{\"$ref\":\"#/definitions/Resources\"}},\"title\":\"Coredns\",\"type\":\"object\"},\"Limits\":{\"additionalProperties\":false,\"properties\":{\"cpu\":{\"type\":\"string\"},\"memory\":{\"type\":\"string\"}},\"title\":\"Limits\",\"type\":\"object\"},\"Resources\":{\"additionalProperties\":false,\"properties\":{\"limits\":{\"$ref\":\"#/definitions/Limits\"},\"requests\":{\"$ref\":\"#/definitions/Limits\"}},\"title\":\"Resources\",\"type\":\"object\"}}}" }Per ulteriori informazioni, consulta Creazione o aggiornamento di un file kubeconfig per un cluster Amazon EKS in Amazon EKS.
-
Per i dettagli sull'API, consulta Command DescribeAddonConfiguration
Reference AWS CLI .
-
Il seguente esempio di codice mostra come utilizzaredescribe-addon-versions.
- AWS CLI
-
Esempio 1: Elenca tutti i componenti aggiuntivi disponibili per EKS Cluster
L'
describe-addon-versionsesempio seguente elenca tutti i componenti aggiuntivi disponibili. AWSaws eks describe-addon-versions \ --query 'sort_by(addons &owner)[].{publisher: publisher, owner: owner, addonName: addonName, type: type}' \ --outputtableOutput:
-------------------------------------------------------------------------------------------------------------------- | DescribeAddonVersions | +---------------------------------------------+------------------+-----------------------+-------------------------+ | addonName | owner | publisher | type | +---------------------------------------------+------------------+-----------------------+-------------------------+ | vpc-cni | aws | eks | networking | | snapshot-controller | aws | eks | storage | | kube-proxy | aws | eks | networking | | eks-pod-identity-agent | aws | eks | security | | coredns | aws | eks | networking | | aws-mountpoint-s3-csi-driver | aws | s3 | storage | | aws-guardduty-agent | aws | eks | security | | aws-efs-csi-driver | aws | eks | storage | | aws-ebs-csi-driver | aws | eks | storage | | amazon-cloudwatch-observability | aws | eks | observability | | adot | aws | eks | observability | | upwind-security_upwind-operator | aws-marketplace | Upwind Security | security | | upbound_universal-crossplane | aws-marketplace | upbound | infra-management | | tetrate-io_istio-distro | aws-marketplace | tetrate-io | policy-management | | teleport_teleport | aws-marketplace | teleport | policy-management | | stormforge_optimize-live | aws-marketplace | StormForge | cost-management | | splunk_splunk-otel-collector-chart | aws-marketplace | Splunk | monitoring | | solo-io_istio-distro | aws-marketplace | Solo.io | service-mesh | | rafay-systems_rafay-operator | aws-marketplace | rafay-systems | kubernetes-management | | new-relic_kubernetes-operator | aws-marketplace | New Relic | observability | | netapp_trident-operator | aws-marketplace | NetApp Inc. | storage | | leaksignal_leakagent | aws-marketplace | leaksignal | monitoring | | kubecost_kubecost | aws-marketplace | kubecost | cost-management | | kong_konnect-ri | aws-marketplace | kong | ingress-service-type | | kasten_k10 | aws-marketplace | Kasten by Veeam | data-protection | | haproxy-technologies_kubernetes-ingress-ee | aws-marketplace | HAProxy Technologies | ingress-controller | | groundcover_agent | aws-marketplace | groundcover | monitoring | | grafana-labs_kubernetes-monitoring | aws-marketplace | Grafana Labs | monitoring | | factorhouse_kpow | aws-marketplace | factorhouse | monitoring | | dynatrace_dynatrace-operator | aws-marketplace | dynatrace | monitoring | | datree_engine-pro | aws-marketplace | datree | policy-management | | datadog_operator | aws-marketplace | Datadog | monitoring | | cribl_cribledge | aws-marketplace | Cribl | observability | | calyptia_fluent-bit | aws-marketplace | Calyptia Inc | observability | | accuknox_kubearmor | aws-marketplace | AccuKnox | security | +---------------------------------------------+------------------+-----------------------+-------------------------+Per ulteriori informazioni, consulta Managing Amazon EKS add-ons - Creating an add-on nella Amazon EKS User Guide.
Esempio 2: elenca tutti i componenti aggiuntivi disponibili per la versione di Kubernetes specificata supportata per EKS
L'
describe-addon-versionsesempio seguente elenca tutti i componenti aggiuntivi disponibili per la versione di Kubernetes specificata supportata per EKS.aws eks describe-addon-versions \ --kubernetes-version=1.26 \ --query 'sort_by(addons &owner)[].{publisher: publisher, owner: owner, addonName: addonName, type: type}' \ --outputtableOutput:
-------------------------------------------------------------------------------------------------------------------- | DescribeAddonVersions | +---------------------------------------------+------------------+-----------------------+-------------------------+ | addonName | owner | publisher | type | +---------------------------------------------+------------------+-----------------------+-------------------------+ | vpc-cni | aws | eks | networking | | snapshot-controller | aws | eks | storage | | kube-proxy | aws | eks | networking | | eks-pod-identity-agent | aws | eks | security | | coredns | aws | eks | networking | | aws-mountpoint-s3-csi-driver | aws | s3 | storage | | aws-guardduty-agent | aws | eks | security | | aws-efs-csi-driver | aws | eks | storage | | aws-ebs-csi-driver | aws | eks | storage | | amazon-cloudwatch-observability | aws | eks | observability | | adot | aws | eks | observability | | upwind-security_upwind-operator | aws-marketplace | Upwind Security | security | | tetrate-io_istio-distro | aws-marketplace | tetrate-io | policy-management | | stormforge_optimize-live | aws-marketplace | StormForge | cost-management | | splunk_splunk-otel-collector-chart | aws-marketplace | Splunk | monitoring | | solo-io_istio-distro | aws-marketplace | Solo.io | service-mesh | | rafay-systems_rafay-operator | aws-marketplace | rafay-systems | kubernetes-management | | new-relic_kubernetes-operator | aws-marketplace | New Relic | observability | | netapp_trident-operator | aws-marketplace | NetApp Inc. | storage | | leaksignal_leakagent | aws-marketplace | leaksignal | monitoring | | kubecost_kubecost | aws-marketplace | kubecost | cost-management | | kong_konnect-ri | aws-marketplace | kong | ingress-service-type | | haproxy-technologies_kubernetes-ingress-ee | aws-marketplace | HAProxy Technologies | ingress-controller | | groundcover_agent | aws-marketplace | groundcover | monitoring | | grafana-labs_kubernetes-monitoring | aws-marketplace | Grafana Labs | monitoring | | dynatrace_dynatrace-operator | aws-marketplace | dynatrace | monitoring | | datadog_operator | aws-marketplace | Datadog | monitoring | | cribl_cribledge | aws-marketplace | Cribl | observability | | calyptia_fluent-bit | aws-marketplace | Calyptia Inc | observability | | accuknox_kubearmor | aws-marketplace | AccuKnox | security | +---------------------------------------------+------------------+-----------------------+-------------------------+Per ulteriori informazioni, consulta Managing Amazon EKS add-ons - Creating an add-on nella Amazon EKS User Guide.
Esempio 3: elenca tutte le versioni dei componenti aggiuntivi vpc-cni disponibili per la versione di Kubernetes specificata supportata per EKS
L'
describe-addon-versionsesempio seguente elenca tutte le versioni dei componenti aggiuntivi vpc-cni disponibili per la versione di Kubernetes specificata supportata per EKS.aws eks describe-addon-versions \ --kubernetes-version=1.26 \ --addon-name=vpc-cni \ --query='addons[].addonVersions[].addonVersion'Output:
[ "v1.18.0-eksbuild.1", "v1.17.1-eksbuild.1", "v1.16.4-eksbuild.2", "v1.16.3-eksbuild.2", "v1.16.2-eksbuild.1", "v1.16.0-eksbuild.1", "v1.15.5-eksbuild.1", "v1.15.4-eksbuild.1", "v1.15.3-eksbuild.1", "v1.15.1-eksbuild.1", "v1.15.0-eksbuild.2", "v1.14.1-eksbuild.1", "v1.14.0-eksbuild.3", "v1.13.4-eksbuild.1", "v1.13.3-eksbuild.1", "v1.13.2-eksbuild.1", "v1.13.0-eksbuild.1", "v1.12.6-eksbuild.2", "v1.12.6-eksbuild.1", "v1.12.5-eksbuild.2", "v1.12.0-eksbuild.2" ]Per ulteriori informazioni, consulta Managing Amazon EKS add-ons - Creating an add-on nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta AWS CLI Command DescribeAddonVersions
Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-addon.
- AWS CLI
-
Descrivi l'esecuzione attiva del componente aggiuntivo EKS nel tuo cluster Amazon EKS
L'
describe-addonesempio seguente esegue attivamente l'addon EKS nel tuo cluster Amazon EKS.aws eks describe-addon \ --cluster-namemy-eks-cluster\ --addon-namevpc-cniOutput:
{ "addon": { "addonName": "vpc-cni", "clusterName": "my-eks-cluster", "status": "ACTIVE", "addonVersion": "v1.16.4-eksbuild.2", "health": { "issues": [] }, "addonArn": "arn:aws:eks:us-east-2:111122223333:addon/my-eks-cluster/vpc-cni/0ec71efc-98dd-3203-60b0-4b939b2a5e5f", "createdAt": "2024-03-14T13:18:45.417000-04:00", "modifiedAt": "2024-03-14T13:18:49.557000-04:00", "serviceAccountRoleArn": "arn:aws:iam::111122223333:role/eksctl-my-eks-cluster-addon-vpc-cni-Role1-YfakrqOC1UTm", "tags": { "eks-addon-key-3": "value-3", "eks-addon-key-4": "value-4" }, "configurationValues": "resources:\n limits:\n cpu: '100m'\nenv:\n AWS_VPC_K8S_CNI_LOGLEVEL: 'DEBUG'" } }-
Per i dettagli sull'API, consulta DescribeAddon AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-cluster.
- AWS CLI
-
Descrivi l'esecuzione attiva del componente aggiuntivo EKS nel tuo cluster Amazon EKS
L'
describe-clusteresempio seguente esegue attivamente l'addon EKS nel tuo cluster Amazon EKS.aws eks describe-cluster \ --namemy-eks-clusterOutput:
{ "cluster": { "name": "my-eks-cluster", "arn": "arn:aws:eks:us-east-2:111122223333:cluster/my-eks-cluster", "createdAt": "2024-03-14T11:31:44.348000-04:00", "version": "1.26", "endpoint": "https://JSA79429HJDASKJDJ8223829MNDNASW.yl4.us-east-2.eks.amazonaws.com", "roleArn": "arn:aws:iam::111122223333:role/eksctl-my-eks-cluster-cluster-ServiceRole-zMF6CBakwwbW", "resourcesVpcConfig": { "subnetIds": [ "subnet-0fb75d2d8401716e7", "subnet-02184492f67a3d0f9", "subnet-04098063527aab776", "subnet-0e2907431c9988b72", "subnet-04ad87f71c6e5ab4d", "subnet-09d912bb63ef21b9a" ], "securityGroupIds": [ "sg-0c1327f6270afbb36" ], "clusterSecurityGroupId": "sg-01c84d09d70f39a7f", "vpcId": "vpc-0012b8e1cc0abb17d", "endpointPublicAccess": true, "endpointPrivateAccess": true, "publicAccessCidrs": [ "22.19.18.2/32" ] }, "kubernetesNetworkConfig": { "serviceIpv4Cidr": "10.100.0.0/16", "ipFamily": "ipv4" }, "logging": { "clusterLogging": [ { "types": [ "api", "audit", "authenticator", "controllerManager", "scheduler" ], "enabled": true } ] }, "identity": { "oidc": { "issuer": "https://oidc.eks.us-east-2.amazonaws.com/id/JSA79429HJDASKJDJ8223829MNDNASW" } }, "status": "ACTIVE", "certificateAuthority": { "data": "CA_DATA_STRING..." }, "platformVersion": "eks.14", "tags": { "aws:cloudformation:stack-name": "eksctl-my-eks-cluster-cluster", "alpha.eksctl.io/cluster-name": "my-eks-cluster", "karpenter.sh/discovery": "my-eks-cluster", "aws:cloudformation:stack-id": "arn:aws:cloudformation:us-east-2:111122223333:stack/eksctl-my-eks-cluster-cluster/e752ea00-e217-11ee-beae-0a9599c8c7ed", "auto-delete": "no", "eksctl.cluster.k8s.io/v1alpha1/cluster-name": "my-eks-cluster", "EKS-Cluster-Name": "my-eks-cluster", "alpha.eksctl.io/cluster-oidc-enabled": "true", "aws:cloudformation:logical-id": "ControlPlane", "alpha.eksctl.io/eksctl-version": "0.173.0-dev+a7ee89342.2024-03-01T03:40:57Z", "Name": "eksctl-my-eks-cluster-cluster/ControlPlane" }, "health": { "issues": [] }, "accessConfig": { "authenticationMode": "API_AND_CONFIG_MAP" } } }-
Per i dettagli sull'API, consulta DescribeCluster AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-fargate-profile.
- AWS CLI
-
Descrivi un profilo Fargate
L'
describe-fargate-profileesempio seguente descrive un profilo Fargate.aws eks describe-fargate-profile \ --cluster-namemy-eks-cluster\ --fargate-profile-namemy-fargate-profileOutput:
{ "fargateProfile": { "fargateProfileName": "my-fargate-profile", "fargateProfileArn": "arn:aws:eks:us-east-2:111122223333:fargateprofile/my-eks-cluster/my-fargate-profile/96c766ce-43d2-f9c9-954c-647334391198", "clusterName": "my-eks-cluster", "createdAt": "2024-04-11T10:42:52.486000-04:00", "podExecutionRoleArn": "arn:aws:iam::111122223333:role/eksctl-my-eks-cluster-farga-FargatePodExecutionRole-1htfAaJdJUEO", "subnets": [ "subnet-09d912bb63ef21b9a", "subnet-04ad87f71c6e5ab4d", "subnet-0e2907431c9988b72" ], "selectors": [ { "namespace": "prod*", "labels": { "labelname*?": "*value1" } }, { "namespace": "*dev*", "labels": { "labelname*?": "*value*" } } ], "status": "ACTIVE", "tags": { "eks-fargate-profile-key-2": "value-2", "eks-fargate-profile-key-1": "value-1" } } }-
Per i dettagli sull'API, consultate DescribeFargateProfile AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-identity-provider-config.
- AWS CLI
-
Descrivi una configurazione di provider di identità associata al tuo cluster Amazon EKS
L'
describe-identity-provider-configesempio seguente descrive una configurazione di provider di identità associata al tuo cluster Amazon EKS.aws eks describe-identity-provider-config \ --cluster-namemy-eks-cluster\ --identity-provider-configtype=oidc,name=my-identity-providerOutput:
{ "identityProviderConfig": { "oidc": { "identityProviderConfigName": "my-identity-provider", "identityProviderConfigArn": "arn:aws:eks:us-east-2:111122223333:identityproviderconfig/my-eks-cluster/oidc/my-identity-provider/8ac76722-78e4-cec1-ed76-d49eea058622", "clusterName": "my-eks-cluster", "issuerUrl": "https://oidc.eks.us-east-2.amazonaws.com/id/38D6A4619A0A69E342B113ED7F1A7652", "clientId": "kubernetes", "usernameClaim": "email", "usernamePrefix": "my-username-prefix", "groupsClaim": "my-claim", "groupsPrefix": "my-groups-prefix", "requiredClaims": { "Claim1": "value1", "Claim2": "value2" }, "tags": { "env": "dev" }, "status": "ACTIVE" } } }Per ulteriori informazioni, consulta Autenticare gli utenti del cluster da un provider di identità OpenID Connect nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta AWS CLI Command DescribeIdentityProviderConfig
Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-insight.
- AWS CLI
-
Per ottenere i dettagli di un'analisi per un cluster EKS utilizzando il relativo ID
L'
describe-insightesempio seguente restituisce i dettagli sull'analisi specificata utilizzando il nome del cluster e l'ID di analisi.aws eks describe-insight \ --cluster-nameeks-customer\ --id38ea7a64-a14f-4e0e-95c7-8dbcab3c3623Output:
{ "insight": { "id": "38ea7a64-a14f-4e0e-95c7-8dbcab3c3623", "name": "Kubelet version skew", "category": "UPGRADE_READINESS", "kubernetesVersion": "1.33", "lastRefreshTime": "2025-05-24T11:22:50-05:00", "lastTransitionTime": "2025-05-24T11:22:50-05:00", "description": "Checks for kubelet versions of worker nodes in the cluster to see if upgrade would cause noncompliance with supported Kubernetes kubelet version skew policy.", "insightStatus": { "status": "PASSING", "reason": "Node kubelet versions match the cluster control plane version." }, "recommendation": "Upgrade your worker nodes to match the Kubernetes version of your cluster control plane.", "additionalInfo": { "Kubelet version skew policy": "https://kubernetes.io/releases/version-skew-policy/#kubelet", "Updating a managed node group": "https://docs.aws.amazon.com/eks/latest/userguide/update-managed-node-group.html" }, "resources": [], "categorySpecificSummary": { "deprecationDetails": [] } } }Per ulteriori informazioni, consulta Visualizza le informazioni sui cluster nella Guida per l'utente di Amazon EKS.
-
Per i dettagli sull'API, consulta DescribeInsight AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-nodegroup.
- AWS CLI
-
Descrivi un gruppo di nodi gestito per un cluster Amazon EKS
L'
describe-nodegroupesempio seguente descrive un gruppo di nodi gestito per un cluster Amazon EKS.aws eks describe-nodegroup \ --cluster-namemy-eks-cluster\ --nodegroup-namemy-eks-nodegroupOutput:
{ "nodegroup": { "nodegroupName": "my-eks-nodegroup", "nodegroupArn": "arn:aws:eks:us-east-2:111122223333:nodegroup/my-eks-cluster/my-eks-nodegroup/a8c75f2f-df78-a72f-4063-4b69af3de5b1", "clusterName": "my-eks-cluster", "version": "1.26", "releaseVersion": "1.26.12-20240329", "createdAt": "2024-04-08T11:42:10.555000-04:00", "modifiedAt": "2024-04-08T11:44:12.402000-04:00", "status": "ACTIVE", "capacityType": "ON_DEMAND", "scalingConfig": { "minSize": 1, "maxSize": 3, "desiredSize": 1 }, "instanceTypes": [ "t3.medium" ], "subnets": [ "subnet-0e2907431c9988b72", "subnet-04ad87f71c6e5ab4d", "subnet-09d912bb63ef21b9a" ], "amiType": "AL2_x86_64", "nodeRole": "arn:aws:iam::111122223333:role/role-name", "labels": {}, "resources": { "autoScalingGroups": [ { "name": "eks-my-eks-nodegroup-a8c75f2f-df78-a72f-4063-4b69af3de5b1" } ] }, "diskSize": 20, "health": { "issues": [] }, "updateConfig": { "maxUnavailable": 1 }, "tags": {} } }-
Per i dettagli sull'API, consulta DescribeNodegroup AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-pod-identity-association.
- AWS CLI
-
Per fornire i dettagli sull'associazione Pod Identity
L'
describe-pod-identity-associationesempio seguente descrive un'associazione Pod Identity nel cluster EKS.aws eks describe-pod-identity-association \ --cluster-nameeks-customer\ --association-ida-9njjin9gfghecgocdOutput:
{ "association": { "clusterName": "eks-customer", "namespace": "default", "serviceAccount": "default", "roleArn": "arn:aws:iam::111122223333:role/my-role", "associationArn": "arn:aws:eks:us-west-2:111122223333:podidentityassociation/eks-customer/a-9njjin9gfghecgocd", "associationId": "a-9njjin9gfghecgocd", "tags": { "Key2": "value2", "Key1": "value1" }, "createdAt": "2025-05-24T19:52:14.135000-05:00", "modifiedAt": "2025-05-24T19:52:14.135000-05:00" } }Per ulteriori informazioni, consulta Scopri come EKS Pod Identity concede ai pod l'accesso ai AWS servizi nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta AWS CLI Command DescribePodIdentityAssociation
Reference.
-
Il seguente esempio di codice mostra come utilizzaredescribe-update.
- AWS CLI
-
Esempio 1: descrivere un aggiornamento per un cluster
L'
describe-updateesempio seguente descrive un aggiornamento per un cluster denominato.aws eks describe-update \ --namemy-eks-cluster\ --update-id10bddb13-a71b-425a-b0a6-71cd03e59161Output:
{ "update": { "id": "10bddb13-a71b-425a-b0a6-71cd03e59161", "status": "Successful", "type": "EndpointAccessUpdate", "params": [ { "type": "EndpointPublicAccess", "value": "false" }, { "type": "EndpointPrivateAccess", "value": "true" } ], "createdAt": "2024-03-14T10:01:26.297000-04:00", "errors": [] } }Per ulteriori informazioni, consulta Aggiornamento di una versione Kubernetes del cluster Amazon EKS nella Guida per l'utente di Amazon EKS.
Esempio 2: Per descrivere un aggiornamento per un cluster
L'
describe-updateesempio seguente descrive un aggiornamento per un cluster denominato.aws eks describe-update \ --namemy-eks-cluster\ --update-ide4994991-4c0f-475a-a040-427e6da52966Output:
{ "update": { "id": "e4994991-4c0f-475a-a040-427e6da52966", "status": "Successful", "type": "AssociateEncryptionConfig", "params": [ { "type": "EncryptionConfig", "value": "[{\"resources\":[\"secrets\"],\"provider\":{\"keyArn\":\"arn:aws:kms:region-code:account:key/key\"}}]" } ], "createdAt": "2024-03-14T11:01:26.297000-04:00", "errors": [] } }Per ulteriori informazioni, consulta Aggiornamento di una versione Kubernetes del cluster Amazon EKS nella Guida per l'utente di Amazon EKS.
Esempio 3: Per descrivere un aggiornamento per un cluster
L'
describe-updateesempio seguente descrive un aggiornamento per un cluster denominato.aws eks describe-update \ --namemy-eks-cluster\ --update-idb5f0ba18-9a87-4450-b5a0-825e6e84496fOutput:
{ "update": { "id": "b5f0ba18-9a87-4450-b5a0-825e6e84496f", "status": "Successful", "type": "VersionUpdate", "params": [ { "type": "Version", "value": "1.29" }, { "type": "PlatformVersion", "value": "eks.1" } ], "createdAt": "2024-03-14T12:05:26.297000-04:00", "errors": [] } }Per ulteriori informazioni, consulta Aggiornamento di una versione Kubernetes del cluster Amazon EKS nella Guida per l'utente di Amazon EKS.
-
Per i dettagli sull'API, consulta Command DescribeUpdate
Reference AWS CLI .
-
Il seguente esempio di codice mostra come utilizzaredisassociate-access-policy.
- AWS CLI
-
Per dissociare la politica di accesso da una voce di accesso
Quanto segue
disassociate-access-policyrimuove la politica di accesso associata alla voce di accesso.aws eks disassociate-access-policy \ --cluster-nameeks-customer\ --principal-arnarn:aws:iam::111122223333:role/Admin\ --policy-arnarn:aws:eks::aws:cluster-access-policy/AmazonEKSEditPolicyQuesto comando non produce alcun output.
Per ulteriori informazioni, consulta Associare le politiche di accesso alle voci di accesso nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta DisassociateAccessPolicy AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredisassociate-identity-provider-config.
- AWS CLI
-
Dissocia il provider di identità dal tuo cluster Amazon EKS
L'
disassociate-identity-provider-configesempio seguente dissocia un provider di identità dal tuo cluster Amazon EKS.aws eks disassociate-identity-provider-config \ --cluster-namemy-eks-cluster\ --identity-provider-config 'type=oidc,name=my-identity-provider'Output:
{ "update": { "id": "5f78d14e-c57b-4857-a3e4-cf664ae20949", "status": "InProgress", "type": "DisassociateIdentityProviderConfig", "params": [ { "type": "IdentityProviderConfig", "value": "[]" } ], "createdAt": "2024-04-11T13:53:43.314000-04:00", "errors": [] } }Per ulteriori informazioni, consulta Autenticare gli utenti del cluster da un provider di identità OpenID Connect - Dissociare un provider di identità OIDC dal cluster nella Guida per l'utente di Amazon EKS.
-
Per i dettagli sull'API, consulta Command Reference. DisassociateIdentityProviderConfig
AWS CLI
-
Il seguente esempio di codice mostra come utilizzareget-token.
- AWS CLI
-
Esempio 1: ottieni un token di autenticazione per un cluster Amazon EKS denominato `my-eks-cluster`
L'
get-tokenesempio seguente ottiene un token di autenticazione per un cluster Amazon EKS denominato my-eks-cluster.aws eks get-token \ --cluster-namemy-eks-clusterOutput:
{ "kind": "ExecCredential", "apiVersion": "client.authentication.k8s.io/v1beta1", "spec": {}, "status": { "expirationTimestamp": "2024-04-11T20:59:56Z", "token": "k8s-aws-v1.EXAMPLE_TOKEN_DATA_STRING..." } }Esempio 2: ottiene un token di autenticazione per un cluster Amazon EKS denominato `my-eks-cluster` assumendo questo ROLearn per le credenziali al momento della firma del token
L'
get-tokenesempio seguente ottiene un token di autenticazione per un cluster Amazon EKS denominato my-eks-cluster assumendo questo ROLearn per le credenziali al momento della firma del token.aws eks get-token \ --cluster-namemy-eks-cluster\ --role-arnarn:aws:iam::111122223333:role/eksctl-EKS-Linux-Cluster-v1-24-cluster-ServiceRole-j1k7AfTIQtnMOutput:
{ "kind": "ExecCredential", "apiVersion": "client.authentication.k8s.io/v1beta1", "spec": {}, "status": { "expirationTimestamp": "2024-04-11T21:05:26Z", "token": "k8s-aws-v1.EXAMPLE_TOKEN_DATA_STRING..." } }-
Per i dettagli sull'API, consulta Command GetToken
Reference AWS CLI .
-
Il seguente esempio di codice mostra come utilizzarelist-access-entries.
- AWS CLI
-
Per elencare le voci di accesso per un cluster EKS
Quanto segue
list-access-entriesrestituisce l'elenco delle voci di accesso associate al cluster EKSeks-customer.aws eks list-access-entries \ --cluster-nameeks-customerOutput:
{ "accessEntries": [ "arn:aws:iam::111122223333:role/Admin", "arn:aws:iam::111122223333:role/admin-test-ip", "arn:aws:iam::111122223333:role/assume-worker-node-role", "arn:aws:iam::111122223333:user/eks-admin-user" ] }Per ulteriori informazioni, consulta Concedere agli utenti IAM l'accesso a Kubernetes con le voci di accesso EKS nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta Command ListAccessEntries
Reference AWS CLI .
-
Il seguente esempio di codice mostra come utilizzarelist-access-policies.
- AWS CLI
-
Per elencare tutte le politiche di accesso disponibili
Questo
list-access-policiesesempio restituisce l'elenco di tutte le politiche di accesso disponibili.aws eks list-access-policiesOutput:
{ "accessPolicies": [ { "name": "AmazonEKSAdminPolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSAdminPolicy" }, { "name": "AmazonEKSAdminViewPolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSAdminViewPolicy" }, { "name": "AmazonEKSAutoNodePolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSAutoNodePolicy" }, { "name": "AmazonEKSBlockStorageClusterPolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSBlockStorageClusterPolicy" }, { "name": "AmazonEKSBlockStoragePolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSBlockStoragePolicy" }, { "name": "AmazonEKSClusterAdminPolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy" }, { "name": "AmazonEKSComputeClusterPolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSComputeClusterPolicy" }, { "name": "AmazonEKSComputePolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSComputePolicy" }, { "name": "AmazonEKSEditPolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSEditPolicy" }, { "name": "AmazonEKSHybridPolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSHybridPolicy" }, { "name": "AmazonEKSLoadBalancingClusterPolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSLoadBalancingClusterPolicy" }, { "name": "AmazonEKSLoadBalancingPolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSLoadBalancingPolicy" }, { "name": "AmazonEKSNetworkingClusterPolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSNetworkingClusterPolicy" }, { "name": "AmazonEKSNetworkingPolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSNetworkingPolicy" }, { "name": "AmazonEKSViewPolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy" }, { "name": "AmazonEMRJobPolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonEMRJobPolicy" }, { "name": "AmazonSagemakerHyperpodClusterPolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonSagemakerHyperpodClusterPolicy" }, { "name": "AmazonSagemakerHyperpodControllerPolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonSagemakerHyperpodControllerPolicy" }, { "name": "AmazonSagemakerHyperpodSystemNamespacePolicy", "arn": "arn:aws:eks::aws:cluster-access-policy/AmazonSagemakerHyperpodSystemNamespacePolicy" } ] }Per ulteriori informazioni, consulta Associare le politiche di accesso alle voci di accesso nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta ListAccessPolicies AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-addons.
- AWS CLI
-
Elenca tutti i componenti aggiuntivi installati nel tuo cluster Amazon EKS denominati `` my-eks-cluster
L'
list-addonsesempio seguente elenca tutti i componenti aggiuntivi installati nel cluster Amazon EKS denominato my-eks-cluster.aws eks list-addons \ --cluster-namemy-eks-clusterOutput:
{ "addons": [ "kube-proxy", "vpc-cni" ] }-
Per i dettagli sull'API, consulta ListAddons AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-associated-access-policies.
- AWS CLI
-
Per elencare le politiche di accesso associate a una voce di accesso
L'
list-associated-access-policiesesempio seguente restituisce l'elenco delle politiche di accesso associate a una voce di accesso nel cluster EKS.aws eks list-associated-access-policies \ --cluster-nameeks-customer\ --principal-arnarn:aws:iam::111122223333:role/AdminOutput:
{ "associatedAccessPolicies": [ { "policyArn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSAdminPolicy", "accessScope": { "type": "cluster", "namespaces": [] }, "associatedAt": "2025-05-24T17:26:22.935000-05:00", "modifiedAt": "2025-05-24T17:26:22.935000-05:00" } ], "clusterName": "eks-customer", "principalArn": "arn:aws:iam::111122223333:role/Admin" }Per ulteriori informazioni, consulta Concedere agli utenti IAM l'accesso a Kubernetes con le voci di accesso EKS nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta Command ListAssociatedAccessPolicies
Reference AWS CLI .
-
Il seguente esempio di codice mostra come utilizzarelist-clusters.
- AWS CLI
-
Per elencare tutti i componenti aggiuntivi installati nel cluster Amazon EKS denominati `` my-eks-cluster
L'
list-clustersesempio seguente elenca tutti i componenti aggiuntivi installati nel cluster Amazon EKS denominato my-eks-cluster.aws eks list-clustersOutput:
{ "clusters": [ "prod", "qa", "stage", "my-eks-cluster" ] }-
Per i dettagli sull'API, consulta ListClusters AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-fargate-profiles.
- AWS CLI
-
Per elencare tutti i profili fargate nel tuo cluster Amazon EKS denominati `` my-eks-cluster
L'
list-fargate-profilesesempio seguente elenca tutti i profili fargate my-eks-cluster denominati nel cluster Amazon EKS.aws eks list-fargate-profiles \ --cluster-namemy-eks-clusterOutput:
{ "fargateProfileNames": [ "my-fargate-profile" ] }-
Per i dettagli sull'API, consulta ListFargateProfiles AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-identity-provider-configs.
- AWS CLI
-
Elenca i provider di identità associati a un cluster Amazon EKS
L'
list-identity-provider-configsesempio seguente elenca i provider di identità associati a un cluster Amazon EKS.aws eks list-identity-provider-configs \ --cluster-namemy-eks-clusterOutput:
{ "identityProviderConfigs": [ { "type": "oidc", "name": "my-identity-provider" } ] }Per ulteriori informazioni, consulta Autenticare gli utenti del cluster da un provider di identità OpenID Connect nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta AWS CLI Command ListIdentityProviderConfigs
Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-insights.
- AWS CLI
-
Per elencare tutte le informazioni dettagliate per il cluster specificato
L'
list-insightsesempio seguente restituisce l'elenco di tutti gli approfondimenti confrontati con il cluster specificato.aws eks list-insights \ --cluster-nameeks-customerOutput:
{ "insights": [ { "id": "38ea7a64-a14f-4e0e-95c7-8dbcab3c3616", "name": "Kubelet version skew", "category": "UPGRADE_READINESS", "kubernetesVersion": "1.33", "lastRefreshTime": "2025-05-24T11:22:50-05:00", "lastTransitionTime": "2025-05-24T11:22:50-05:00", "description": "Checks for kubelet versions of worker nodes in the cluster to see if upgrade would cause noncompliance with supported Kubernetes kubelet version skew policy.", "insightStatus": { "status": "PASSING", "reason": "Node kubelet versions match the cluster control plane version." } }, { "id": "9cd91472-f99c-45a9-b7d7-54d4900dee23", "name": "EKS add-on version compatibility", "category": "UPGRADE_READINESS", "kubernetesVersion": "1.33", "lastRefreshTime": "2025-05-24T11:22:59-05:00", "lastTransitionTime": "2025-05-24T11:22:50-05:00", "description": "Checks version of installed EKS add-ons to ensure they are compatible with the next version of Kubernetes. ", "insightStatus": { "status": "PASSING", "reason": "All installed EKS add-on versions are compatible with next Kubernetes version." } }, { "id": "0deb269d-b1e1-458c-a2b4-7a57f940c875", "name": "Cluster health issues", "category": "UPGRADE_READINESS", "kubernetesVersion": "1.33", "lastRefreshTime": "2025-05-24T11:22:59-05:00", "lastTransitionTime": "2025-05-24T11:22:50-05:00", "description": "Checks for any cluster health issues that prevent successful upgrade to the next Kubernetes version on EKS.", "insightStatus": { "status": "PASSING", "reason": "No cluster health issues detected." } }, { "id": "214fa274-344f-420b-812a-5049ce72c9ww", "name": "kube-proxy version skew", "category": "UPGRADE_READINESS", "kubernetesVersion": "1.33", "lastRefreshTime": "2025-05-24T11:22:50-05:00", "lastTransitionTime": "2025-05-24T11:22:50-05:00", "description": "Checks version of kube-proxy in cluster to see if upgrade would cause noncompliance with supported Kubernetes kube-proxy version skew policy.", "insightStatus": { "status": "PASSING", "reason": "kube-proxy versions match the cluster control plane version." } } ] }Per ulteriori informazioni, consulta Visualizza le informazioni sui cluster nella Guida per l'utente di Amazon EKS.
-
Per i dettagli sull'API, consulta ListInsights AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-nodegroups.
- AWS CLI
-
Elenca tutti i gruppi di nodi in un cluster Amazon EKS
L'
list-nodegroupsesempio seguente elenca tutti i gruppi di nodi in un cluster Amazon EKS.aws eks list-nodegroups \ --cluster-namemy-eks-clusterOutput:
{ "nodegroups": [ "my-eks-managed-node-group", "my-eks-nodegroup" ] }-
Per i dettagli sull'API, consulta ListNodegroups AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-pod-identity-associations.
- AWS CLI
-
Esempio 1: per elencare le associazioni Pod Identity in un cluster EKS
Quanto segue
list-pod-identity-associationsrestituisce l'elenco delle associazioni Pod Identity associate al cluster EKS denominateeks-customerin tutti i namespace e gli account di servizio.aws eks list-pod-identity-associations \ --cluster-nameeks-customerOutput:
{ "associations": [ { "clusterName": "eks-customer", "namespace": "default", "serviceAccount": "default", "associationArn": "arn:aws:eks:us-west-2:111122223333:podidentityassociation/eks-customer/a-9njjin9gfghecgocd", "associationId": "a-9njjin9gfghecgocd" }, { "clusterName": "eks-customer", "namespace": "kube-system", "serviceAccount": "eks-customer", "associationArn": "arn:aws:eks:us-west-2:111122223333:podidentityassociation/eks-customer/a-dvtacahdvjn01ffbc", "associationId": "a-dvtacahdvjn01ffbc" }, { "clusterName": "eks-customer", "namespace": "kube-system", "serviceAccount": "coredns", "associationArn": "arn:aws:eks:us-west-2:111122223333:podidentityassociation/eks-customer/a-yrpsdroc4ei7k6xps", "associationId": "a-yrpsdroc4ei7k6xps" } ] }Per ulteriori informazioni, consulta Scopri come EKS Pod Identity concede ai pod l'accesso ai AWS servizi nella Amazon EKS User Guide.
Esempio 2: per elencare le associazioni Pod Identity in un cluster EKS in base allo spazio dei nomi e all'account di servizio
Quanto segue
list-pod-identity-associationsrestituisce l'elenco delle associazioni Pod Identity nel cluster EKS in base allo spazio dei nomi e all'account di servizio.aws eks list-pod-identity-associations \ --cluster-nameeks-customer\ --namespacekube-system\ --service-accounteks-customerOutput:
{ "associations": [ { "clusterName": "eks-customer", "namespace": "kube-system", "serviceAccount": "eks-customer", "associationArn": "arn:aws:eks:us-west-2:111122223333:podidentityassociation/eks-customer/a-dvtacahdvjn01ffbc", "associationId": "a-dvtacahdvjn01ffbc" } ] }Per ulteriori informazioni, consulta Scopri come EKS Pod Identity concede ai pod l'accesso ai AWS servizi nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta AWS CLI Command ListPodIdentityAssociations
Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-tags-for-resource.
- AWS CLI
-
Esempio 1: per elencare tutti i tag per un ARN del cluster Amazon EKS
L'
list-tags-for-resourceesempio seguente elenca tutti i tag per un ARN del cluster Amazon EKS.aws eks list-tags-for-resource \ --resource-arnarn:aws:eks:us-east-2:111122223333:cluster/my-eks-clusterOutput:
{ "tags": { "aws:cloudformation:stack-name": "eksctl-my-eks-cluster-cluster", "alpha.eksctl.io/cluster-name": "my-eks-cluster", "karpenter.sh/discovery": "my-eks-cluster", "aws:cloudformation:stack-id": "arn:aws:cloudformation:us-east-2:111122223333:stack/eksctl-my-eks-cluster-cluster/e752ea00-e217-11ee-beae-0a9599c8c7ed", "auto-delete": "no", "eksctl.cluster.k8s.io/v1alpha1/cluster-name": "my-eks-cluster", "EKS-Cluster-Name": "my-eks-cluster", "alpha.eksctl.io/cluster-oidc-enabled": "true", "aws:cloudformation:logical-id": "ControlPlane", "alpha.eksctl.io/eksctl-version": "0.173.0-dev+a7ee89342.2024-03-01T03:40:57Z", "Name": "eksctl-my-eks-cluster-cluster/ControlPlane" } }Esempio 2: per elencare tutti i tag per un ARN del gruppo di nodi Amazon EKS
L'
list-tags-for-resourceesempio seguente elenca tutti i tag per un ARN del gruppo di nodi Amazon EKS.aws eks list-tags-for-resource \ --resource-arnarn:aws:eks:us-east-2:111122223333:nodegroup/my-eks-cluster/my-eks-managed-node-group/60c71ed2-2cfb-020f-a5f4-ad32477f198cOutput:
{ "tags": { "aws:cloudformation:stack-name": "eksctl-my-eks-cluster-nodegroup-my-eks-managed-node-group", "aws:cloudformation:stack-id": "arn:aws:cloudformation:us-east-2:111122223333:stack/eksctl-my-eks-cluster-nodegroup-my-eks-managed-node-group/eaa20310-e219-11ee-b851-0ab9ad8228ff", "eksctl.cluster.k8s.io/v1alpha1/cluster-name": "my-eks-cluster", "EKS-Cluster-Name": "my-eks-cluster", "alpha.eksctl.io/nodegroup-type": "managed", "NodeGroup Name 1": "my-eks-managed-node-group", "k8s.io/cluster-autoscaler/enabled": "true", "nodegroup-role": "worker", "alpha.eksctl.io/cluster-name": "my-eks-cluster", "alpha.eksctl.io/nodegroup-name": "my-eks-managed-node-group", "karpenter.sh/discovery": "my-eks-cluster", "NodeGroup Name 2": "AmazonLinux-Linux-Managed-NG-v1-26-v1", "auto-delete": "no", "k8s.io/cluster-autoscaler/my-eks-cluster": "owned", "aws:cloudformation:logical-id": "ManagedNodeGroup", "alpha.eksctl.io/eksctl-version": "0.173.0-dev+a7ee89342.2024-03-01T03:40:57Z" } }Esempio 3: elencare tutti i tag su un profilo Amazon EKS Fargate ARNe
L'
list-tags-for-resourceesempio seguente elenca tutti i tag per un profilo Amazon EKS Fargate (ARN).aws eks list-tags-for-resource \ --resource-arnarn:aws:eks:us-east-2:111122223333:fargateprofile/my-eks-cluster/my-fargate-profile/d6c76780-e541-0725-c816-36754cab734bOutput:
{ "tags": { "eks-fargate-profile-key-2": "value-2", "eks-fargate-profile-key-1": "value-1" } }Esempio 4: elencare tutti i tag per un ARN del componente aggiuntivo Amazon EKS
L'
list-tags-for-resourceesempio seguente elenca tutti i tag per un ARN del componente aggiuntivo Amazon EKS.aws eks list-tags-for-resource \ --resource-arnarn:aws:eks:us-east-2:111122223333:addon/my-eks-cluster/vpc-cni/0ec71efc-98dd-3203-60b0-4b939b2a5e5fOutput:
{ "tags": { "eks-addon-key-2": "value-2", "eks-addon-key-1": "value-1" } }Esempio 5: elencare tutti i tag per un provider di identità OIDC di Amazon EKS (ARN)
L'
list-tags-for-resourceesempio seguente elenca tutti i tag per l'ARN di un provider di identità OIDC di Amazon EKS.aws eks list-tags-for-resource \ --resource-arnarn:aws:eks:us-east-2:111122223333:identityproviderconfig/my-eks-cluster/oidc/my-identity-provider/8ac76722-78e4-cec1-ed76-d49eea058622Output:
{ "tags": { "my-identity-provider": "test" } }-
Per i dettagli sull'API, consulta Command ListTagsForResource
Reference AWS CLI .
-
Il seguente esempio di codice mostra come utilizzarelist-update.
- AWS CLI
-
Esempio 1: per elencare gli aggiornamenti associati a un nome di cluster Amazon EKS
L'
list-updatesesempio seguente elenca tutti gli aggiornamenti IDs per un nome di cluster Amazon EKS.aws eks list-updates \ --namemy-eks-clusterOutput:
{ "updateIds": [ "5f78d14e-c57b-4857-a3e4-cf664ae20949", "760e5a3f-adad-48c7-88d3-7ac283c09c26", "cd4ec863-bc55-47d5-a377-3971502f529b", "f12657ce-e869-4f17-b158-a82ab8b7d937" ] }Esempio 2: elencare tutti gli aggiornamenti IDs per un gruppo di nodi Amazon EKS
L'
list-updatesesempio seguente elenca tutti gli aggiornamenti IDs per un gruppo di nodi Amazon EKS.aws eks list-updates \ --namemy-eks-cluster\ --nodegroup-namemy-eks-managed-node-groupOutput:
{ "updateIds": [ "8c6c1bef-61fe-42ac-a242-89412387b8e7" ] }Esempio 3: elencare tutti gli aggiornamenti IDs su un componente aggiuntivo Amazon EKS
L'
list-updatesesempio seguente elenca tutti gli aggiornamenti IDs per un componente aggiuntivo Amazon EKS.aws eks list-updates \ --namemy-eks-cluster\ --addon-namevpc-cniOutput:
{ "updateIds": [ "9cdba8d4-79fb-3c83-afe8-00b508d33268" ] }-
Per i dettagli sull'API, consulta ListUpdate AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-updates.
- AWS CLI
-
Per elencare gli aggiornamenti per un cluster
Questo comando di esempio elenca gli aggiornamenti correnti per un cluster denominato
examplenell'area predefinita.Comando:
aws eks list-updates --nameexampleOutput:
{ "updateIds": [ "10bddb13-a71b-425a-b0a6-71cd03e59161" ] }-
Per i dettagli sull'API, vedere ListUpdates
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzareregister-cluster.
- AWS CLI
-
Esempio 1: registrare un cluster Kubernetes EKS_ANYWHERE esterno su Amazon EKS
L'
register-clusteresempio seguente registra un cluster Kubernetes EKS_ANYWHERE esterno su Amazon EKS.aws eks register-cluster \ --namemy-eks-anywhere-cluster\ --connector-config 'roleArn=arn:aws:iam::111122223333:role/AmazonEKSConnectorAgentRole,provider=EKS_ANYWHERE'Output:
{ "cluster": { "name": "my-eks-anywhere-cluster", "arn": "arn:aws:eks:us-east-2:111122223333:cluster/my-eks-anywhere-cluster", "createdAt": "2024-04-12T12:38:37.561000-04:00", "status": "PENDING", "tags": {}, "connectorConfig": { "activationId": "xxxxxxxxACTIVATION_IDxxxxxxxx", "activationCode": "xxxxxxxxACTIVATION_CODExxxxxxxx", "activationExpiry": "2024-04-15T12:38:37.082000-04:00", "provider": "EKS_ANYWHERE", "roleArn": "arn:aws:iam::111122223333:role/AmazonEKSConnectorAgentRole" } } }Per ulteriori informazioni, consulta Connessione di un cluster esterno nella Guida per l'utente di Amazon EKS.
Esempio 2: registrazione di qualsiasi cluster Kubernetes esterno su Amazon EKS
L'
register-clusteresempio seguente registra un cluster Kubernetes EKS_ANYWHERE esterno su Amazon EKS.aws eks register-cluster \ --namemy-eks-anywhere-cluster\ --connector-config 'roleArn=arn:aws:iam::111122223333:role/AmazonEKSConnectorAgentRole,provider=OTHER'Output:
{ "cluster": { "name": "my-onprem-k8s-cluster", "arn": "arn:aws:eks:us-east-2:111122223333:cluster/my-onprem-k8s-cluster", "createdAt": "2024-04-12T12:42:10.861000-04:00", "status": "PENDING", "tags": {}, "connectorConfig": { "activationId": "xxxxxxxxACTIVATION_IDxxxxxxxx", "activationCode": "xxxxxxxxACTIVATION_CODExxxxxxxx", "activationExpiry": "2024-04-15T12:42:10.339000-04:00", "provider": "OTHER", "roleArn": "arn:aws:iam::111122223333:role/AmazonEKSConnectorAgentRole" } } }Per ulteriori informazioni, consulta Connessione di un cluster esterno nella Guida per l'utente di Amazon EKS.
-
Per i dettagli sull'API, consulta RegisterCluster AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzaretag-resource.
- AWS CLI
-
Esempio 1: aggiungere i tag specificati a un cluster Amazon EKS
L'
tag-resourceesempio seguente aggiunge i tag specificati a un cluster Amazon EKS.aws eks tag-resource \ --resource-arnarn:aws:eks:us-east-2:111122223333:cluster/my-eks-cluster\ --tag 'my-eks-cluster-test-1=test-value-1,my-eks-cluster-dev-1=dev-value-2'Questo comando non produce alcun output.
Esempio 2: aggiungere i tag specificati a un gruppo di nodi Amazon EKS
L'
tag-resourceesempio seguente aggiunge i tag specificati a un gruppo di nodi Amazon EKS.aws eks tag-resource \ --resource-arnarn:aws:eks:us-east-2:111122223333:nodegroup/my-eks-cluster/my-eks-managed-node-group/60c71ed2-2cfb-020f-a5f4-ad32477f198c\ --tag 'my-eks-nodegroup-test-1=test-value-1,my-eks-nodegroup-dev-1=dev-value-2'Questo comando non produce alcun output.
-
Per i dettagli sull'API, consulta TagResource AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareuntag-resource.
- AWS CLI
-
Esempio 1: eliminare i tag specificati da un cluster Amazon EKS
L'
untag-resourceesempio seguente elimina i tag specificati da un cluster Amazon EKS.aws eks untag-resource \ --resource-arnarn:aws:eks:us-east-2:111122223333:cluster/my-eks-cluster\ --tag-keys"my-eks-cluster-test-1""my-eks-cluster-dev-1"Questo comando non produce alcun output.
Esempio 2: eliminare i tag specificati da un gruppo di nodi Amazon EKS
L'
untag-resourceesempio seguente elimina i tag specificati da un gruppo di nodi Amazon EKS.aws eks untag-resource \ --resource-arnarn:aws:eks:us-east-2:111122223333:nodegroup/my-eks-cluster/my-eks-managed-node-group/60c71ed2-2cfb-020f-a5f4-ad32477f198c\ --tag-keys"my-eks-nodegroup-test-1""my-eks-nodegroup-dev-1"Questo comando non produce alcun output.
-
Per i dettagli sull'API, consulta UntagResource AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareupdate-access-entry.
- AWS CLI
-
Per aggiornare una voce di accesso per un cluster EKS
Quanto segue
update-access-entryaggiorna una voce di accesso per il cluster EKS aggiungendo il gruppo Kubernetes.testeraws eks update-access-entry \ --cluster-nameeks-customer\ --principal-arnarn:aws:iam::111122223333:role/Admin\ --kubernetes-groupstesterOutput:
{ "accessEntry": { "clusterName": "eks-customer", "principalArn": "arn:aws:iam::111122223333:role/Admin", "kubernetesGroups": [ "tester" ], "accessEntryArn": "arn:aws:eks:us-west-2:111122223333:access-entry/eks-customer/role/111122223333/Admin/d2cb8183-d6ec-b82a-d967-eca21902a4b4", "createdAt": "2025-05-24T11:02:04.432000-05:00", "modifiedAt": "2025-05-24T17:08:01.608000-05:00", "tags": {}, "username": "arn:aws:sts::111122223333:assumed-role/Admin/{{SessionName}}", "type": "STANDARD" } }Per ulteriori informazioni, consulta Aggiornare le voci di accesso nella Guida per l'utente di Amazon EKS.
-
Per i dettagli sull'API, consulta UpdateAccessEntry AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareupdate-addon.
- AWS CLI
-
Esempio 1. Per aggiornare un componente aggiuntivo Amazon EKS con il ruolo ARN dell'account di servizio
Il comando di
update-addonesempio seguente aggiorna un componente aggiuntivo Amazon EKS con il ruolo ARN dell'account di servizio.aws eks update-addon \ --cluster-namemy-eks-cluster\ --addon-namevpc-cni\ --service-account-role-arnarn:aws:iam::111122223333:role/eksctl-my-eks-cluster-addon-vpc-cni-Role1-YfakrqOC1UTmOutput:
{ "update": { "id": "c00d2de2-c2e4-3d30-929e-46b8edec2ce4", "status": "InProgress", "type": "AddonUpdate", "params": [ { "type": "ServiceAccountRoleArn", "value": "arn:aws:iam::111122223333:role/eksctl-my-eks-cluster-addon-vpc-cni-Role1-YfakrqOC1UTm" } ], "updatedAt": "2024-04-12T16:04:55.614000-04:00", "errors": [] } }Per ulteriori informazioni, consulta Managing Amazon EKS add-ons - Updating an add-on nella Amazon EKS User Guide.
Esempio 2. Per aggiornare un componente aggiuntivo Amazon EKS con una versione aggiuntiva specifica
Il comando di
update-addonesempio seguente aggiorna un componente aggiuntivo Amazon EKS con una versione aggiuntiva specifica.aws eks update-addon \ --cluster-namemy-eks-cluster\ --addon-namevpc-cni\ --service-account-role-arnarn:aws:iam::111122223333:role/eksctl-my-eks-cluster-addon-vpc-cni-Role1-YfakrqOC1UTm\ --addon-versionv1.16.4-eksbuild.2Output:
{ "update": { "id": "f58dc0b0-2b18-34bd-bc6a-e4abc0011f36", "status": "InProgress", "type": "AddonUpdate", "params": [ { "type": "AddonVersion", "value": "v1.16.4-eksbuild.2" }, { "type": "ServiceAccountRoleArn", "value": "arn:aws:iam::111122223333:role/eksctl-my-eks-cluster-addon-vpc-cni-Role1-YfakrqOC1UTm" } ], "createdAt": "2024-04-12T16:07:16.550000-04:00", "errors": [] } }Per ulteriori informazioni, consulta Managing Amazon EKS add-ons - Updating an add-on nella Amazon EKS User Guide.
Esempio 3. Per aggiornare un componente aggiuntivo Amazon EKS con valori di configurazione personalizzati e risolvere i dettagli dei conflitti
Il comando di
update-addonesempio seguente aggiorna un componente aggiuntivo Amazon EKS con valori di configurazione personalizzati e risolve i dettagli dei conflitti.aws eks update-addon \ --cluster-namemy-eks-cluster\ --addon-namevpc-cni\ --service-account-role-arnarn:aws:iam::111122223333:role/eksctl-my-eks-cluster-addon-vpc-cni-Role1-YfakrqOC1UTm\ --addon-versionv1.16.4-eksbuild.2\ --configuration-values '{"resources": {"limits":{"cpu":"100m"}, "requests":{"cpu":"50m"}}}' \ --resolve-conflictsPRESERVEOutput:
{ "update": { "id": "cd9f2173-a8d8-3004-a90f-032f14326520", "status": "InProgress", "type": "AddonUpdate", "params": [ { "type": "AddonVersion", "value": "v1.16.4-eksbuild.2" }, { "type": "ServiceAccountRoleArn", "value": "arn:aws:iam::111122223333:role/eksctl-my-eks-cluster-addon-vpc-cni-Role1-YfakrqOC1UTm" }, { "type": "ResolveConflicts", "value": "PRESERVE" }, { "type": "ConfigurationValues", "value": "{\"resources\": {\"limits\":{\"cpu\":\"100m\"}, \"requests\":{\"cpu\":\"50m\"}}}" } ], "createdAt": "2024-04-12T16:16:27.363000-04:00", "errors": [] } }Per ulteriori informazioni, consulta Managing Amazon EKS add-ons - Updating an add-on nella Amazon EKS User Guide.
Esempio 4. Per aggiornare un componente aggiuntivo Amazon EKS con un file di valori di configurazione JSON personalizzato
Il comando di
update-addonesempio seguente aggiorna un componente aggiuntivo Amazon EKS con valori di configurazione JSON personalizzati e risolve i dettagli dei conflitti.aws eks update-addon \ --cluster-namemy-eks-cluster\ --addon-namevpc-cni\ --service-account-role-arnarn:aws:iam::111122223333:role/eksctl-my-eks-cluster-addon-vpc-cni-Role1-YfakrqOC1UTm\ --addon-versionv1.17.1-eksbuild.1\ --configuration-values 'file://configuration-values.json' \ --resolve-conflictsPRESERVEContenuto di
configuration-values.json.{ "resources": { "limits": { "cpu": "100m" }, "requests": { "cpu": "50m" } }, "env": { "AWS_VPC_K8S_CNI_LOGLEVEL": "ERROR" } }Output:
{ "update": { "id": "6881a437-174f-346b-9a63-6e91763507cc", "status": "InProgress", "type": "AddonUpdate", "params": [ { "type": "AddonVersion", "value": "v1.17.1-eksbuild.1" }, { "type": "ServiceAccountRoleArn", "value": "arn:aws:iam::111122223333:role/eksctl-my-eks-cluster-addon-vpc-cni-Role1-YfakrqOC1UTm" }, { "type": "ResolveConflicts", "value": "PRESERVE" }, { "type": "ConfigurationValues", "value": "{\n \"resources\": {\n \"limits\": {\n \"cpu\": \"100m\"\n },\n \"requests\": {\n \"cpu\": \"50m\"\n }\n },\n \"env\": {\n \"AWS_VPC_K8S_CNI_LOGLEVEL\": \"ERROR\"\n }\n}" } ], "createdAt": "2024-04-12T16:22:55.519000-04:00", "errors": [] } }Per ulteriori informazioni, consulta Managing Amazon EKS add-ons - Updating an add-on nella Amazon EKS User Guide.
Esempio 5. Per aggiornare un componente aggiuntivo Amazon EKS con un file di valori di configurazione YAML personalizzato
Il comando di
update-addonesempio seguente aggiorna un componente aggiuntivo Amazon EKS con valori di configurazione YAML personalizzati e risolve i dettagli dei conflitti.aws eks update-addon \ --cluster-namemy-eks-cluster\ --addon-namevpc-cni\ --service-account-role-arnarn:aws:iam::111122223333:role/eksctl-my-eks-cluster-addon-vpc-cni-Role1-YfakrqOC1UTm\ --addon-versionv1.18.0-eksbuild.1\ --configuration-values 'file://configuration-values.yaml' \ --resolve-conflictsPRESERVEContenuto di
configuration-values.yaml.resources: limits: cpu: '100m' requests: cpu: '50m' env: AWS_VPC_K8S_CNI_LOGLEVEL: 'DEBUG'Output:
{ "update": { "id": "a067a4c9-69d0-3769-ace9-d235c5b16701", "status": "InProgress", "type": "AddonUpdate", "params": [ { "type": "AddonVersion", "value": "v1.18.0-eksbuild.1" }, { "type": "ServiceAccountRoleArn", "value": "arn:aws:iam::111122223333:role/eksctl-my-eks-cluster-addon-vpc-cni-Role1-YfakrqOC1UTm" }, { "type": "ResolveConflicts", "value": "PRESERVE" }, { "type": "ConfigurationValues", "value": "resources:\n limits:\n cpu: '100m'\n requests:\n cpu: '50m'\nenv:\n AWS_VPC_K8S_CNI_LOGLEVEL: 'DEBUG'" } ], "createdAt": "2024-04-12T16:25:07.212000-04:00", "errors": [] } }Per ulteriori informazioni, consulta Managing Amazon EKS add-ons - Updating an add-on nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta AWS CLI Command UpdateAddon
Reference.
-
Il seguente esempio di codice mostra come utilizzareupdate-cluster-config.
- AWS CLI
-
Per aggiornare l'accesso agli endpoint del cluster
Questo comando di esempio aggiorna un cluster per disabilitare l'accesso pubblico agli endpoint e abilitare l'accesso privato agli endpoint.
Comando:
aws eks update-cluster-config --nameexample\ --resources-vpc-configendpointPublicAccess=false,endpointPrivateAccess=trueOutput:
{ "update": { "id": "ec883c93-2e9e-407c-a22f-8f6fa6e67d4f", "status": "InProgress", "type": "EndpointAccessUpdate", "params": [ { "type": "EndpointPublicAccess", "value": "false" }, { "type": "EndpointPrivateAccess", "value": "true" } ], "createdAt": 1565806986.506, "errors": [] } }Per abilitare la registrazione per un cluster
Questo comando di esempio abilita tutti i tipi di registrazione del piano di controllo del cluster per un cluster denominato.
exampleComando:
aws eks update-cluster-config --nameexample\ --logging '{"clusterLogging":[{"types":["api","audit","authenticator","controllerManager","scheduler"],"enabled":true}]}'Output:
{ "update": { "id": "7551c64b-1d27-4b1e-9f8e-c45f056eb6fd", "status": "InProgress", "type": "LoggingUpdate", "params": [ { "type": "ClusterLogging", "value": "{\"clusterLogging\":[{\"types\":[\"api\",\"audit\",\"authenticator\",\"controllerManager\",\"scheduler\"],\"enabled\":true}]}" } ], "createdAt": 1565807210.37, "errors": [] } }-
Per i dettagli sull'API, vedere UpdateClusterConfig
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzareupdate-cluster-version.
- AWS CLI
-
Per aggiornare un cluster Amazon EKS denominato `my-eks-cluster` alla versione Kubernetes specificata
L'
update-cluster-versionesempio seguente aggiorna un cluster Amazon EKS alla versione Kubernetes specificata.aws eks update-cluster-version \ --namemy-eks-cluster\ --kubernetes-version1.27Output:
{ "update": { "id": "e4091a28-ea14-48fd-a8c7-975aeb469e8a", "status": "InProgress", "type": "VersionUpdate", "params": [ { "type": "Version", "value": "1.27" }, { "type": "PlatformVersion", "value": "eks.16" } ], "createdAt": "2024-04-12T16:56:01.082000-04:00", "errors": [] } }Per ulteriori informazioni, consulta Aggiornamento di una versione Kubernetes del cluster Amazon EKS nella Guida per l'utente di Amazon EKS.
-
Per i dettagli sull'API, consulta Command UpdateClusterVersion
Reference AWS CLI .
-
Il seguente esempio di codice mostra come utilizzareupdate-kubeconfig.
- AWS CLI
-
Esempio 1: configura il tuo kubectl creando o aggiornando kubeconfig in modo da poterti connettere a un cluster Amazon EKS denominato `` my-eks-cluster
L'
update-kubeconfigesempio seguente configura il tuo kubectl creando o aggiornando kubeconfig in modo che tu possa connetterti a un cluster Amazon EKS denominato. my-eks-clusteraws eks update-kubeconfig \ --namemy-eks-clusterOutput:
Updated context arn:aws:eks:us-east-2:111122223333:cluster/my-eks-cluster in /Users/xxx/.kube/configPer ulteriori informazioni, consulta Creazione o aggiornamento di un file kubeconfig per un cluster Amazon EKS nella Amazon EKS User Guide.
Esempio 2: configura il tuo kubectl creando o aggiornando kubeconfig (con l'opzione role-arn per assumere un ruolo per l'autenticazione del cluster) in modo da poterti connettere a un cluster Amazon EKS denominato `` my-eks-cluster
L'
update-kubeconfigesempio seguente configura il tuo kubectl creando o aggiornando kubeconfig (con l'opzione role-arn per assumere un ruolo per l'autenticazione del cluster) in modo da poterti connettere a un cluster Amazon EKS denominato. my-eks-clusteraws eks update-kubeconfig \ --namemy-eks-cluster\ --role-arnarn:aws:iam::111122223333:role/eksctl-EKS-Linux-Cluster-v1-24-cluster-ServiceRole-j1k7AfTIQtnMOutput:
Updated context arn:aws:eks:us-east-2:111122223333:cluster/my-eks-cluster in /Users/xxx/.kube/configPer ulteriori informazioni, consulta Creazione o aggiornamento di un file kubeconfig per un cluster Amazon EKS nella Amazon EKS User Guide.
Esempio 3: configura il tuo kubectl creando o aggiornando kubeconfig (con l'opzione role-arn per assumere un ruolo per l'autenticazione del cluster insieme a alias cluster e alias utente personalizzati) in modo da poterti connettere a un cluster Amazon EKS denominato `` my-eks-cluster
L'
update-kubeconfigesempio seguente configura il tuo kubectl creando o aggiornando kubeconfig (con l'opzione role-arn per assumere un ruolo per l'autenticazione del cluster insieme a alias cluster e alias utente personalizzati) in modo da poterti connettere a un cluster Amazon EKS denominato. my-eks-clusteraws eks update-kubeconfig \ --namemy-eks-cluster\ --role-arnarn:aws:iam::111122223333:role/eksctl-EKS-Linux-Cluster-v1-24-cluster-ServiceRole-j1k7AfTIQtnM\ --aliasstage-eks-cluster\ --user-aliasjohnOutput:
Updated context stage-eks-cluster in /Users/dubaria/.kube/configPer ulteriori informazioni, consulta Creazione o aggiornamento di un file kubeconfig per un cluster Amazon EKS nella Amazon EKS User Guide.
Esempio 4: stampa le voci del file kubeconfig per la revisione e configura il tuo kubectl in modo da poterti connettere a un cluster Amazon EKS denominato `` my-eks-cluster
L'
update-kubeconfigesempio seguente configura il tuo kubectl creando o aggiornando kubeconfig (con l'opzione role-arn per assumere un ruolo per l'autenticazione del cluster insieme a alias cluster e alias utente personalizzati) in modo da poterti connettere a un cluster Amazon EKS denominato. my-eks-clusteraws eks update-kubeconfig \ --namemy-eks-cluster\ --role-arnarn:aws:iam::111122223333:role/eksctl-EKS-Linux-Cluster-v1-24-cluster-ServiceRole-j1k7AfTIQtnM\ --aliasstage-eks-cluster\ --user-aliasjohn\ --verboseOutput:
Updated context stage-eks-cluster in /Users/dubaria/.kube/config Entries: context: cluster: arn:aws:eks:us-east-2:111122223333:cluster/my-eks-cluster user: john name: stage-eks-cluster name: john user: exec: apiVersion: client.authentication.k8s.io/v1beta1 args: - --region - us-east-2 - eks - get-token - --cluster-name - my-eks-cluster - --output - json - --role - arn:aws:iam::111122223333:role/eksctl-EKS-Linux-Cluster-v1-24-cluster-ServiceRole-j1k7AfTIQtnM command: aws cluster: certificate-authority-data: xxx_CA_DATA_xxx server: https://DALSJ343KE23J3RN45653DSKJTT647TYD.yl4.us-east-2.eks.amazonaws.com name: arn:aws:eks:us-east-2:111122223333:cluster/my-eks-clusterPer ulteriori informazioni, consulta Creazione o aggiornamento di un file kubeconfig per un cluster Amazon EKS nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta Command UpdateKubeconfig
Reference AWS CLI .
-
Il seguente esempio di codice mostra come utilizzareupdate-nodegroup-config.
- AWS CLI
-
Esempio 1: aggiorna un gruppo di nodi gestiti per aggiungere nuove etichette e contaminazioni al nodo di lavoro EKS per un cluster Amazon EKS
L'
update-nodegroup-configesempio seguente aggiorna un gruppo di nodi gestiti per aggiungere nuove etichette e contaminazioni al nodo di lavoro EKS per un cluster Amazon EKS.aws eks update-nodegroup-config \ --cluster-namemy-eks-cluster\ --nodegroup-namemy-eks-nodegroup\ --labels 'addOrUpdateLabels={my-eks-nodegroup-label-1=value-1,my-eks-nodegroup-label-2=value-2}' \ --taints 'addOrUpdateTaints=[{key=taint-key-1,value=taint-value-1,effect=NO_EXECUTE}]'Output:
{ "update": { "id": "e66d21d3-bd8b-3ad1-a5aa-b196dc08c7c1", "status": "InProgress", "type": "ConfigUpdate", "params": [ { "type": "LabelsToAdd", "value": "{\"my-eks-nodegroup-label-2\":\"value-2\",\"my-eks-nodegroup-label-1\":\"value-1\"}" }, { "type": "TaintsToAdd", "value": "[{\"effect\":\"NO_EXECUTE\",\"value\":\"taint-value-1\",\"key\":\"taint-key-1\"}]" } ], "createdAt": "2024-04-08T12:05:19.161000-04:00", "errors": [] } }Per ulteriori informazioni, consulta Aggiornamento di un gruppo di nodi gestiti nella Guida per l'utente di Amazon EKS.
Esempio 2: aggiorna un gruppo di nodi gestiti per rimuovere etichette e contaminazioni per il nodo di lavoro EKS per un cluster Amazon EKS
L'
update-nodegroup-configesempio seguente aggiorna un gruppo di nodi gestiti per rimuovere etichette e contaminazioni per il nodo di lavoro EKS per un cluster Amazon EKS.aws eks update-nodegroup-config \ --cluster-namemy-eks-cluster\ --nodegroup-namemy-eks-nodegroup\ --labels 'removeLabels=my-eks-nodegroup-label-1, my-eks-nodegroup-label-2' \ --taints 'removeTaints=[{key=taint-key-1,value=taint-value-1,effect=NO_EXECUTE}]'Output:
{ "update": { "id": "67a08692-9e59-3ace-a916-13929f44cec3", "status": "InProgress", "type": "ConfigUpdate", "params": [ { "type": "LabelsToRemove", "value": "[\"my-eks-nodegroup-label-1\",\"my-eks-nodegroup-label-2\"]" }, { "type": "TaintsToRemove", "value": "[{\"effect\":\"NO_EXECUTE\",\"value\":\"taint-value-1\",\"key\":\"taint-key-1\"}]" } ], "createdAt": "2024-04-08T12:17:31.817000-04:00", "errors": [] } }Per ulteriori informazioni, consulta Aggiornamento di un gruppo di nodi gestiti nella Guida per l'utente di Amazon EKS.
Esempio 3: aggiorna un gruppo di nodi gestiti per rimuovere e aggiungere etichette e contaminazioni per il nodo di lavoro EKS per un cluster Amazon EKS
L'
update-nodegroup-configesempio seguente aggiorna un gruppo di nodi gestiti per rimuovere e aggiungere etichette e contaminazioni per il nodo di lavoro EKS per un cluster Amazon EKS.aws eks update-nodegroup-config \ --cluster-namemy-eks-cluster\ --nodegroup-namemy-eks-nodegroup\ --labels 'addOrUpdateLabels={my-eks-nodegroup-new-label-1=new-value-1,my-eks-nodegroup-new-label-2=new-value-2},removeLabels=my-eks-nodegroup-label-1, my-eks-nodegroup-label-2' \ --taints 'addOrUpdateTaints=[{key=taint-new-key-1,value=taint-new-value-1,effect=PREFER_NO_SCHEDULE}],removeTaints=[{key=taint-key-1,value=taint-value-1,effect=NO_EXECUTE}]'Output:
{ "update": { "id": "4a9c8c45-6ac7-3115-be71-d6412a2339b7", "status": "InProgress", "type": "ConfigUpdate", "params": [ { "type": "LabelsToAdd", "value": "{\"my-eks-nodegroup-new-label-1\":\"new-value-1\",\"my-eks-nodegroup-new-label-2\":\"new-value-2\"}" }, { "type": "LabelsToRemove", "value": "[\"my-eks-nodegroup-label-1\",\"my-eks-nodegroup-label-2\"]" }, { "type": "TaintsToAdd", "value": "[{\"effect\":\"PREFER_NO_SCHEDULE\",\"value\":\"taint-new-value-1\",\"key\":\"taint-new-key-1\"}]" }, { "type": "TaintsToRemove", "value": "[{\"effect\":\"NO_EXECUTE\",\"value\":\"taint-value-1\",\"key\":\"taint-key-1\"}]" } ], "createdAt": "2024-04-08T12:30:55.486000-04:00", "errors": [] } }Per ulteriori informazioni, consulta Aggiornamento di un gruppo di nodi gestiti nella Guida per l'utente di Amazon EKS.
Esempio 4: aggiornamento di un gruppo di nodi gestito per aggiornare scaling-config e update-config per il nodo di lavoro EKS per un cluster Amazon EKS
L'
update-nodegroup-configesempio seguente aggiorna un gruppo di nodi gestiti per aggiornare scaling-config e update-config per il nodo di lavoro EKS per un cluster Amazon EKS.aws eks update-nodegroup-config \ --cluster-namemy-eks-cluster\ --nodegroup-namemy-eks-nodegroup\ --scaling-configminSize=1,maxSize=5,desiredSize=2\ --update-configmaxUnavailable=2Output:
{ "update": { "id": "a977160f-59bf-3023-805d-c9826e460aea", "status": "InProgress", "type": "ConfigUpdate", "params": [ { "type": "MinSize", "value": "1" }, { "type": "MaxSize", "value": "5" }, { "type": "DesiredSize", "value": "2" }, { "type": "MaxUnavailable", "value": "2" } ], "createdAt": "2024-04-08T12:35:17.036000-04:00", "errors": [] } }Per ulteriori informazioni, consulta Aggiornamento di un gruppo di nodi gestiti nella Guida per l'utente di Amazon EKS.
-
Per i dettagli sull'API, consulta UpdateNodegroupConfig AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareupdate-nodegroup-version.
- AWS CLI
-
Esempio 1: aggiorna la versione Kubernetes o la versione AMI di un gruppo di nodi gestiti Amazon EKS
L'
update-nodegroup-versionesempio seguente aggiorna la versione Kubernetes o la versione AMI di un gruppo di nodi gestiti Amazon EKS all'ultima versione disponibile per il tuo cluster Kubernetes.aws eks update-nodegroup-version \ --cluster-namemy-eks-cluster\ --nodegroup-namemy-eks-nodegroup\ --no-forceOutput:
{ "update": { "id": "a94ebfc3-6bf8-307a-89e6-7dbaa36421f7", "status": "InProgress", "type": "VersionUpdate", "params": [ { "type": "Version", "value": "1.26" }, { "type": "ReleaseVersion", "value": "1.26.12-20240329" } ], "createdAt": "2024-04-08T13:16:00.724000-04:00", "errors": [] } }Per ulteriori informazioni, consulta Aggiornamento di un gruppo di nodi gestiti nella Guida per l'utente di Amazon EKS.
Esempio 2: aggiornamento della versione Kubernetes o della versione AMI di un gruppo di nodi gestiti Amazon EKS
L'
update-nodegroup-versionesempio seguente aggiorna la versione Kubernetes o la versione AMI di un gruppo di nodi gestiti di Amazon EKS alla versione di release AMI specificata.aws eks update-nodegroup-version \ --cluster-namemy-eks-cluster\ --nodegroup-namemy-eks-nodegroup\ --kubernetes-version '1.26' \ --release-version '1.26.12-20240307' \ --no-forceOutput:
{ "update": { "id": "4db06fe1-088d-336b-bdcd-3fdb94995fb7", "status": "InProgress", "type": "VersionUpdate", "params": [ { "type": "Version", "value": "1.26" }, { "type": "ReleaseVersion", "value": "1.26.12-20240307" } ], "createdAt": "2024-04-08T13:13:58.595000-04:00", "errors": [] } }Per ulteriori informazioni, consulta la sezione Aggiornamento di un gruppo di nodi gestiti - < https://docs.aws.amazon.com/eks/ latest/userguide/update - managed-node-group .html>` nella Guida per l'utente di Amazon EKS.
-
Per i dettagli sull'API, consulta UpdateNodegroupVersion
Command Reference.AWS CLI
-
Il seguente esempio di codice mostra come utilizzareupdate-pod-identity-association.
- AWS CLI
-
Per aggiornare l'associazione EKS Pod Identity
L'
update-pod-identity-associationesempio seguente aggiorna un'associazione EKS Pod Identity modificando il ruolo IAM associato daarn:aws:iam::111122223333:role/my-roleaarn:aws:iam::111122223333:role/s3-rolefor association IDa-9njjin9gfghecgocd. Questa API consente solo l'aggiornamento del ruolo IAM associato.aws eks update-pod-identity-association \ --cluster-nameeks-customer\ --association-ida-9njjin9gfghecgocd\ --role-arnarn:aws:iam::111122223333:role/s3-roleOutput:
{ "association": { "clusterName": "eks-customer", "namespace": "default", "serviceAccount": "default", "roleArn": "arn:aws:iam::111122223333:role/s3-role", "associationArn": "arn:aws:eks:us-west-2:111122223333:podidentityassociation/eks-customer/a-9njjin9gfghecgocd", "associationId": "a-9njjin9gfghecgocd", "tags": { "Key2": "value2", "Key1": "value1" }, "createdAt": "2025-05-24T19:52:14.135000-05:00", "modifiedAt": "2025-05-25T21:01:53.120000-05:00" } }Per ulteriori informazioni, consulta Scopri come EKS Pod Identity concede ai pod l'accesso ai AWS servizi nella Amazon EKS User Guide.
-
Per i dettagli sull'API, consulta AWS CLI Command UpdatePodIdentityAssociation
Reference.
-