EKS encryption key configuration needs review

Distinguish EKS default encryption from requirements for a customer-managed KMS key.

Description

EKS encrypts the etcd disks of every cluster. On Kubernetes 1.28 and later, an AWS owned key also provides envelope encryption for all Kubernetes API data when EncryptionConfig is omitted. Check node and EBS volume encryption separately.

Potential impact

Use a customer managed KMS key if you must control the key policy and lifecycle. Disabling or deleting that key, or revoking required permissions, can interrupt cluster operations.

Remediation

Give EKS access to a symmetric key in the cluster’s Region and specify Provider.KeyArn and Resources: [secrets] in EncryptionConfig. On 1.28 and later, all API data is covered even though the list names only secrets. Changing this property in an existing stack replaces the cluster. Review the change set. To keep the original running, create the new cluster as a separate resource and verify its key ARN and workloads before switching.

Examples

Supply a supported Kubernetes version, cluster role, security groups and subnets in different Availability Zones. Both examples use dev, so choose distinct names to run both clusters during migration. Manage Kubernetes access permissions separately.

Using an AWS-owned key

yaml
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
  KubernetesVersion:
    Type: String
  ClusterRoleArn:
    Type: String
  ClusterSecurityGroups:
    Type: List<AWS::EC2::SecurityGroup::Id>
  ClusterSubnets:
    Type: List<AWS::EC2::Subnet::Id>
Resources:
  MyEKSClusterA:
    Type: AWS::EKS::Cluster
    Properties:
      Name: dev
      Version: !Ref KubernetesVersion
      RoleArn: !Ref ClusterRoleArn
      ResourcesVpcConfig:
        SecurityGroupIds: !Ref ClusterSecurityGroups
        SubnetIds: !Ref ClusterSubnets

Specifying a customer-managed key

yaml
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
  EncryptionKeyArn:
    Type: String
  KubernetesVersion:
    Type: String
  ClusterRoleArn:
    Type: String
  ClusterSecurityGroups:
    Type: List<AWS::EC2::SecurityGroup::Id>
  ClusterSubnets:
    Type: List<AWS::EC2::Subnet::Id>
Resources:
  MyEKSClusterA:
    Type: AWS::EKS::Cluster
    Properties:
      Name: dev
      Version: !Ref KubernetesVersion
      RoleArn: !Ref ClusterRoleArn
      ResourcesVpcConfig:
        SecurityGroupIds: !Ref ClusterSecurityGroups
        SubnetIds: !Ref ClusterSubnets
      EncryptionConfig:
        - Provider:
            KeyArn: !Ref EncryptionKeyArn
          Resources:
            - secrets

References