EKS Secrets Encryption Disabled
eks-secrets-encryption-disabled
What this rule checks
Detects EKS clusters without envelope encryption for Kubernetes secrets in etcd.
How to fix it
- 1Configure EncryptionConfig with a KMS key referencing resources: ["secrets"]
import { aws_ec2 as ec2, aws_eks as eks, aws_iam as iam } from 'aws-cdk-lib';
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
const role = new iam.Role(this, 'EksRole', { assumedBy: new iam.ServicePrincipal('eks.amazonaws.com') });
new eks.CfnCluster(this, 'Cluster', {
roleArn: role.roleArn,
resourcesVpcConfig: { subnetIds: vpc.privateSubnets.map((s) => s.subnetId) },
});import { aws_ec2 as ec2, aws_eks as eks, aws_iam as iam, aws_kms as kms } from 'aws-cdk-lib';
const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
const role = new iam.Role(this, 'EksRole', { assumedBy: new iam.ServicePrincipal('eks.amazonaws.com') });
const key = new kms.Key(this, 'SecretsKey');
new eks.CfnCluster(this, 'Cluster', {
roleArn: role.roleArn,
resourcesVpcConfig: { subnetIds: vpc.privateSubnets.map((s) => s.subnetId) },
encryptionConfig: [{ resources: ['secrets'], provider: { keyArn: key.keyArn } }],
});CDK Insights pinpoints the exact file and line in your CDK source for every finding, so you can jump straight to the fix.
Affected resource types
AWS::EKS::ClusterIntentional? Suppress this finding
Sometimes a flag is deliberate — a genuinely public endpoint, say. You can dismiss eks-secrets-encryption-disabled and the reason is kept in the report, not silently hidden.
In .cdk-insights.json:
{
"ignoreRules": [
{ "id": "eks-secrets-encryption-disabled", "reason": "Why this is intentional" }
]
}Or inline in your CDK code:
Validations.of(scope).acknowledge({
id: 'cdk-insights::eks-secrets-encryption-disabled',
reason: 'Why this is intentional',
});Use the rule ID eks-secrets-encryption-disabled shown above — not the CDK-* ID from SARIF / GitHub code scanning. To dismiss every finding on one construct instead, use ignorePaths. Suppression docs →
Catch this in your stack
$ npx cdk-insights scanCDK Insights runs this and 118+ other rules locally against your synthesised CDK app — free, no account, your code never leaves your machine.