Amazon EKS runs the Kubernetes control plane for you, but that is only half of the shared responsibility model. Access, nodes, pods, encryption and monitoring are still yours.
That is where teams slip. Wiz's 2025 Kubernetes Security Report, based on more than 200,000 cloud accounts, found that new EKS clusters were targeted within 28 minutes of creation, and that 81% of EKS clusters still used the deprecated ConfigMap authentication mode. Red Hat's 2024 survey found that 89% of organizations had a container or Kubernetes security incident in the past year.
This post is a checklist of eight controls. Each one has how to set it, a command that proves it, and what a failure looks like. A script at the end checks the provable ones before go-live.
Group 1: Lock the door
1. Close the API endpoint
By default, a new cluster's API server is reachable from the internet. Turn on private access, then either turn public access off or limit it to your own CIDR blocks.
aws eks update-cluster-config --name my-cluster \ --resources-vpc-config endpointPrivateAccess=true,endpointPublicAccess=false If you keep public access on, set publicAccessCidrs to your office or VPN range and keep private access on, so nodes still reach the API privately.
Prove it:
aws eks describe-cluster --name my-cluster \ --query 'cluster.resourcesVpcConfig.{private:endpointPrivateAccess,public:endpointPublicAccess,cidrs:publicAccessCidrs}' Fails if: public is true and cidrs contains 0.0.0.0/0.
2. Use access entries, and drop the creator's admin rights
Access entries are the EKS API for granting IAM principals access to Kubernetes. Set the authentication mode to API so the old aws-auth ConfigMap is out of the picture, grant people and roles through entries with scoped policies, and do not leave the cluster creator as a permanent cluster admin.
aws eks update-cluster-config --name my-cluster \ --access-config authenticationMode=API Create the entries you need first, so you do not lock yourself out, and note that you cannot change the mode back to one without the EKS API.
Prove it:
aws eks describe-cluster --name my-cluster --query 'cluster.accessConfig' aws eks list-access-entries --cluster-name my-cluster Fails if: the mode is CONFIG_MAP, or you cannot explain every entry in the list.
Group 2: Protect the data
3. Encrypt Kubernetes data with your own KMS key
On Kubernetes 1.28 and later, EKS envelope-encrypts all API data by default. Adding your own KMS key gives you control over the key policy and an audit trail of its use.
aws eks associate-encryption-config --cluster-name my-cluster \ --encryption-config '[{"resources":["secrets"],"provider":{"keyArn":"arn:aws:kms:us-east-1:111122223333:key/example"}}]' Two warnings before you run it. You cannot disable the encryption once it is on, and if the KMS key is ever deleted, AWS says there is no way to recover the cluster. Use a dedicated key, protect it from deletion and review who can administer it.
Prove it:
aws eks describe-cluster --name my-cluster --query 'cluster.encryptionConfig' Fails if: the result is empty on a cluster where you were told a customer key is in use.
Group 3: Contain the pods
4. Stop pods from reaching the node's metadata service
Pods that can read the instance metadata service can borrow the node's IAM credentials. Require IMDSv2 and set the hop limit to 1 in your node launch template:
resource "aws_launch_template" "eks_nodes" { name = "eks-nodes" metadata_options { http_tokens = "required" http_put_response_hop_limit = 1 } } Test this on a development cluster first. Add-ons that read instance metadata, such as the EBS CSI driver, can log errors or start slowly when the hop limit is 1, and some node tooling expects 2. Give workloads their credentials through Pod Identity or IRSA so they never need the metadata service.
Prove it:
kubectl run imds-test --rm -it --restart=Never --image=curlimages/curl -- \ curl -s -m 3 http://169.254.169.254/latest/meta-data/ Fails if: you get any metadata back from a pod that does not use host networking.
5. Enforce Pod Security Admission
The built-in Pod Security Admission controller checks pods against the Pod Security Standards using labels on the namespace. A sensible start is to block anything below baseline and warn about anything below restricted:
apiVersion: v1 kind: Namespace metadata: name: orders labels: pod-security.kubernetes.io/enforce: baseline pod-security.kubernetes.io/warn: restricted pod-security.kubernetes.io/audit: restricted Move to enforce: restricted once the warnings are quiet. System namespaces may need looser settings, so label those deliberately rather than leaving them unlabelled.
Prove it: ask the API server to dry-run a privileged pod:
cat <<'EOF' | kubectl -n orders apply --dry-run=server -f - apiVersion: v1 kind: Pod metadata: name: privileged-test spec: containers: - name: test image: nginx securityContext: privileged: true EOF Fails if: the pod is accepted.
Group 4: Watch everything
6. Turn on all control plane logs
Control plane logging is off by default. Enable all five types, and set a retention period on the log group so costs do not grow forever.
aws eks update-cluster-config --name my-cluster \ --logging '{"clusterLogging":[{"types":["api","audit","authenticator","controllerManager","scheduler"],"enabled":true}]}' aws logs put-retention-policy \ --log-group-name /aws/eks/my-cluster/cluster --retention-in-days 90 These logs are billed as CloudWatch storage, so budget for them. The audit log is the one that matters most for security, because it records who did what through the Kubernetes API.
Prove it:
aws eks describe-cluster --name my-cluster --query 'cluster.logging.clusterLogging' Fails if: audit is not in an enabled group. AWS Security Hub has a control (EKS.8) that checks this for you across accounts.
7. Turn on GuardDuty for EKS
GuardDuty has two EKS features, and they cover different layers:
- EKS Protection reads your audit logs and raises findings for suspicious API activity. It uses its own log stream, so you do not need to wire anything up.
- Runtime Monitoring runs an agent, installed as an EKS add-on, that watches processes, files and network connections inside containers.
Enable both. An audit finding such as a pod launched with elevated privileges and a runtime finding about that pod's behavior reinforce each other.
resource "aws_guardduty_detector" "main" { enable = true } resource "aws_guardduty_detector_feature" "eks_audit" { detector_id = aws_guardduty_detector.main.id name = "EKS_AUDIT_LOGS" status = "ENABLED" } resource "aws_guardduty_detector_feature" "eks_runtime" { detector_id = aws_guardduty_detector.main.id name = "EKS_RUNTIME_MONITORING" status = "ENABLED" additional_configuration { name = "EKS_ADDON_MANAGEMENT" status = "ENABLED" } } Check the Terraform provider documentation for the current feature names before you apply this.
Prove it:
kubectl get pods -A | grep -i guardduty You should see the agent running. The runtime agent is not available on EKS hybrid nodes.
8. Route the findings to a person
A finding nobody sees is not a control. GuardDuty publishes every finding to EventBridge, so one rule can send the serious ones to an SNS topic that pages or emails your team:
aws events put-rule --name guardduty-high-severity \ --event-pattern '{ "source": ["aws.guardduty"], "detail-type": ["GuardDuty Finding"], "detail": { "severity": [{"numeric": [">=", 7]}] } }' aws events put-targets --rule guardduty-high-severity \ --targets "Id"="1","Arn"="arn:aws:sns:us-east-1:111122223333:security-alerts" The SNS topic also needs a policy that lets EventBridge publish to it.
Prove it: generate a sample finding and see whether the alert arrives:
aws guardduty create-sample-findings --detector-id <detector-id> \ --finding-types "Execution:Kubernetes/ExecInKubeSystemPod" Fails if: nothing reaches your inbox or chat within a few minutes. Test the alert path now, not during an incident.
Early warnings you can search for today
GuardDuty finds known bad patterns. The audit log lets you ask your own questions. In CloudWatch Logs Insights, select the log group /aws/eks/my-cluster/cluster and try these three. They are worth saving as queries, and the first two make good metric filters and alarms.
Anyone running a command inside a pod:
fields @timestamp, user.username, objectRef.namespace, objectRef.name | filter @logStream like /kube-apiserver-audit/ | filter verb = "create" and objectRef.subresource = "exec" | sort @timestamp desc | limit 50 Spikes of forbidden requests, which often mean someone is probing permissions:
fields user.username | filter @logStream like /kube-apiserver-audit/ | filter responseStatus.code = 403 | stats count() as denied by user.username | sort denied desc Who is reading secrets:
fields @timestamp, user.username, objectRef.namespace, objectRef.name | filter @logStream like /kube-apiserver-audit/ | filter objectRef.resource = "secrets" and verb in ["get", "list"] | sort @timestamp desc | limit 50 Changes to cluster access, such as new access entries, are EKS API calls, so they show up in CloudTrail rather than in the Kubernetes audit log.
The gate
Run this before every go-live. It covers the checks that can be read straight from the cluster description:
#!/usr/bin/env bash set -u C="${1:?usage: gate.sh <cluster-name>}" q() { aws eks describe-cluster --name "$C" --query "$1" --output text; } ok() { echo "PASS $1"; } no() { echo "FAIL $1"; } [ "$(q cluster.resourcesVpcConfig.endpointPrivateAccess)" = "True" ] \ && ok "private endpoint on" || no "private endpoint on" if [ "$(q cluster.resourcesVpcConfig.endpointPublicAccess)" = "False" ] \ || [ "$(q cluster.resourcesVpcConfig.publicAccessCidrs)" != "0.0.0.0/0" ]; then ok "public endpoint closed or limited" else no "public endpoint open to the world" fi [ "$(q cluster.accessConfig.authenticationMode)" = "API" ] \ && ok "access entries only" || no "access entries only" aws eks describe-cluster --name "$C" \ --query 'cluster.logging.clusterLogging[?enabled==`true`].types[]' --output text \ | tr '\t' '\n' | grep -qx audit \ && ok "audit logging on" || no "audit logging on" [ -n "$(q 'cluster.encryptionConfig[0].provider.keyArn')" ] \ && [ "$(q 'cluster.encryptionConfig[0].provider.keyArn')" != "None" ] \ && ok "customer KMS key set" || no "customer KMS key set" The rest need a human or a test: the metadata test pod, the privileged-pod dry run, the GuardDuty agent, and the sample-finding alert.
Before go-live
Run the gate script, the metadata test, the privileged-pod dry run and the sample alert, and keep the output with your change record. Run them again after every cluster upgrade.