Il prodotto descritto in questa documentazione, Anthos Clusters on AWS (generazione precedente), è ora in modalità di manutenzione. Tutte le nuove installazioni devono utilizzare l'attuale prodotto di generazione, Cluster Anthos on AWS.
Utilizzo di una chiave CMK gestita dal cliente per criptare i volumi
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
GKE su AWS utilizza AWS Key Management Service (KMS) per criptare
i volumi EBS. GKE on AWS 1.7 e versioni successive supportano la crittografia dei volumi con chiavi master del cliente (CMK) gestite dal cliente. GKE su AWS nelle versioni 1.6.x e precedenti supporta solo le chiavi master del cliente gestite da AWS.
Questo argomento descrive come configurare una chiave CMEK gestita dal cliente per criptare i volumi. Se
non configuri una CMK gestita dal cliente, GKE su AWS utilizza per impostazione predefinita le CMK gestite da AWS.
Panoramica
I seguenti componenti di GKE su AWS supportano i volumi con crittografia CMK gestita dal cliente:
Volume root del bastion host
Volumi principali del servizio di gestione
Volumi di dati etcd del servizio di gestione
Volumi principali del control plane del cluster utente
Volumi di dati etcd del control plane del cluster utente
Volumi principali dei nodi del cluster utente
Specifica le chiavi nella configurazione del servizio di gestione, del cluster e del pool di nodi.
Prerequisiti
Per utilizzare la CMK gestita dal cliente per GKE sui volumi principali AWS, devi disporre di quanto segue:
Le chiavi AWS KMS devono avere un criterio delle chiavi che consenta a GKE su AWS di creare e leggere volumi criptati con una CMK gestita dal cliente. Nella sezione seguente è riportato un criterio di esempio. Per creare il criterio, segui questi passaggi:
Dalla directory anthos-aws, utilizza
terraform per ottenere l'ID del servizio di gestione.
cd anthos-aws
terraform output cluster_id
L'output include l'ID del servizio di gestione. Nell'esempio seguente, l'ID è
gke-12345abc.
{"Version":"2012-10-17","Id":"key-consolepolicy-3","Statement":[{"Sid":"Enable IAM User Permissions","Effect":"Allow","Principal":{"AWS":"arn:aws:iam::ACCOUNT_NUMBER:root"},"Action":"kms:*","Resource":"*"},{"Sid":"Allow creating encrypted EBS volumes for EC2 use","Effect":"Allow","Principal":{"AWS":["arn:aws:iam::ACCOUNT_NUMBER:role/gke-CLUSTER_ID-management","arn:aws:iam::ACCOUNT_NUMBER:user/AWS_USER","arn:aws:iam::ACCOUNT_NUMBER:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling"]},"Action":["kms:GenerateDataKeyWithoutPlaintext","kms:Decrypt"],"Resource":"*","Condition":{"StringEquals":{"kms:CallerAccount":"ACCOUNT_NUMBER","kms:ViaService":"ec2.AWS_REGION.amazonaws.com"}}},{"Sid":"Allow attaching encrypted EBS volumes for EC2 Use","Effect":"Allow","Principal":{"AWS":["arn:aws:iam::ACCOUNT_NUMBER:role/CLUSTER_ID-management","arn:aws:iam::ACCOUNT_NUMBER:role/CLUSTER_ID-controlplane","arn:aws:iam::ACCOUNT_NUMBER:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling"]},"Action":["kms:CreateGrant","kms:ListGrants","kms:RevokeGrant"],"Resource":"*","Condition":{"StringEquals":{"kms:CallerAccount":"ACCOUNT_NUMBER","kms:ViaService":"ec2.AWS_REGION.amazonaws.com"}}}]}
Sostituisci quanto segue:
ACCOUNT_NUMBER: il numero del tuo account AWS, ad esempio 1234567890.
CLUSTER_ID: l'ID del tuo cluster di gestione GKE su AWS, ad esempio gke-12345678.
AWS_USER: il tuo nome utente AWS.
AWS_REGION: la regione AWS in cui vengono eseguiti i cluster GKE su AWS, ad esempio us-east1.
Configurazione delle risorse per l'utilizzo di una CMK gestita dal cliente
Questa sezione spiega come configurare la CMK gestita dal cliente per i componenti GKE su AWS. Prima di eseguire l'upgrade dei componenti esistenti, consulta
Utilizzare CMK con i cluster esistenti.
Bastion host e servizio di gestione
Configura una CMK gestita dal cliente per il volume principale dell'bastion host, il volume principale del servizio di gestione e i volumi di dati etcd del servizio di gestione in anthos-gke.yaml prima di configurare il servizio di gestione. Per ulteriori informazioni, consulta Integrazione dell'infrastruttura esistente e la documentazione di riferimento di AWSManagementService.
Volumi del piano di controllo del cluster utente
Configura una CMK gestita dal cliente per il piano di controllo del cluster utente e per i volumi di dati etcd nella definizione AWSCluster. Per ulteriori informazioni, consulta Creare un cluster di utenti personalizzato.
Puoi aggiungere la configurazione del CMK gestita dal cliente ai seguenti componenti esistenti:
Volume root del bastion host
Volumi principali del servizio di gestione
Volumi principali del control plane del cluster utente
Volumi principali dei nodi del cluster utente
GKE su AWS ricrea questi volumi dopo un upgrade o una modifica della configurazione. Per aggiungere la configurazione delle CMK gestite dal cliente ai componenti esistenti, segui le istruzioni riportate in Upgrade di GKE su AWS. Quando
modifichi la configurazione della risorsa, modifica i seguenti campi:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# Using a customer managed CMK to encrypt volumes\n\nGKE on AWS uses the AWS Key Management Service (KMS) to encrypt\nEBS volumes. GKE on AWS 1.7 and higher supports encrypting volumes\nwith customer managed\n[Customer Master Keys](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk)\n(CMKs). GKE on AWS versions 1.6.x and lower support\n[AWS Managed Customer Master Keys](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk) only.\n\nThis topic describes how to set up customer managed CMK to encrypt volumes. If\nyou don't set up customer managed CMK, GKE on AWS uses AWS managed\nCMKs by default.\n\nOverview\n--------\n\nThe following GKE on AWS components support customer managed\nCMK encrypted volumes:\n\n- Bastion host root volume\n- Management service root volumes\n- Management service etcd data volumes\n- User cluster control plane root volumes\n- User cluster control plane etcd data volumes\n- User cluster node root volumes\n\nYou specify keys in your management service, cluster, and node pool\nconfiguration.\n\nPrerequisites\n-------------\n\nTo use customer managed CMK for GKE on AWS root volumes, you need the following:\n\n- Permissions to create or use an AWS KMS key policy. For more information, see [Using key policies in AWS KMS](https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html).\n\nCreate a key policy\n-------------------\n\nYour AWS KMS keys must have a key policy that allows GKE on AWS to\ncreate and read volumes encrypted with a customer managed CMK. An example policy\nis provided in the following section. To create the policy, perform the\nfollowing the steps:\n\n1. From your `anthos-aws` directory, use\n `terraform` to get the ID of your management service.\n\n ```sh\n cd anthos-aws\n terraform output cluster_id\n ```\n The output includes your management service ID. In the example below, the ID is `gke-12345abc`. \n\n terraform output cluster_id\n gke-12345abc\n\n \u003cbr /\u003e\n\n2. [Create an AWS KMS key policy](https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html)\n with the following contents:\n\n {\n \"Version\": \"2012-10-17\",\n \"Id\": \"key-consolepolicy-3\",\n \"Statement\": [\n {\n \"Sid\": \"Enable IAM User Permissions\",\n \"Effect\": \"Allow\",\n \"Principal\": {\n \"AWS\": \"arn:aws:iam::\u003cvar translate=\"no\"\u003eACCOUNT_NUMBER\u003c/var\u003e:root\"\n },\n \"Action\": \"kms:*\",\n \"Resource\": \"*\"\n },\n {\n \"Sid\": \"Allow creating encrypted EBS volumes for EC2 use\",\n \"Effect\": \"Allow\",\n \"Principal\": {\n \"AWS\": [\n \"arn:aws:iam::\u003cvar translate=\"no\"\u003eACCOUNT_NUMBER\u003c/var\u003e:role/gke-\u003cvar translate=\"no\"\u003eCLUSTER_ID\u003c/var\u003e-management\",\n \"arn:aws:iam::\u003cvar translate=\"no\"\u003eACCOUNT_NUMBER\u003c/var\u003e:user/\u003cvar translate=\"no\"\u003eAWS_USER\u003c/var\u003e\",\n \"arn:aws:iam::\u003cvar translate=\"no\"\u003eACCOUNT_NUMBER\u003c/var\u003e:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling\"\n ]\n },\n \"Action\": [\n \"kms:GenerateDataKeyWithoutPlaintext\",\n \"kms:Decrypt\"\n ],\n \"Resource\": \"*\",\n \"Condition\": {\n \"StringEquals\": {\n \"kms:CallerAccount\": \"\u003cvar translate=\"no\"\u003eACCOUNT_NUMBER\u003c/var\u003e\",\n \"kms:ViaService\": \"ec2.\u003cvar translate=\"no\"\u003eAWS_REGION\u003c/var\u003e.amazonaws.com\"\n }\n }\n },\n {\n \"Sid\": \"Allow attaching encrypted EBS volumes for EC2 Use\",\n \"Effect\": \"Allow\",\n \"Principal\": {\n \"AWS\": [\n \"arn:aws:iam::\u003cvar translate=\"no\"\u003eACCOUNT_NUMBER\u003c/var\u003e:role/\u003cvar translate=\"no\"\u003eCLUSTER_ID\u003c/var\u003e-management\",\n \"arn:aws:iam::\u003cvar translate=\"no\"\u003eACCOUNT_NUMBER\u003c/var\u003e:role/\u003cvar translate=\"no\"\u003eCLUSTER_ID\u003c/var\u003e-controlplane\",\n \"arn:aws:iam::\u003cvar translate=\"no\"\u003eACCOUNT_NUMBER\u003c/var\u003e:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling\"\n ]\n },\n \"Action\": [\n \"kms:CreateGrant\",\n \"kms:ListGrants\",\n \"kms:RevokeGrant\"\n ],\n \"Resource\": \"*\",\n \"Condition\": {\n \"StringEquals\": {\n \"kms:CallerAccount\": \"\u003cvar translate=\"no\"\u003eACCOUNT_NUMBER\u003c/var\u003e\",\n \"kms:ViaService\": \"ec2.\u003cvar translate=\"no\"\u003eAWS_REGION\u003c/var\u003e.amazonaws.com\"\n }\n }\n }\n ]\n }\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eACCOUNT_NUMBER\u003c/var\u003e: your AWS account number--- for example, `1234567890`.\n - \u003cvar translate=\"no\"\u003eCLUSTER_ID\u003c/var\u003e: your GKE on AWS management cluster ID--- for example `gke-12345678`.\n - \u003cvar translate=\"no\"\u003eAWS_USER\u003c/var\u003e: your AWS user name.\n - \u003cvar translate=\"no\"\u003eAWS_REGION\u003c/var\u003e: The AWS region where your GKE on AWS clusters run--- for example `us-east1`.\n\nConfiguring resources to use a customer managed CMK\n---------------------------------------------------\n\nThis section explains how to configure customer managed CMK for\nGKE on AWS components. Before upgrading existing components, see\n[Using CMK with existing clusters](#upgrade-existing).\n\n### Bastion host and management service\n\nYou configure a customer managed CMK for your bastion host root volume,\nmanagement service root volume, and management service etcd data volumes in your\n`anthos-gke.yaml` before setting up the management service. For more\ninformation, see,\n[Integrating existing infrastructure](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/integrating-existing-infrastructure)\nand the\n[AWSManagementService](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/reference/awsmanagementservice#rootvolume)\nreference.\n\n### User cluster control plane volumes\n\nYou configure a customer managed CMK for your user cluster control plane and\netcd data volumes in your [AWSCluster](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/reference/awscluster)\ndefinition. For more information, see\n[Creating a custom user cluster](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/creating-custom-user-cluster).\n\n### User cluster node root volumes\n\nYou configure a customer managed CMK on user cluster node root volumes in your\n[AWSNodePool](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/reference/awsnodepools)\ndefinition. For more information, see\n[Creating a custom user cluster](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/creating-custom-user-cluster).\n\n### Using CMK with existing clusters\n\n| **Caution:** If you enable a customer managed CMK on an existing management service or user cluster control plane *etcd* data volume, you will lose cluster configuration. To encrypt etcd data volumes, you must create a new management service or user clusters.\n\nYou can add customer managed CMK configuration to the following existing\ncomponents:\n\n- Bastion host root volume\n- Management service root volumes\n- User cluster control plane root volumes\n- User cluster node root volumes\n\nGKE on AWS recreates these volumes after an upgrade or configuration\nchange. To add customer managed CMK configuration to existing components,\nfollow the instructions in\n[Upgrading GKE on AWS](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/upgrading). When you\nmodify your resource configuration, modify the following fields:\n\nWhen you complete the upgrade, GKE on AWS creates new resources with\nthe customer managed CMK volumes attached.\n\nWhat's next\n-----------\n\n- [Create a custom user cluster](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/creating-custom-user-cluster).\n- [Upgrade GKE on AWS](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/upgrading)"]]