EKS Security Optimizer
What this skill does
Translates an EKS cluster's security configuration into a concrete
hardening recommendation with severity ratings and exact remediation
steps. The verdict is the highest-leverage action across eight
dimensions — pod security standards, IAM identity, network policies,
secrets encryption, image scanning, runtime security, admission webhook
policies, and service mesh mTLS — applied in priority order by severity.
Always pairs the recommendation with exact kubectl and AWS CLI commands.
Quick navigation
| Section |
What it covers |
When to jump here |
| Quick start |
Five headline rules and the severity model |
First read |
| Mindset |
Why IRSA + PSA are the #1 levers |
Understanding the approach |
| Quick reference — verdict thresholds |
Decision matrix at a glance |
Classifying a cluster |
| Pre-flight data gate |
Cluster config, addon status, findings |
Before any recommendation |
| Step 0 non-obvious behaviours |
PSA replacement of PSP, Pod Identity, IMDSv2 |
Edge cases |
| Step 1 Pod Security Standards |
PSA privileged/baseline/restricted |
Workload isolation |
| Step 2 IAM identity |
IRSA vs node role vs Pod Identity |
Least privilege |
| Step 3 Network policies |
Calico/Cilium, default deny |
East-west segmentation |
| Step 4 Secrets encryption |
KMS envelope encryption |
Secret protection |
| Step 5 Image scanning |
ECR scan-on-push, Inspector |
Vulnerability detection |
| Step 6 Runtime security |
GuardDuty EKS, Falco |
Threat detection |
| Step 7 Admission policies |
OPA Gatekeeper / Kyverno |
Policy-as-code |
| Step 8 Service mesh mTLS |
App Mesh, Istio, ACM PCA |
Pod-to-pod encryption |
| Step 9 Impact estimation |
Severity scoring |
Every recommendation |
| Output format |
VERDICT block + worked examples |
Emitting the result |
| Anti-Patterns — NEVER |
Common misclassifications |
Self-check before emit |
| Pre-flight safety checks |
CONFIRM gate, canary deploy, rollback |
Before any apply |
Quick start
- IRSA over node IAM role is the #1 IAM lever. When all pods use
the node IAM role, every pod has every AWS permission the node has.
IRSA scopes IAM permissions to individual Kubernetes service accounts,
achieving true least privilege. EKS Pod Identity (2024) is the newer,
simpler alternative to IRSA.
- Pod Security Admission replaced PodSecurityPolicy. PSP was removed
in Kubernetes 1.25. PSA enforces privileged/baseline/restricted
profiles at the namespace level via labels. Restricted is the target
for production workloads.
- Default network policy is allow-all. Without Calico or Cilium
network policies, any pod can reach any other pod. A default-deny
policy is the minimum baseline for production clusters.
- KMS secrets encryption is one command.
eks update-cluster-config --encryption-config enables KMS envelope encryption for Kubernetes
secrets. Without it, secrets are encrypted with a shared key that any
cluster user can access.
- IMDSv2 enforcement prevents credential theft. Pod access to the
node's IMDS (Instance Metadata Service) allows credential theft.
Enforce IMDSv2 (which requires token-based requests) and set
hop-limit=1 to block pod access.
Mindset
Moved verbatim to references/advanced-patterns.md — see "Mindset — four principles" (load on demand).
Applies when: you need the reasoning behind the highest-leverage-first approach.
Quick reference — verdict thresholds
| Observation |
Verdict |
Recommendation |
| Pod Security Admission not configured (no PSS labels on namespaces) |
FURTHER_OPTIMIZATION_AVAILABLE (pod security) |
Step 1 — enable PSA with baseline/restricted profiles |
| Pods using node IAM role (IRSA not configured for most namespaces) |
FURTHER_OPTIMIZATION_AVAILABLE (IAM) |
Step 2 — migrate to IRSA or EKS Pod Identity |
| No network policies (default allow all east-west traffic) |
FURTHER_OPTIMIZATION_AVAILABLE (network) |
Step 3 — install Calico/Cilium, apply default deny |
| KMS secrets encryption not enabled (uses default encryption) |
FURTHER_OPTIMIZATION_AVAILABLE (secrets) |
Step 4 — enable KMS envelope encryption |
| ECR scan-on-push disabled OR images with CRITICAL findings deployed |
FURTHER_OPTIMIZATION_AVAILABLE (images) |
Step 5 — enable scan-on-push, block CRITICAL findings |
| GuardDuty EKS runtime monitoring not enabled |
FURTHER_OPTIMIZATION_AVAILABLE (runtime) |
Step 6 — enable GuardDuty EKS runtime protection |
| No admission webhook (Gatekeeper/Kyverno) for policy enforcement |
FURTHER_OPTIMIZATION_AVAILABLE (admission) |
Step 7 — deploy Gatekeeper or Kyverno with baseline policies |
| mTLS not enforced between pods (no service mesh or mutual TLS) |
FURTHER_OPTIMIZATION_AVAILABLE (mTLS) |
Step 8 — deploy App Mesh or Istio with mTLS |
| API server endpoint public (0.0.0.0/0) AND no private endpoint |
FURTHER_OPTIMIZATION_AVAILABLE (API server) |
Restrict endpoint or enable private endpoint |
| IMDSv2 not enforced (IMDSv1 accessible, hop-limit > 1) |
FURTHER_OPTIMIZATION_AVAILABLE (IMDS) |
Enforce IMDSv2, set hop-limit=1 |
| Audit logging disabled OR missing critical log types |
FURTHER_OPTIMIZATION_AVAILABLE (logging) |
Enable all log types (api, audit, authenticator, etc.) |
| All dimensions verified AND PSA enforced AND IRSA on all namespaces AND network policies in place |
OPTIMIZED |
None — continue monitoring |
Pre-flight: data gate (run before any optimization decision)
Security assessment is only as good as the underlying data. Pull these
inputs before any recommendation. Full CLI sequences are in
references/eks-security-config-reference.md.
Required data sources (summarized — see reference for full CLI):
Moved verbatim to references/eks-security-config-reference.md — see "Pre-flight data gate — required data sources" (load on demand).
Applies when: gathering the nine pre-flight data sources on a live account.
Data-quality short-circuits
| Condition |
Effect on optimization |
describe-cluster fails (cluster not found) |
NEED_MORE_INFO. Verify cluster name and region. |
| kubectl not configured or context wrong |
Fall back to AWS CLI only; mark network/pod findings MEDIUM confidence. |
| GuardDuty detector not enabled |
Cannot assess runtime threats. Surface as finding: "enable GuardDuty." |
| ECR repository not using scan-on-push |
Cannot assess image vulnerabilities. Surface as finding. |
logging.clusterLogging shows disabled types |
Surface as finding; cannot correlate events without audit logs. |
Process — Optimization logic (apply in order)
Step 0: Non-obvious behaviours that change the recommendation
These operational gotchas route a recommendation away from the obvious:
Moved verbatim to references/advanced-patterns.md — see "Step 0 — non-obvious behaviours that change the recommendation" (load on demand).
Applies when: a recommendation hinges on PSA/PSP, Pod Identity, IMDSv2 hop-limit, KMS re-encryption, audit-log cost, or IRSA audience behaviour.
Step 1: Pod Security Standards (PSA)
PSA enforces three profiles at the namespace level via labels:
| Profile |
What it blocks |
Target workloads |
| privileged |
Nothing (all capabilities allowed) |
System namespaces (kube-system) |
| baseline |
Privilege escalation, host PID/IPC, hostNetwork, additional capabilities |
Non-production, legacy |
| restricted |
All of baseline + runAsNonRoot required, seccomp required, specific capabilities dropped |
Production workloads |
Enforcement modes:
enforce — rejects pods that violate the profile
audit — logs violations but allows the pod
warn — warns the user but allows the pod
Recommendation: Apply baseline as enforce on all namespaces,
restricted as audit on production namespaces, and restricted as
enforce on new namespaces.
Moved verbatim to references/eks-security-config-reference.md — see "Step 1 — PSA namespace labels (bash)" (load on demand).
Applies when: applying PSA labels to a namespace.
Step 2: IAM identity (IRSA / Pod Identity)
Node IAM role problem: All pods inherit the node IAM role's
permissions. If the node role has s3:*, every pod can access S3.
IRSA solution: Creates a 1:1 mapping between a Kubernetes ServiceAccount
and an IAM Role via OIDC federation. Pods using that ServiceAccount get
only the IAM role's scoped permissions.
EKS Pod Identity (2024): Simpler alternative to IRSA using an
agent-based approach. No OIDC provider required.
Moved verbatim to references/eks-security-config-reference.md — see "Step 2 — IRSA / Pod Identity detection (bash)" (load on demand).
Applies when: detecting which service accounts use IRSA or Pod Identity.
Recommendation: Migrate all non-system workloads from node IAM role
to IRSA or Pod Identity. For new clusters, use Pod Identity. For existing
clusters, migrate incrementally.
Moved verbatim to references/eks-security-config-reference.md — see "Step 2 — IRSA setup (bash)" (load on demand).
Applies when: creating an IRSA role and annotating a service account.
Step 3: Network policies (east-west segmentation)
Without network policies, any pod can reach any other pod in the cluster.
This enables lateral movement after a single pod compromise.
Moved verbatim to references/eks-security-config-reference.md — see "Step 3 — Calico/Cilium install + default-deny NetworkPolicy" (load on demand).
Applies when: installing a network-policy CNI or applying a default-deny baseline.
Then add explicit allow rules for required flows (e.g., frontend → backend
on port 8080).
Step 4: Secrets encryption (KMS envelope encryption)
Without KMS encryption, Kubernetes secrets are encrypted with a
cluster-wide key derivable by any etcd access. KMS envelope encryption
uses a customer-managed KMS key.
Moved verbatim to references/eks-security-config-reference.md — see "Step 4 — KMS detection + enable (bash)" (load on demand).
Applies when: detecting or enabling KMS secrets encryption.
Important: Existing secrets are NOT automatically re-encrypted. After
enabling, rotate secrets:
kubectl get secrets -A -o json | kubectl replace -f -
Step 5: Image scanning (ECR scan-on-push)
Without image scanning, vulnerable container images are deployed without
detection.
Moved verbatim to references/eks-security-config-reference.md — see "Step 5 — ECR scanning detection + enable (bash)" (load on demand).
Applies when: detecting or enabling ECR scan-on-push / enhanced scanning.
Block CRITICAL findings at admission: Use Gatekeeper or Kyverno to
verify image scan status before allowing deployment.
Step 6: Runtime security (GuardDuty EKS)
GuardDuty EKS runtime monitoring detects:
- Credential theft (IMDS access from pods)
- Lateral movement (unexpected pod-to-pod connections)
- Anomalous process execution (reverse shells, cryptominers)
- Container escape attempts
Moved verbatim to references/eks-security-config-reference.md — see "Step 6 — enable GuardDuty EKS runtime (bash)" (load on demand).
Applies when: enabling the GuardDuty EKS runtime addon.
Ensure the GuardDuty detector is enabled and EKS runtime coverage is
active in the GuardDuty console.
Step 7: Admission webhook policies (OPA Gatekeeper / Kyverno)
Admission webhooks enforce policy-as-code at pod creation time. This is
the Kubernetes-native way to prevent misconfigured workloads.
Moved verbatim to references/eks-security-config-reference.md — see "Step 7 — install Gatekeeper / Kyverno (bash)" (load on demand).
Applies when: installing Gatekeeper or Kyverno.
Baseline policies to enforce:
- Disallow privileged containers
- Disallow hostPath volumes
- Require resource limits
- Require image scan verification (ECR)
- Disallow default namespace for production workloads
Step 8: Service mesh mTLS
Service mesh mTLS encrypts pod-to-pod communication and authenticates
workload identity. Without mTLS, any pod on the network can impersonate
any other pod.
Moved verbatim to references/eks-security-config-reference.md — see "Step 8 — install App Mesh / Istio (bash)" (load on demand).
Applies when: installing a service mesh for mTLS.
ACM PCA for certificate authority: Use AWS Private Certificate
Authority for managed certificate issuance in the mesh.
Step 9: Severity scoring
Score each finding by severity to prioritize remediation:
| Severity |
Criteria |
Examples |
| CRITICAL |
Direct path to credential theft or cluster takeover |
Node IAM role on all pods, IMDSv1 accessible, API server public with no restrictions |
| HIGH |
Significant attack surface expansion |
No network policies, no PSA, no KMS secrets encryption, no image scanning |
| MEDIUM |
Defense-in-depth gap |
No GuardDuty runtime, no admission webhook, no mTLS, audit logging incomplete |
| LOW |
Hardening recommendation |
PSA warn instead of enforce, basic scan instead of enhanced |
Step 10: Final verdict
- Any dimension has a CRITICAL or HIGH finding → FURTHER_OPTIMIZATION_AVAILABLE.
- All CRITICAL/HIGH findings remediated, only MEDIUM/LOW remain → FURTHER_OPTIMIZATION_AVAILABLE.
- All dimensions verified (PSA enforced, IRSA on all namespaces, network policies in place, KMS encryption enabled, scanning active, GuardDuty enabled) → OPTIMIZED.
- Change applied and verified this session → OPTIMIZED (post-state).
- Data insufficient (cluster config absent, kubectl not available) → NEED_MORE_INFO.
Output format
TARGET: <cluster-name>
VERDICT: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE
REASON: <1-2 sentences naming the recommendation and the supporting data>
RECOMMENDATION:
Current: <PSA status>, <IAM status>, <network policy status>, <KMS status>, <scan status>, <runtime status>
Proposed: <specific changes per dimension>
Dimensions changed: <psa | iam | network | secrets | images | runtime | admission | mtls>
Dimensions checked: <list ALL eight, each ✓ (no finding) or → (finding)>
Confidence: <HIGH/MEDIUM/LOW> — <one-line rationale>
SEVERITY: <CRITICAL | HIGH | MEDIUM | LOW>
ESTIMATED_RISK: <1-2 sentences describing the attack scenario this finding exposes>
REMEDIATION_STEPS:
1. <specific action with CLI command>
2. <verification step>
CONFIRM: Before executing any state-changing CLI, emit and await operator
approval: "CONFIRM: About to <action> on <cluster-name> in <region>.
Proceed? (yes/no)"
Full worked examples (PSA enable, IRSA migration, network policy default
deny, already-secured, NEED_MORE_INFO, and end-to-end walkthrough) are
in references/worked-examples.md.
STRICT output contract
The rules below are hard constraints. Violating any one produces a
misclassification that breaks downstream security automation. Self-check
EVERY emitted block before returning.
Required output structure
Every response MUST be a single block using these literal labels, in this
order. Do NOT substitute markdown headings, camelCase, or bold variants.
TARGET: <cluster-name>
VERDICT: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE
REASON: <1-2 sentences naming the recommendation and the supporting data>
RECOMMENDATION:
Current: <PSA status>, <IAM status>, <network policy status>, <KMS status>, <scan status>, <runtime status>
Proposed: <specific changes per dimension>
Dimensions changed: <psa | iam | network | secrets | images | runtime | admission | mtls>
Dimensions checked: <list ALL eight, each ✓ (no finding) or → (finding)>
Confidence: <HIGH/MEDIUM/LOW> — <one-line rationale>
SEVERITY: <CRITICAL | HIGH | MEDIUM | LOW>
ESTIMATED_RISK: <1-2 sentences describing the attack scenario>
REMEDIATION_STEPS:
1. <specific action with CLI command>
2. <verification step>
CONFIRM: <confirmation prompt text>
FORBIDDEN output patterns
NEVER emit VERDICT: FURTHER_OPTIMIZATION_AVAILABLE without a
SEVERITY rating. Every finding must be scored CRITICAL/HIGH/MEDIUM/LOW.
NEVER recommend a security change without verifying it won't break
workloads. PSA enforce=restricted can reject running pods. Always
recommend audit mode first, then enforce after verifying no
violations.
NEVER emit scratch lines ("WAIT — let me check", "Hmm, I need to
verify") in the output. Finalize the assessment before emitting.
NEVER recommend IRSA migration without identifying all IAM
permissions each workload needs. An IRSA role with insufficient
permissions will cause pod failures.
NEVER omit a dimension from the RECOMMENDATION block. The
Dimensions checked line MUST list all eight dimensions, each marked
✓ (no finding) or → (finding).
NEVER recommend network policy default-deny without warning that
it will break existing traffic flows. Always apply in audit/test
mode first.
NEVER round severity down. If a finding could be CRITICAL or
HIGH, rate it CRITICAL. Under-rating security findings is worse than
over-rating.
Perfect example output — FURTHER_OPTIMIZATION_AVAILABLE
TARGET: prod-cluster-1
VERDICT: FURTHER_OPTIMIZATION_AVAILABLE
REASON: Production EKS cluster with no Pod Security Admission enforcement,
12 of 15 namespaces using node IAM role instead of IRSA, and no network
policies. A single pod compromise allows full cluster takeover via node
IAM credentials and unrestricted lateral movement.
RECOMMENDATION:
Current: PSA not configured, node IAM on 12/15 namespaces, no network policies, KMS not configured
Proposed: PSA baseline-enforce on all namespaces, IRSA on all non-system namespaces, Calico default-deny, KMS secrets encryption
Dimensions changed: psa (Step 1) + iam (Step 2) + network (Step 3) + secrets (Step 4)
Dimensions checked: psa → (not configured) iam → (node role on 12 ns)
network → (no policies) secrets → (no KMS) images ✓ (scan-on-push enabled)
runtime ✓ (GuardDuty enabled) admission ✓ (Gatekeeper deployed) mtls → (no mTLS)
Confidence: HIGH — cluster config verified via describe-cluster + kubectl
inspection; all findings confirmed against live state.
SEVERITY: CRITICAL
ESTIMATED_RISK: Node IAM role on all pods means any pod can assume the
node's AWS permissions. Combined with no network policies, an attacker
who compromises one pod can access all AWS resources the node IAM role
permits and move laterally to any other pod in the cluster.
REMEDIATION_STEPS:
1. Enable PSA baseline-enforce on all non-system namespaces:
kubectl label namespace <ns> pod-security.kubernetes.io/enforce=baseline
2. Create IRSA roles for the 12 namespaces and annotate service accounts:
kubectl annotate sa <sa> eks.amazonaws.com/role-arn=<role-arn> -n <ns>
3. Install Calico and apply default-deny per namespace:
helm install calico projectcalico/tigera-operator -n tigera-operator --create-namespace
4. Enable KMS secrets encryption:
aws eks update-cluster-config --name prod-cluster-1 --encryption-config '{...}'
5. Enable mTLS via App Mesh (MEDIUM priority, can be phased):
helm install appmesh appmesh/appmesh -n appmesh-system --create-namespace
CONFIRM: About to apply security hardening on prod-cluster-1 (PSA, IRSA,
network policies, KMS encryption). This will require pod restarts in
12 namespaces. Proceed? (yes/no)
Self-check before emit:
Verdict semantics
| Verdict |
When to emit |
FURTHER_OPTIMIZATION_AVAILABLE |
At least one dimension has a CRITICAL, HIGH, or MEDIUM finding. |
OPTIMIZED |
All dimensions verified (PSA enforced, IRSA/Pod Identity on all namespaces, network policies in place, KMS encryption enabled, scanning active, GuardDuty enabled, admission policies deployed). |
NEED_MORE_INFO |
Data gate failed: cluster not found, kubectl not configured, or critical config missing. |
Anti-Patterns — NEVER (top 5)
NEVER recommend PSA enforce mode without first running audit
mode. Enforce mode rejects pods that violate the profile, which can
break running workloads. Always audit first, identify violations,
fix them, then switch to enforce.
NEVER recommend IRSA migration without mapping all AWS permissions
each workload uses. The node IAM role may grant permissions the
workload relies on implicitly. The IRSA role must include all
required permissions or pods will fail with AccessDenied.
NEVER apply network policy default-deny in production without a
test period. Default-deny immediately breaks all non-explicitly-
allowed traffic. Apply in a staging namespace first, verify flows,
then roll out.
NEVER recommend enabling KMS encryption without warning that
existing secrets need re-encryption. New secrets are encrypted
with KMS, but existing secrets remain with the old encryption until
rotated.
NEVER recommend disabling the public API server endpoint without
verifying that kubectl access is available via VPN/bastion. Switching
to private-only endpoint immediately breaks all external kubectl
access.
Extended anti-patterns and error-handling tables in
references/eks-security-config-reference.md.
Pre-flight safety checks (run before any remediation CLI)
- MANDATORY CONFIRMATION GATE. Before any state-changing operation,
emit and await operator approval. Security changes can break workloads.
- PSA changes require audit-first. Never apply
enforce without
first running audit mode and resolving all violations.
- IRSA migration requires per-workload IAM policy mapping. Test each
namespace independently before cutover.
- Network policy changes require canary. Apply in a staging namespace
first; verify all required traffic flows before production rollout.
- KMS encryption requires cluster update. The cluster enters
UPDATING state during the KMS config change. Plan for brief
disruption.
- GuardDuty addon requires node IAM permissions. The
aws-guardduty-agent addon needs permissions to communicate with
GuardDuty. Verify the addon role before installation.
- Gatekeeper/Kyverno policies can block deployments. Test policies
in
warn or audit mode before switching to deny.
- Service mesh mTLS rollout should be progressive. Start with
permissive mTLS mode (accept both mTLS and plaintext), then switch
to strict after all workloads are enrolled.
- Bulk-operation limit: Process at most 3 security changes per
batch. Sort by severity (CRITICAL first), verify each batch before
proceeding.
Recent AWS features (2024-2026)
Moved verbatim to references/advanced-patterns.md — see "Recent AWS features (2024-2026)" (load on demand).
Applies when: the cluster uses Pod Identity, GuardDuty runtime monitoring, ECR enhanced scanning, Auto Mode, or VPC CNI network policies.
References
references/eks-security-config-reference.md — CLI commands for each
security dimension, IAM policy templates for IRSA, PSA label reference,
network policy examples, Calico/Cilium install guides, KMS encryption
setup, ECR scanning config, GuardDuty EKS setup, Gatekeeper/Kyverno
policy examples, error-handling tables, extended NEVER list.
references/worked-examples.md — full worked examples (PSA enable,
IRSA migration, network policy default deny, KMS encryption, already-
secured, NEED_MORE_INFO, end-to-end walkthrough).
References (load on demand)
- references/eks-security-config-reference.md — CLI commands for each security dimension (including the per-step bash blocks moved verbatim from this file), IAM policy templates, error-handling tables, extended NEVER list.
- references/worked-examples.md — full worked examples (PSA enable, IRSA migration, network policy default deny, KMS encryption, already-secured, NEED_MORE_INFO, end-to-end walkthrough).
- references/advanced-patterns.md — Step 0 non-obvious behaviours, mindset principles, and recent AWS features (moved verbatim from this file).
Domain
AWS CloudOps / EKS Container Security Optimization & Hardening.
AWS documentation
1---2name: eks-security-optimizer3description: 'Optimises Amazon EKS cluster security posture across eight dimensions: pod security standards (Pod Security Admission — privileged/baseline/restricted PSS profiles enforced via admission controller replacing deprecated PodSecurityPolicy), IAM identity (IRSA — IAM Roles for Service Accounts over node IAM role for least privilege; EKS Pod Identity as the newer alternative), network policies (Calico/Cilium network policies for east-west traffic segmentation; default deny recommended), secrets encryption (KMS envelope encryption for Kubernetes secrets via --encryption-config), image scanning (ECR scan-on-push with enhanced scanning via Inspector for vulnerability detection), runtime security (GuardDuty EKS runtime monitoring for lateral movement and credential theft detection; Falco for syscall-level detection), admission webhook policies (OPA Gatekeeper / Kyverno for policy-as-code enforcement), and service mesh mTLS (App Mesh or Istio with ACM PCA for mutual TLS between pods). Reads cluster configuration vi...'4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline classification works from pasted cluster configuration and kubectl output. Live-account optimization uses aws eks describe-cluster, aws eks list-addons, aws eks describe-addon, aws kms describe-key, aws ecr describe-images, aws ecr describe-image-scan-findings, aws guardduty list-findings, aws guardduty get-findings, kubectl get/describe/apply (kubectl v1.28+, AWS CLI v2, SSO or key-based credentials).6metadata:7 source: https://skillmd.com/skills/jhkchan/eks-security-optimizer8 domain: aws-cloudops9 complexity: medium10 requires_llm: 'true'11 phase: '3'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: Compute15 task_type: optimize16 skill_class: capability17 lifecycle_status: active18 verdict_shape: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE19 when_to_use: Optimising EKS security posture, triaging pod security standards, evaluating IRSA vs node IAM role, implementing network policies for east-west segmentation, enabling KMS secrets encryption, configuring ECR scan-on-push, enabling GuardDuty EKS runtime monitoring, deploying OPA Gatekeeper or Kyverno admission policies, implementing service mesh mTLS, preparing for compliance audit, or hardening a cluster before production.20 when_not_to_use: EKS cluster troubleshooting (pod crashes, scheduling failures, control plane errors — use the EKS troubleshooter), EC2 security group auditing (use ec2-security-audit), IAM policy analysis for non-EKS resources (use iam-policy-analyzer), or general Kubernetes application debugging. This skill focuses on security posture optimization, not functional debugging.21 activation_triggers: optimise EKS security, EKS pod security standards, EKS IRSA configuration, EKS Pod Identity, EKS network policies, EKS secrets encryption KMS, ECR scan-on-push, GuardDuty EKS runtime, OPA Gatekeeper EKS, Kyverno EKS policies, EKS service mesh mTLS, EKS audit logging, EKS IMDSv2 enforcement, EKS privilege escalation, EKS kubelet anonymous auth, EKS API server endpoint, EKS cluster hardening, container security review, EKS compliance audit22 invocation_schema: 'Input: either (a) a cluster identifier + live-account context, (b) a kubectl configuration dump, OR (c) a security finding document (GuardDuty/Inspector/Config) with cluster details. Output: a deterministic TARGET/VERDICT/REASON/RECOMMENDATION/ SEVERITY/REMEDIATION_STEPS block per cluster, where VERDICT is one of OPTIMIZED, FURTHER_OPTIMIZATION_AVAILABLE.'23 invocation_example: 'ClusterName: prod-cluster-12425 Region: us-east-12627 KubernetesVersion: 1.30282930 Pod Security Admission: not configured (no PSS profiles enforced)3132 IRSA: enabled on 3 of 15 namespaces (remaining use node IAM role)3334 Network Policies: none (default allow all east-west traffic)3536 Secrets Encryption: KMS not configured (uses default encryption)3738 ECR Image Scanning: scan-on-push disabled3940 GuardDuty EKS Runtime: not enabled4142 Audit Logging: enabled (api, audit, authenticator, controllerManager, scheduler)4344 API Server Endpoint: public (0.0.0.0/0)4546 IMDSv2: not enforced (IMDSv1 still accessible)474849 Emit the standard security optimization block.'50 version: 0.1.051 author: Jacky Chan — AWS Community Builder52 keywords: EKS, Kubernetes, pod security, Pod Security Admission, IRSA, IAM Roles for Service Accounts, EKS Pod Identity, network policies, Calico, Cilium, secrets encryption, KMS, image scanning, ECR scan-on-push, runtime security, GuardDuty EKS, Falco, admission webhook, OPA Gatekeeper, Kyverno, service mesh, mTLS, App Mesh, ACM PCA, audit logging, IMDSv2, privilege escalation, container security, cluster hardening53 tags: eks, compute, security, kubernetes, container-security, cluster-hardening54---5556# EKS Security Optimizer5758## What this skill does5960Translates an EKS cluster's security configuration into a concrete61hardening recommendation with severity ratings and exact remediation62steps. The verdict is the highest-leverage action across eight63dimensions — pod security standards, IAM identity, network policies,64secrets encryption, image scanning, runtime security, admission webhook65policies, and service mesh mTLS — applied in priority order by severity.66Always pairs the recommendation with exact kubectl and AWS CLI commands.6768## Quick navigation6970| Section | What it covers | When to jump here |71|---|---|---|72| Quick start | Five headline rules and the severity model | First read |73| Mindset | Why IRSA + PSA are the #1 levers | Understanding the approach |74| Quick reference — verdict thresholds | Decision matrix at a glance | Classifying a cluster |75| Pre-flight data gate | Cluster config, addon status, findings | Before any recommendation |76| Step 0 non-obvious behaviours | PSA replacement of PSP, Pod Identity, IMDSv2 | Edge cases |77| Step 1 Pod Security Standards | PSA privileged/baseline/restricted | Workload isolation |78| Step 2 IAM identity | IRSA vs node role vs Pod Identity | Least privilege |79| Step 3 Network policies | Calico/Cilium, default deny | East-west segmentation |80| Step 4 Secrets encryption | KMS envelope encryption | Secret protection |81| Step 5 Image scanning | ECR scan-on-push, Inspector | Vulnerability detection |82| Step 6 Runtime security | GuardDuty EKS, Falco | Threat detection |83| Step 7 Admission policies | OPA Gatekeeper / Kyverno | Policy-as-code |84| Step 8 Service mesh mTLS | App Mesh, Istio, ACM PCA | Pod-to-pod encryption |85| Step 9 Impact estimation | Severity scoring | Every recommendation |86| Output format | VERDICT block + worked examples | Emitting the result |87| Anti-Patterns — NEVER | Common misclassifications | Self-check before emit |88| Pre-flight safety checks | CONFIRM gate, canary deploy, rollback | Before any apply |8990## Quick start9192- **IRSA over node IAM role is the #1 IAM lever.** When all pods use93 the node IAM role, every pod has every AWS permission the node has.94 IRSA scopes IAM permissions to individual Kubernetes service accounts,95 achieving true least privilege. EKS Pod Identity (2024) is the newer,96 simpler alternative to IRSA.97- **Pod Security Admission replaced PodSecurityPolicy.** PSP was removed98 in Kubernetes 1.25. PSA enforces privileged/baseline/restricted99 profiles at the namespace level via labels. Restricted is the target100 for production workloads.101- **Default network policy is allow-all.** Without Calico or Cilium102 network policies, any pod can reach any other pod. A default-deny103 policy is the minimum baseline for production clusters.104- **KMS secrets encryption is one command.** `eks update-cluster-config105 --encryption-config` enables KMS envelope encryption for Kubernetes106 secrets. Without it, secrets are encrypted with a shared key that any107 cluster user can access.108- **IMDSv2 enforcement prevents credential theft.** Pod access to the109 node's IMDS (Instance Metadata Service) allows credential theft.110 Enforce IMDSv2 (which requires token-based requests) and set111 `hop-limit=1` to block pod access.112113## Mindset114115Moved verbatim to `references/advanced-patterns.md` — see "**Mindset — four principles**" (load on demand).116Applies when: you need the reasoning behind the highest-leverage-first approach.117118## Quick reference — verdict thresholds119120| Observation | Verdict | Recommendation |121|---|---|---|122| Pod Security Admission not configured (no PSS labels on namespaces) | **FURTHER_OPTIMIZATION_AVAILABLE** (pod security) | Step 1 — enable PSA with baseline/restricted profiles |123| Pods using node IAM role (IRSA not configured for most namespaces) | **FURTHER_OPTIMIZATION_AVAILABLE** (IAM) | Step 2 — migrate to IRSA or EKS Pod Identity |124| No network policies (default allow all east-west traffic) | **FURTHER_OPTIMIZATION_AVAILABLE** (network) | Step 3 — install Calico/Cilium, apply default deny |125| KMS secrets encryption not enabled (uses default encryption) | **FURTHER_OPTIMIZATION_AVAILABLE** (secrets) | Step 4 — enable KMS envelope encryption |126| ECR scan-on-push disabled OR images with CRITICAL findings deployed | **FURTHER_OPTIMIZATION_AVAILABLE** (images) | Step 5 — enable scan-on-push, block CRITICAL findings |127| GuardDuty EKS runtime monitoring not enabled | **FURTHER_OPTIMIZATION_AVAILABLE** (runtime) | Step 6 — enable GuardDuty EKS runtime protection |128| No admission webhook (Gatekeeper/Kyverno) for policy enforcement | **FURTHER_OPTIMIZATION_AVAILABLE** (admission) | Step 7 — deploy Gatekeeper or Kyverno with baseline policies |129| mTLS not enforced between pods (no service mesh or mutual TLS) | **FURTHER_OPTIMIZATION_AVAILABLE** (mTLS) | Step 8 — deploy App Mesh or Istio with mTLS |130| API server endpoint public (0.0.0.0/0) AND no private endpoint | **FURTHER_OPTIMIZATION_AVAILABLE** (API server) | Restrict endpoint or enable private endpoint |131| IMDSv2 not enforced (IMDSv1 accessible, hop-limit > 1) | **FURTHER_OPTIMIZATION_AVAILABLE** (IMDS) | Enforce IMDSv2, set hop-limit=1 |132| Audit logging disabled OR missing critical log types | **FURTHER_OPTIMIZATION_AVAILABLE** (logging) | Enable all log types (api, audit, authenticator, etc.) |133| All dimensions verified AND PSA enforced AND IRSA on all namespaces AND network policies in place | **OPTIMIZED** | None — continue monitoring |134135## Pre-flight: data gate (run before any optimization decision)136137Security assessment is only as good as the underlying data. Pull these138inputs before any recommendation. Full CLI sequences are in139`references/eks-security-config-reference.md`.140141**Required data sources** (summarized — see reference for full CLI):142Moved verbatim to `references/eks-security-config-reference.md` — see "**Pre-flight data gate — required data sources**" (load on demand).143Applies when: gathering the nine pre-flight data sources on a live account.144145### Data-quality short-circuits146147| Condition | Effect on optimization |148|---|---|149| `describe-cluster` fails (cluster not found) | **NEED_MORE_INFO**. Verify cluster name and region. |150| kubectl not configured or context wrong | Fall back to AWS CLI only; mark network/pod findings MEDIUM confidence. |151| GuardDuty detector not enabled | Cannot assess runtime threats. Surface as finding: "enable GuardDuty." |152| ECR repository not using scan-on-push | Cannot assess image vulnerabilities. Surface as finding. |153| `logging.clusterLogging` shows disabled types | Surface as finding; cannot correlate events without audit logs. |154155## Process — Optimization logic (apply in order)156157### Step 0: Non-obvious behaviours that change the recommendation158159These operational gotchas route a recommendation away from the obvious:160161Moved verbatim to `references/advanced-patterns.md` — see "**Step 0 — non-obvious behaviours that change the recommendation**" (load on demand).162Applies when: a recommendation hinges on PSA/PSP, Pod Identity, IMDSv2 hop-limit, KMS re-encryption, audit-log cost, or IRSA audience behaviour.163164### Step 1: Pod Security Standards (PSA)165166PSA enforces three profiles at the namespace level via labels:167168| Profile | What it blocks | Target workloads |169|---|---|---|170| privileged | Nothing (all capabilities allowed) | System namespaces (kube-system) |171| baseline | Privilege escalation, host PID/IPC, hostNetwork, additional capabilities | Non-production, legacy |172| restricted | All of baseline + runAsNonRoot required, seccomp required, specific capabilities dropped | Production workloads |173174**Enforcement modes:**175- `enforce` — rejects pods that violate the profile176- `audit` — logs violations but allows the pod177- `warn` — warns the user but allows the pod178179**Recommendation:** Apply `baseline` as `enforce` on all namespaces,180`restricted` as `audit` on production namespaces, and `restricted` as181`enforce` on new namespaces.182183Moved verbatim to `references/eks-security-config-reference.md` — see "**Step 1 — PSA namespace labels (bash)**" (load on demand).184Applies when: applying PSA labels to a namespace.185186### Step 2: IAM identity (IRSA / Pod Identity)187188**Node IAM role problem:** All pods inherit the node IAM role's189permissions. If the node role has `s3:*`, every pod can access S3.190191**IRSA solution:** Creates a 1:1 mapping between a Kubernetes ServiceAccount192and an IAM Role via OIDC federation. Pods using that ServiceAccount get193only the IAM role's scoped permissions.194195**EKS Pod Identity (2024):** Simpler alternative to IRSA using an196agent-based approach. No OIDC provider required.197198Moved verbatim to `references/eks-security-config-reference.md` — see "**Step 2 — IRSA / Pod Identity detection (bash)**" (load on demand).199Applies when: detecting which service accounts use IRSA or Pod Identity.200201**Recommendation:** Migrate all non-system workloads from node IAM role202to IRSA or Pod Identity. For new clusters, use Pod Identity. For existing203clusters, migrate incrementally.204205Moved verbatim to `references/eks-security-config-reference.md` — see "**Step 2 — IRSA setup (bash)**" (load on demand).206Applies when: creating an IRSA role and annotating a service account.207208### Step 3: Network policies (east-west segmentation)209210Without network policies, any pod can reach any other pod in the cluster.211This enables lateral movement after a single pod compromise.212213Moved verbatim to `references/eks-security-config-reference.md` — see "**Step 3 — Calico/Cilium install + default-deny NetworkPolicy**" (load on demand).214Applies when: installing a network-policy CNI or applying a default-deny baseline.215216Then add explicit allow rules for required flows (e.g., frontend → backend217on port 8080).218219### Step 4: Secrets encryption (KMS envelope encryption)220221Without KMS encryption, Kubernetes secrets are encrypted with a222cluster-wide key derivable by any etcd access. KMS envelope encryption223uses a customer-managed KMS key.224225Moved verbatim to `references/eks-security-config-reference.md` — see "**Step 4 — KMS detection + enable (bash)**" (load on demand).226Applies when: detecting or enabling KMS secrets encryption.227228**Important:** Existing secrets are NOT automatically re-encrypted. After229enabling, rotate secrets:230```bash231kubectl get secrets -A -o json | kubectl replace -f -232```233234### Step 5: Image scanning (ECR scan-on-push)235236Without image scanning, vulnerable container images are deployed without237detection.238239Moved verbatim to `references/eks-security-config-reference.md` — see "**Step 5 — ECR scanning detection + enable (bash)**" (load on demand).240Applies when: detecting or enabling ECR scan-on-push / enhanced scanning.241242**Block CRITICAL findings at admission:** Use Gatekeeper or Kyverno to243verify image scan status before allowing deployment.244245### Step 6: Runtime security (GuardDuty EKS)246247GuardDuty EKS runtime monitoring detects:248- Credential theft (IMDS access from pods)249- Lateral movement (unexpected pod-to-pod connections)250- Anomalous process execution (reverse shells, cryptominers)251- Container escape attempts252253Moved verbatim to `references/eks-security-config-reference.md` — see "**Step 6 — enable GuardDuty EKS runtime (bash)**" (load on demand).254Applies when: enabling the GuardDuty EKS runtime addon.255256Ensure the GuardDuty detector is enabled and EKS runtime coverage is257active in the GuardDuty console.258259### Step 7: Admission webhook policies (OPA Gatekeeper / Kyverno)260261Admission webhooks enforce policy-as-code at pod creation time. This is262the Kubernetes-native way to prevent misconfigured workloads.263264Moved verbatim to `references/eks-security-config-reference.md` — see "**Step 7 — install Gatekeeper / Kyverno (bash)**" (load on demand).265Applies when: installing Gatekeeper or Kyverno.266267**Baseline policies to enforce:**268- Disallow privileged containers269- Disallow hostPath volumes270- Require resource limits271- Require image scan verification (ECR)272- Disallow default namespace for production workloads273274### Step 8: Service mesh mTLS275276Service mesh mTLS encrypts pod-to-pod communication and authenticates277workload identity. Without mTLS, any pod on the network can impersonate278any other pod.279280Moved verbatim to `references/eks-security-config-reference.md` — see "**Step 8 — install App Mesh / Istio (bash)**" (load on demand).281Applies when: installing a service mesh for mTLS.282283**ACM PCA for certificate authority:** Use AWS Private Certificate284Authority for managed certificate issuance in the mesh.285286### Step 9: Severity scoring287288Score each finding by severity to prioritize remediation:289290| Severity | Criteria | Examples |291|---|---|---|292| CRITICAL | Direct path to credential theft or cluster takeover | Node IAM role on all pods, IMDSv1 accessible, API server public with no restrictions |293| HIGH | Significant attack surface expansion | No network policies, no PSA, no KMS secrets encryption, no image scanning |294| MEDIUM | Defense-in-depth gap | No GuardDuty runtime, no admission webhook, no mTLS, audit logging incomplete |295| LOW | Hardening recommendation | PSA warn instead of enforce, basic scan instead of enhanced |296297### Step 10: Final verdict298299- Any dimension has a CRITICAL or HIGH finding → **FURTHER_OPTIMIZATION_AVAILABLE**.300- All CRITICAL/HIGH findings remediated, only MEDIUM/LOW remain → **FURTHER_OPTIMIZATION_AVAILABLE**.301- All dimensions verified (PSA enforced, IRSA on all namespaces, network policies in place, KMS encryption enabled, scanning active, GuardDuty enabled) → **OPTIMIZED**.302- Change applied and verified this session → **OPTIMIZED** (post-state).303- Data insufficient (cluster config absent, kubectl not available) → **NEED_MORE_INFO**.304305## Output format306307```text308TARGET: <cluster-name>309VERDICT: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE310REASON: <1-2 sentences naming the recommendation and the supporting data>311RECOMMENDATION:312 Current: <PSA status>, <IAM status>, <network policy status>, <KMS status>, <scan status>, <runtime status>313 Proposed: <specific changes per dimension>314 Dimensions changed: <psa | iam | network | secrets | images | runtime | admission | mtls>315 Dimensions checked: <list ALL eight, each ✓ (no finding) or → (finding)>316 Confidence: <HIGH/MEDIUM/LOW> — <one-line rationale>317SEVERITY: <CRITICAL | HIGH | MEDIUM | LOW>318ESTIMATED_RISK: <1-2 sentences describing the attack scenario this finding exposes>319REMEDIATION_STEPS:320 1. <specific action with CLI command>321 2. <verification step>322CONFIRM: Before executing any state-changing CLI, emit and await operator323 approval: "CONFIRM: About to <action> on <cluster-name> in <region>.324 Proceed? (yes/no)"325```326327Full worked examples (PSA enable, IRSA migration, network policy default328deny, already-secured, NEED_MORE_INFO, and end-to-end walkthrough) are329in `references/worked-examples.md`.330331## STRICT output contract332333The rules below are hard constraints. Violating any one produces a334misclassification that breaks downstream security automation. Self-check335EVERY emitted block before returning.336337### Required output structure338339Every response MUST be a single block using these literal labels, in this340order. Do NOT substitute markdown headings, camelCase, or bold variants.341342```text343TARGET: <cluster-name>344VERDICT: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE345REASON: <1-2 sentences naming the recommendation and the supporting data>346RECOMMENDATION:347 Current: <PSA status>, <IAM status>, <network policy status>, <KMS status>, <scan status>, <runtime status>348 Proposed: <specific changes per dimension>349 Dimensions changed: <psa | iam | network | secrets | images | runtime | admission | mtls>350 Dimensions checked: <list ALL eight, each ✓ (no finding) or → (finding)>351 Confidence: <HIGH/MEDIUM/LOW> — <one-line rationale>352SEVERITY: <CRITICAL | HIGH | MEDIUM | LOW>353ESTIMATED_RISK: <1-2 sentences describing the attack scenario>354REMEDIATION_STEPS:355 1. <specific action with CLI command>356 2. <verification step>357CONFIRM: <confirmation prompt text>358```359360### FORBIDDEN output patterns3613621. **NEVER emit `VERDICT: FURTHER_OPTIMIZATION_AVAILABLE` without a363 SEVERITY rating.** Every finding must be scored CRITICAL/HIGH/MEDIUM/LOW.3643652. **NEVER recommend a security change without verifying it won't break366 workloads.** PSA `enforce=restricted` can reject running pods. Always367 recommend `audit` mode first, then `enforce` after verifying no368 violations.3693703. **NEVER emit scratch lines** ("WAIT — let me check", "Hmm, I need to371 verify") in the output. Finalize the assessment before emitting.3723734. **NEVER recommend IRSA migration without identifying all IAM374 permissions each workload needs.** An IRSA role with insufficient375 permissions will cause pod failures.3763775. **NEVER omit a dimension from the RECOMMENDATION block.** The378 `Dimensions checked` line MUST list all eight dimensions, each marked379 ✓ (no finding) or → (finding).3803816. **NEVER recommend network policy default-deny without warning that382 it will break existing traffic flows.** Always apply in audit/test383 mode first.3843857. **NEVER round severity down.** If a finding could be CRITICAL or386 HIGH, rate it CRITICAL. Under-rating security findings is worse than387 over-rating.388389### Perfect example output — FURTHER_OPTIMIZATION_AVAILABLE390391```text392TARGET: prod-cluster-1393VERDICT: FURTHER_OPTIMIZATION_AVAILABLE394REASON: Production EKS cluster with no Pod Security Admission enforcement,395 12 of 15 namespaces using node IAM role instead of IRSA, and no network396 policies. A single pod compromise allows full cluster takeover via node397 IAM credentials and unrestricted lateral movement.398RECOMMENDATION:399 Current: PSA not configured, node IAM on 12/15 namespaces, no network policies, KMS not configured400 Proposed: PSA baseline-enforce on all namespaces, IRSA on all non-system namespaces, Calico default-deny, KMS secrets encryption401 Dimensions changed: psa (Step 1) + iam (Step 2) + network (Step 3) + secrets (Step 4)402 Dimensions checked: psa → (not configured) iam → (node role on 12 ns)403 network → (no policies) secrets → (no KMS) images ✓ (scan-on-push enabled)404 runtime ✓ (GuardDuty enabled) admission ✓ (Gatekeeper deployed) mtls → (no mTLS)405 Confidence: HIGH — cluster config verified via describe-cluster + kubectl406 inspection; all findings confirmed against live state.407SEVERITY: CRITICAL408ESTIMATED_RISK: Node IAM role on all pods means any pod can assume the409 node's AWS permissions. Combined with no network policies, an attacker410 who compromises one pod can access all AWS resources the node IAM role411 permits and move laterally to any other pod in the cluster.412REMEDIATION_STEPS:413 1. Enable PSA baseline-enforce on all non-system namespaces:414 kubectl label namespace <ns> pod-security.kubernetes.io/enforce=baseline415 2. Create IRSA roles for the 12 namespaces and annotate service accounts:416 kubectl annotate sa <sa> eks.amazonaws.com/role-arn=<role-arn> -n <ns>417 3. Install Calico and apply default-deny per namespace:418 helm install calico projectcalico/tigera-operator -n tigera-operator --create-namespace419 4. Enable KMS secrets encryption:420 aws eks update-cluster-config --name prod-cluster-1 --encryption-config '{...}'421 5. Enable mTLS via App Mesh (MEDIUM priority, can be phased):422 helm install appmesh appmesh/appmesh -n appmesh-system --create-namespace423CONFIRM: About to apply security hardening on prod-cluster-1 (PSA, IRSA,424 network policies, KMS encryption). This will require pod restarts in425 12 namespaces. Proceed? (yes/no)426```427428**Self-check before emit:**429- [ ] All eight dimensions listed in `Dimensions checked`?430- [ ] SEVERITY rating present and justified by ESTIMATED_RISK?431- [ ] Every `→` dimension has a corresponding REMEDIATION_STEPS entry?432- [ ] No scratch/recompute text in the block?433- [ ] PSA recommendation includes audit-mode-first guidance?434435## Verdict semantics436437| Verdict | When to emit |438|---|---|439| `FURTHER_OPTIMIZATION_AVAILABLE` | At least one dimension has a CRITICAL, HIGH, or MEDIUM finding. |440| `OPTIMIZED` | All dimensions verified (PSA enforced, IRSA/Pod Identity on all namespaces, network policies in place, KMS encryption enabled, scanning active, GuardDuty enabled, admission policies deployed). |441| `NEED_MORE_INFO` | Data gate failed: cluster not found, kubectl not configured, or critical config missing. |442443## Anti-Patterns — NEVER (top 5)4444451. **NEVER recommend PSA `enforce` mode without first running `audit`446 mode.** Enforce mode rejects pods that violate the profile, which can447 break running workloads. Always audit first, identify violations,448 fix them, then switch to enforce.4494502. **NEVER recommend IRSA migration without mapping all AWS permissions451 each workload uses.** The node IAM role may grant permissions the452 workload relies on implicitly. The IRSA role must include all453 required permissions or pods will fail with AccessDenied.4544553. **NEVER apply network policy default-deny in production without a456 test period.** Default-deny immediately breaks all non-explicitly-457 allowed traffic. Apply in a staging namespace first, verify flows,458 then roll out.4594604. **NEVER recommend enabling KMS encryption without warning that461 existing secrets need re-encryption.** New secrets are encrypted462 with KMS, but existing secrets remain with the old encryption until463 rotated.4644655. **NEVER recommend disabling the public API server endpoint without466 verifying that kubectl access is available via VPN/bastion.** Switching467 to private-only endpoint immediately breaks all external kubectl468 access.469470Extended anti-patterns and error-handling tables in471`references/eks-security-config-reference.md`.472473## Pre-flight safety checks (run before any remediation CLI)474475- **MANDATORY CONFIRMATION GATE.** Before any state-changing operation,476 emit and await operator approval. Security changes can break workloads.477- **PSA changes require audit-first.** Never apply `enforce` without478 first running `audit` mode and resolving all violations.479- **IRSA migration requires per-workload IAM policy mapping.** Test each480 namespace independently before cutover.481- **Network policy changes require canary.** Apply in a staging namespace482 first; verify all required traffic flows before production rollout.483- **KMS encryption requires cluster update.** The cluster enters484 `UPDATING` state during the KMS config change. Plan for brief485 disruption.486- **GuardDuty addon requires node IAM permissions.** The487 `aws-guardduty-agent` addon needs permissions to communicate with488 GuardDuty. Verify the addon role before installation.489- **Gatekeeper/Kyverno policies can block deployments.** Test policies490 in `warn` or `audit` mode before switching to `deny`.491- **Service mesh mTLS rollout should be progressive.** Start with492 `permissive` mTLS mode (accept both mTLS and plaintext), then switch493 to `strict` after all workloads are enrolled.494- **Bulk-operation limit:** Process at most 3 security changes per495 batch. Sort by severity (CRITICAL first), verify each batch before496 proceeding.497498## Recent AWS features (2024-2026)499500Moved verbatim to `references/advanced-patterns.md` — see "**Recent AWS features (2024-2026)**" (load on demand).501Applies when: the cluster uses Pod Identity, GuardDuty runtime monitoring, ECR enhanced scanning, Auto Mode, or VPC CNI network policies.502503## References504505- `references/eks-security-config-reference.md` — CLI commands for each506 security dimension, IAM policy templates for IRSA, PSA label reference,507 network policy examples, Calico/Cilium install guides, KMS encryption508 setup, ECR scanning config, GuardDuty EKS setup, Gatekeeper/Kyverno509 policy examples, error-handling tables, extended NEVER list.510- `references/worked-examples.md` — full worked examples (PSA enable,511 IRSA migration, network policy default deny, KMS encryption, already-512 secured, NEED_MORE_INFO, end-to-end walkthrough).513514## References (load on demand)515516- [references/eks-security-config-reference.md](references/eks-security-config-reference.md) — CLI commands for each security dimension (including the per-step bash blocks moved verbatim from this file), IAM policy templates, error-handling tables, extended NEVER list.517- [references/worked-examples.md](references/worked-examples.md) — full worked examples (PSA enable, IRSA migration, network policy default deny, KMS encryption, already-secured, NEED_MORE_INFO, end-to-end walkthrough).518- [references/advanced-patterns.md](references/advanced-patterns.md) — Step 0 non-obvious behaviours, mindset principles, and recent AWS features (moved verbatim from this file).519520## Domain521522AWS CloudOps / EKS Container Security Optimization & Hardening.523524## AWS documentation525526- **EKS User Guide** — https://docs.aws.amazon.com/eks/latest/userguide/what-is-eks.html527- **EKS security** — https://docs.aws.amazon.com/eks/latest/userguide/security.html528- **Pod Security Admission** — https://kubernetes.io/docs/concepts/security/pod-security-standards/529- **IRSA** — https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html530- **EKS Pod Identity** — https://docs.aws.amazon.com/eks/latest/userguide/pod-identities.html531- **EKS KMS encryption** — https://docs.aws.amazon.com/eks/latest/userguide/encrypting-secrets.html532- **ECR image scanning** — https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html533- **GuardDuty EKS protection** — https://docs.aws.amazon.com/guardduty/latest/ug/protection-resources-eks.html534- **Calico for EKS** — https://docs.tigera.io/calico/latest/getting-started/kubernetes/eks535- **Cilium for EKS** — https://docs.cilium.io/en/latest/installation/k8s-install-helm/536- **Well-Architected Security Pillar** — https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/welcome.html