SecurityLesson 3 of 6
  1. Authentication and service accounts, not reconciled
  2. RBAC, not reconciled
  3. Pod security: securityContext and Pod Security Admission, not reconciled
    1. securityContext
    2. Hardening fields
    3. Pod Security Standards
    4. Pod Security Admission
    5. Rolling it out
    6. User namespaces (GA 1.36)
    7. Sandboxed runtimes
  4. Admission control and policy, not reconciled
  5. Image supply chain, not reconciled
  6. Audit logging and runtime security, not reconciled

Pod security: securityContext and Pod Security Admission

A pod's securityContext says what its processes may do on the node. The Pod Security Standards name three levels of that, and Pod Security Admission enforces them per namespace with three labels.

  • 30 min
  • 4 objectives
  • 7 scenes
  • Includes an On AWS layer

Shows the lesson one block at a time. Arrow keys step, number keys jump to a scene, and Escape returns to the page where you were.

RBAC decides who may create a pod. It says nothing about what that pod may do once it runs: whether its process is root, whether it can load kernel features, whether it can mount the node’s disk. Those are fields in the pod spec, and this lesson covers what they do, which combinations Kubernetes defines as safe, and how a namespace enforces them.

Reconcile, in 7 scenes

securityContext

A securityContextA block in the pod spec, at pod level and per container, that sets the Linux user, groups, capabilities, seccomp and SELinux options and other privileges the runtime applies to the container’s processes. exists at two levels. The pod-level block holds settings for every container, plus fields that only make sense for the whole pod, such as fsGroup and supplementalGroups. The container-level block holds per-container fields such as capabilities, privileged, allowPrivilegeEscalation and readOnlyRootFilesystem. Fields that appear in both, such as runAsUser, runAsNonRoot, seccompProfile and seLinuxOptions, are defaults at pod level, and a container’s own value wins for that container.

Some failures happen at admission and some at the kubelet, and telling them apart saves time. Admission sees only the manifest. The kubelet also sees the image, so runAsNonRoot: true on an image whose user is root, with no runAsUser, passes admission and then fails at container creation:

Admitted, then refused by the kubelet
kubectl -n payments get pod toolbox
NAME      READY   STATUS                       RESTARTS   AGE
toolbox   0/1     CreateContainerConfigError   0          15s
kubectl -n payments get events --field-selector reason=Failed
LAST SEEN   TYPE      REASON   OBJECT        MESSAGE
2s          Warning   Failed   pod/toolbox   Error: container has runAsNonRoot and image will run as root (pod: "toolbox_payments(683592b6-265e-4b5e-9bbd-98e594120b86)", container: shell)

The fix is a non-zero runAsUser or an image built with a numeric non-root USER.

Hardening fields

Five settings cover most of what a typical service needs:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
  namespace: payments
spec:
  replicas: 2
  selector:
    matchLabels:
      app: web
  template:
    metadata:
      labels:
        app: web
    spec:
      securityContext:
        runAsNonRoot: true
        seccompProfile:
          type: RuntimeDefault
      containers:
        - name: web
          image: ghcr.io/kx-labs/web:1.1
          ports:
            - containerPort: 8080
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            capabilities:
              drop: ["ALL"]
  • runAsNonRoot: true makes the kubelet refuse to start a container whose user resolves to UID 0. Pair it with runAsUser when the image’s user is a name rather than a number, since the kubelet cannot verify a name.
  • allowPrivilegeEscalation: false sets the kernel’s no_new_privs flag, so a setuid binary such as sudo cannot raise the process’s privileges. Unset, it defaults to true, and the API server rejects allowPrivilegeEscalation: false on a container that is also privileged or adds CAP_SYS_ADMIN.
  • capabilities.drop: ["ALL"] removes the root powers the runtime grants by default, such as CHOWN, SETUID and KILL. Add back only what the process needs. Ports below 1024 are privileged and 1024 and above are not, but binding port 80 rarely needs NET_BIND_SERVICE: Docker and the containerd 2.0 CRI plugin (enable_unprivileged_ports, on by default) set net.ipv4.ip_unprivileged_port_start=0 inside each pod’s network namespace, so non-root processes bind low ports unless the pod uses the host network.
  • readOnlyRootFilesystem: true stops a compromised process from writing tools or changing binaries in the image. The application still needs somewhere to write, so mount an emptyDir at /tmp or its cache directory, and deliver credentials as Secret volumes on tmpfs. Docker Compose follows the same idea outside Kubernetes: its secrets work without Swarm and mount read-only at /run/secrets/<name>.
  • seccompProfile.type: RuntimeDefault applies the container runtime’s syscall filter. Without it, a container runs Unconfined unless the kubelet’s seccompDefault setting, stable since 1.27, makes RuntimeDefault the default. Localhost loads a profile file from the node.

AppArmor (appArmorProfile, a field from 1.30) and SELinux (seLinuxOptions) add mandatory access control where the node runs them. fsGroup makes mounted volumes group-owned by a GID, and fsGroupChangePolicy: OnRootMismatch skips the slow recursive ownership change when the volume root already matches.

Pod Security Standards

The Pod Security StandardsThree cumulative policy levels, privileged, baseline and restricted, that define which pod security settings are allowed; each Kubernetes release publishes the exact checks for its version. turn those fields into three levels:

  • Privileged allows everything. It is for system components that need the node: CNI agents, storage drivers, log collectors.
  • Baseline blocks known privilege escalations while running most images unchanged. It forbids privileged containers and Windows HostProcess pods; host namespaces (hostNetwork, hostPID, hostIPC); hostPort; every hostPath volume, with no path allowlist; capabilities beyond the default set (AUDIT_WRITE, CHOWN, DAC_OVERRIDE, FOWNER, FSETID, KILL, MKNOD, NET_BIND_SERVICE, SETFCAP, SETGID, SETPCAP, SETUID, SYS_CHROOT); probes and lifecycle hooks with a host field (from 1.34); AppArmor profiles other than RuntimeDefault or Localhost, in the field or the container.apparmor.security.beta.kubernetes.io annotation; SELinux types outside container_t, container_init_t, container_kvm_t and container_engine_t (from 1.31), or any custom SELinux user or role; a procMount other than Default; seccomp explicitly set to Unconfined; and sysctls outside a safe list.
  • Restricted adds the hardening a typical application can live with, at some cost to compatibility. Volumes must be configMap, csi, downwardAPI, emptyDir, ephemeral, persistentVolumeClaim, projected or secret. allowPrivilegeEscalation must be false. runAsNonRoot must be true at pod level or on every container, and runAsUser may be unset or any value but 0. A seccomp profile of RuntimeDefault or Localhost must be set. Capabilities must drop ALL, and only NET_BIND_SERVICE may be added back. The escalation, seccomp and capability checks skip pods with spec.os.name: windows.

The details move between releases: the safe sysctl list gained net.ipv4.tcp_rmem and net.ipv4.tcp_wmem in 1.32 and net.ipv4.tcp_slow_start_after_idle and net.ipv4.tcp_notsent_lowat in 1.37, so read the standard for the version you pin. readOnlyRootFilesystem is good practice but appears in no level.

Pod Security Admission

Pod Security AdmissionThe built-in admission controller that checks pods against the Pod Security Standards, using labels on each namespace to choose the level and mode. replaced PodSecurityPolicy. It was beta and on by default in Kubernetes 1.23 and stable in 1.25, the release that removed PodSecurityPolicy. A namespace opts in with labels, one level per mode:

LabelEffect on a violating pod
pod-security.kubernetes.io/enforce: <level>Rejected
pod-security.kubernetes.io/audit: <level>Allowed, with an annotation on the audit log event
pod-security.kubernetes.io/warn: <level>Allowed, with a warning returned to the client

Each mode has a -version label, such as pod-security.kubernetes.io/enforce-version: v1.37, that pins the checks to that release’s standard. Without it the namespace uses latest, and an upgrade can start rejecting pods it admitted before.

The modes differ in what they check, and that difference causes the most confusing failure. warn and audit also check workload objects such as Deployments and Jobs, so problems surface when the template is applied. enforce checks only pods. A Deployment that violates an enforced level is stored, its ReplicaSet is created, and every pod create request is rejected:

Enforce rejects pods, not Deployments
kubectl label namespace payments pod-security.kubernetes.io/enforce=restricted pod-security.kubernetes.io/enforce-version=v1.37
namespace/payments labeled
kubectl apply -f web.yaml
deployment.apps/web created
kubectl -n payments get deployment web
NAME   READY   UP-TO-DATE   AVAILABLE   AGE
web    0/2     0            0           0s
kubectl -n payments get events --field-selector reason=FailedCreate | head -2
LAST SEEN   TYPE      REASON         OBJECT                      MESSAGE
0s          Warning   FailedCreate   replicaset/web-549795f985   Error creating: pods "web-549795f985-x2fqt" is forbidden: violates PodSecurity "restricted:v1.37": allowPrivilegeEscalation != false (container "web" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "web" must set securityContext.capabilities.drop=["ALL"]), runAsNonRoot != true (pod or container "web" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container "web" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")

The message lists every failed control with the field to set, which is the whole fix. kubectl run gets the same rejection directly, because it creates a pod.

Manifestweb-restricted.yaml

Edit web-restricted.yaml, then apply it to this page's cluster
In the cluster
  • namespace/payments
  • deployment.apps/web
Tab indents two spaces and Shift+Tab outdents. To leave the editor, press Escape, then Tab. Control+Enter or Command+Enter to apply.
The preview runs once this page's cluster starts.

Apply it: the namespace enforces restricted, and the hardened pods are admitted and start. Then delete the drop line and apply again: the new pods are refused, the status line quotes the control that failed, and the old pods keep serving.

Exemptions live in the admission plugin’s AdmissionConfiguration on the API server, by username, RuntimeClass name or namespace. Do not exempt controller ServiceAccounts such as system:serviceaccount:kube-system:replicaset-controller: that exempts everyone who can create a Deployment.

Rolling it out

A stricter level should never surprise a running workload. Changing a namespace’s enforce label makes the API server check every existing pod and return violations as warnings, without evicting anything, and a server-side dry run shows them without changing the label:

kubectl label --dry-run=server --overwrite namespace payments pod-security.kubernetes.io/enforce=restricted

A rollout that works:

  1. Label every namespace with warn and audit at baseline, leaving enforce unset: kubectl label --overwrite ns --all pod-security.kubernetes.io/audit=baseline pod-security.kubernetes.io/warn=baseline.
  2. Read the warnings in deploy pipelines and the pod-security.kubernetes.io/audit-violations annotations in the audit log, and fix the manifests.
  3. Enforce baseline everywhere it passes, then raise warn and audit to restricted and repeat.
  4. Give node agents that need the host, such as a log collector reading /var/log, a namespace of their own at privileged, with a warn label kept at baseline and tight RBAC on who can create pods there.
  5. Pin -version labels, and move them deliberately after an upgrade.

kubectl get namespaces --selector='!pod-security.kubernetes.io/enforce' lists namespaces with no enforced level.

For rules the three levels cannot express, such as requiring an image registry, resource limits or signed images, Kubernetes has CEL admission policies that need no webhook: ValidatingAdmissionPolicy, stable in 1.30, and MutatingAdmissionPolicy, stable in 1.36 in admissionregistration.k8s.io/v1. Kyverno and OPA Gatekeeper remain options. Kyverno 1.13 deprecated the policy-wide validationFailureAction in favour of per-rule failureAction with the values Audit or Enforce; its CEL-based kinds in policies.kyverno.io, such as ValidatingPolicy (stable in 1.17), MutatingPolicy, GeneratingPolicy and ImageValidatingPolicy, replace ClusterPolicy, and Kyverno 1.20.0 (2026-11-12) blocks creating or updating legacy ClusterPolicy and Policy resources. Gatekeeper 3.23.1 can generate ValidatingAdmissionPolicies from its constraint templates. For signatures, use Sigstore cosign or Notation: Docker announced the retirement of Docker Content Trust on 2025-07-29, and the signing certificates of Docker Official Images began expiring on 2025-08-08.

User namespaces (GA 1.36)

Running as non-root is the usual answer to “what if the process escapes the container?”. A user namespaceA Linux namespace that maps the UIDs and GIDs inside a pod to a separate, unprivileged range on the node, so root in the container is not root on the host. is another answer, for images that must run as root inside. Set hostUsers: false, stable in Kubernetes 1.36:

apiVersion: v1
kind: Pod
metadata:
  name: build-tools
spec:
  hostUsers: false
  securityContext:
    seccompProfile:
      type: RuntimeDefault
  containers:
    - name: shell
      image: busybox:1.37
      command: ["sleep", "3600"]
      securityContext:
        allowPrivilegeEscalation: false
        capabilities:
          drop: ["ALL"]

The kubelet gives each such pod its own range of host IDs, 65536 by default (idsPerPod in the kubelet configuration), that no other pod on the node shares, and capabilities apply only inside it: CAP_SYS_ADMIN is limited to the pod’s namespace, and CAP_SYS_MODULE has no effect. A pod with hostUsers: false cannot also set hostNetwork, hostPID or hostIPC, or use raw block volumeDevices. Nodes need Linux 6.3 or later for idmap mounts on tmpfs, runc 1.2 or crun 1.9 or later, and containerd 2.0 or CRI-O 1.25 or later; on a kernel before 6.3 the container fails to start with a MOUNT_ATTR_IDMAP error. Pod Security Admission relaxes accordingly: for such pods it does not check runAsNonRoot or runAsUser at either level, and baseline also stops checking procMount, while restricted still requires the default. The pod above is therefore admitted by a namespace enforcing restricted.

Sandboxed runtimes

Every option so far shares the node’s kernel. For untrusted code, a sandboxed runtime adds a boundary: gVisor intercepts system calls in a user-space kernel, and Kata Containers runs each pod in a lightweight VM. A RuntimeClassA cluster-scoped node.k8s.io/v1 object that names a container runtime handler configured on nodes, which pods select with runtimeClassName. is how a pod asks for one:

apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
  name: gvisor
handler: runsc

A pod sets runtimeClassName: gvisor. If the RuntimeClass does not exist, or the node’s runtime cannot run its handler, the pod ends in the Failed phase, so set the RuntimeClass’s scheduling.nodeSelector to the nodes that have the handler; admission merges it into the pod. The Pod Security Standards do not recognise sandboxing; a sandboxed pod is checked like any other, unless the admission configuration exempts its RuntimeClass.

Preview, warn and enforce

  1. kubectl --context kind-kx create namespace psa-demo
  2. kubectl --context kind-kx -n psa-demo run root-shell --image=busybox:1.37 -- sleep 3600
  3. kubectl --context kind-kx label --dry-run=server --overwrite namespace psa-demo pod-security.kubernetes.io/enforce=restricted
  4. kubectl --context kind-kx label --overwrite namespace psa-demo pod-security.kubernetes.io/enforce=baseline pod-security.kubernetes.io/warn=restricted pod-security.kubernetes.io/warn-version=v1.37
  5. kubectl --context kind-kx -n psa-demo create deployment web --image=nginx:1.30
  6. kubectl --context kind-kx -n psa-demo run privileged --image=busybox:1.37 --privileged -- sleep 3600
  7. kubectl --context kind-kx get namespaces --selector='!pod-security.kubernetes.io/enforce'
  8. kubectl --context kind-kx delete namespace psa-demo

For your own kind cluster kx: copy a command and paste it into your terminal. Run in the simulator runs the same command in this page's simulated cluster instead; nothing on this page touches your machine. The dry run warns that root-shell would violate restricted and changes nothing. Creating the Deployment prints a would-violate warning from the restricted warn label but succeeds, and its pods run under baseline. The privileged pod is rejected by baseline. The selector lists the namespaces with no enforce label.

Actual state

Check your understanding

5 checks

Your first answer to each check is the one that counts. After a miss you can answer again; passing every check reconciles the lesson.

  1. Check 1 of 5

    A namespace enforces baseline. Which pod does it admit?

  2. Check 2 of 5

    A namespace enforces restricted. Every pod below sets allowPrivilegeEscalation, capabilities and seccompProfile correctly. Which one is rejected?

  3. Check 3 of 5

  4. Check 4 of 5

    A pod sets securityContext.runAsUser: 1000. One of its two containers sets securityContext.runAsUser: 2000. Which UIDs do the containers run as?

  5. Check 5 of 5

    On Kubernetes 1.37, a namespace enforces restricted. A pod sets hostUsers: false, the RuntimeDefault seccomp profile, allowPrivilegeEscalation: false and drops ALL capabilities, but sets no runAsNonRoot and its image runs as root. Is it admitted?

Lesson not yet reconciled

Desired: 4 objectives, 0 metReconciled: 4 of 4 objectives met

  • Harden a pod with runAsNonRoot, allowPrivilegeEscalation false, dropped capabilities, a read-only root filesystem and the RuntimeDefault seccomp profile. (not yet met)
  • Label namespaces for the enforce, audit and warn modes, pinned to a version, and roll a stricter level out without breaking running workloads. (not yet met)
  • Say what the baseline level forbids and what restricted adds on top. (not yet met)
  • Run a pod in a user namespace with hostUsers false (stable in 1.36) and explain what it changes. (not yet met)

Pass every check above to reconcile this lesson.

Every check has passed, so the desired state is met. First-try accuracy: 0 of 5. This lesson's review cards are in your queue.

Practice

Put this lesson to work on the simulated cluster. Everything runs in your browser, with nothing to install.

Changed since the notes

This lesson draws on an earlier set of study notes. Where the documentation contradicts a claim in them, qualifies it or has moved past it, the claim is listed here with the corrected statement and the source it was checked against.

Show 21 corrections
  1. Stale, true once, no longerContainer Security

    The notes saidBasic scanning uses the Clair database

    CorrectedECR basic scanning uses AWS native technology with more than 50 data feeds. Clair is deprecated: the ECR document history records every account migrated to AWS native basic scanning as of 2026-02-02 (an earlier notice gave 2025-10-01).

    Sourcedocs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning-basic.html

  2. Stale, true once, no longerContainer Security

    The notes saidDocker Content Trust provides image signing

    CorrectedDocker announced the retirement of DCT (Notary v1) on 2025-07-29. Docker Official Images signing certificates began expiring on 2025-08-08, and pulls with DOCKER_CONTENT_TRUST=1 fail for those images. Use Sigstore cosign or Notation instead. Final shutdown dates are not confirmed from a primary source.

    Sourcedocker.com/blog/retiring-docker-content-trust

  3. Nuance, true with conditionsContainer Security

    The notes saidConfigure the application to use non-privileged ports (above 1024) (two entries)

    CorrectedUnprivileged ports are those >= 1024, so 1024 itself is unprivileged. Docker sets net.ipv4.ip_unprivileged_port_start=0 in container network namespaces, and the containerd 2.0 CRI plugin does the same by default (enable_unprivileged_ports = true). Non-root processes can therefore bind low ports in containers that don't use the host network.

    Sourcecontainerd.io/docs/2.2/containerd-2.0

  4. Wrong, not trueContainer Security

    The notes saidDocker secrets only work with Swarm, not standalone Docker (two entries)

    CorrectedDocker Compose supports secrets without Swarm. They are mounted read-only at /run/secrets/<name> in Linux containers.

    Sourcedocs.docker.com/compose/how-tos/use-secrets

  5. Stale, true once, no longerSecurity Best Practices

    The notes saidThe aws-auth ConfigMap (or EKS Access Entries) maps IAM identities to Kubernetes RBAC

    CorrectedThe aws-auth ConfigMap is deprecated; EKS access entries are the supported way to grant IAM principals cluster access, controlled by the cluster's authenticationMode (CONFIG_MAP, API_AND_CONFIG_MAP or API). An access entry can carry Kubernetes group names or EKS access policies (e.g. AmazonEKSClusterAdminPolicy). Custom usernames can't start with system:, eks:, aws:, amazon: or iam:. Whether system:masters is rejected as an access-entry group name isn't stated in the EKS docs (unconfirmed).

    Sourcedocs.aws.amazon.com/eks/latest/userguide/auth-configmap.html%20;%20https://docs.aws.amazon.com/eks/latest/userguide/creating-access-entries.html

  6. Nuance, true with conditionsSecurity Best Practices

    The notes saidIRSA as the way to give pods AWS permissions

    CorrectedEKS best practices: 'Unless you have specific usecases for IRSA, we recommend you use EKS Pod Identities.' Pod Identity uses the eks-pod-identity-agent and a role trusting pods.eks.amazonaws.com (sts:AssumeRole, sts:TagSession). It doesn't support Fargate or Windows pods, where IRSA is still required.

    Sourcedocs.aws.amazon.com/eks/latest/best-practices/identity-and-access-management.html%20;%20https://docs.aws.amazon.com/eks/latest/userguide/pod-identities.html

  7. Stale, true once, no longerSecurity Best Practices

    The notes saidEKS encrypts etcd by default, but you can add envelope encryption with your own KMS key at create-cluster

    CorrectedOn Kubernetes 1.28 and later, EKS envelope-encrypts all Kubernetes API data with KMS v2 and an AWS-owned key by default. You can use your own KMS key at creation or associate one with an existing cluster (aws eks associate-encryption-config); once enabled it can't be disabled.

    Sourcedocs.aws.amazon.com/eks/latest/userguide/envelope-encryption.html%20;%20https://docs.aws.amazon.com/eks/latest/userguide/enable-kms.html

  8. Stale, true once, no longerSecurity Best Practices

    The notes saidaws ecr put-image-scanning-configuration --image-scanning-configuration scanOnPush=true

    CorrectedRepository-level PutImageScanningConfiguration is being deprecated in favour of registry-level aws ecr put-registry-scanning-configuration, whose rules set BASIC or ENHANCED (Amazon Inspector) scanning by repository filter.

    Sourcedocs.aws.amazon.com/AmazonECR/latest/APIReference/API_PutImageScanningConfiguration.html

  9. Stale, true once, no longerSecurity Best Practices

    The notes saidKyverno validationFailureAction: enforce with match.resources.kinds; lowercase 'enforce' is the deprecated spelling (grouped)

    CorrectedKyverno 1.13 deprecated spec.validationFailureAction in favour of per-rule validate.failureAction, with the capitalised values Audit or Enforce. Kyverno later replaced ClusterPolicy with CEL-based policies.kyverno.io/v1 types such as ValidatingPolicy (stable in 1.17), and Kyverno 1.20.0 (Nov 12, 2026) blocks creating or updating legacy ClusterPolicy/Policy resources. Write the example as a ValidatingPolicy.

    Sourcekyverno.io/docs/guides/migration-to-cel/%20;%20https://github.com/kyverno/kyverno/releases/tag/v1.20.0

  10. Nuance, true with conditionsSecurity Best Practices

    The notes saidaws guardduty create-detector --features EKS_AUDIT_LOGS

    CorrectedEKS_AUDIT_LOGS is still a valid feature name, but the CLI form is --features Name=EKS_AUDIT_LOGS,Status=ENABLED. For runtime threat detection use RUNTIME_MONITORING, which covers EKS, ECS on Fargate and EC2; it can't be enabled together with the older EKS_RUNTIME_MONITORING.

    Sourcedocs.aws.amazon.com/guardduty/latest/APIReference/API_DetectorFeatureConfiguration.html

  11. Nuance, true with conditionsSecurity Best Practices

    The notes saidAdmission controllers via OPA Gatekeeper and Kyverno

    CorrectedKubernetes has built-in CEL admission policies that need no webhook: ValidatingAdmissionPolicy (GA in 1.30) and MutatingAdmissionPolicy (GA in 1.36). Gatekeeper and Kyverno remain options.

    Sourcekubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/%20;%20https://kubernetes.io/docs/reference/access-authn-authz/mutating-admission-policy

  12. Nuance, true with conditionsSecurity Best Practices

    The notes saidIRSA trust policy omits the '<oidc>:aud': 'sts.amazonaws.com' condition

    CorrectedConfirmed. The trust policy in the EKS docs has a StringEquals condition on both '<oidc-provider>:sub': 'system:serviceaccount:<namespace>:<sa>' and '<oidc-provider>:aud': 'sts.amazonaws.com'.

    Sourcedocs.aws.amazon.com/eks/latest/userguide/associate-service-account-role.html

  13. Nuance, true with conditionsSecurity Best Practices

    The notes saidMaps an IAM AdminRole to system:masters without warning that this group bypasses RBAC

    CorrectedConfirmed. Members of system:masters bypass all RBAC checks, and removing RoleBindings or ClusterRoleBindings can't revoke that access; the Kubernetes RBAC good practices say to avoid adding users to it. On EKS, grant admin through an access entry with AmazonEKSClusterAdminPolicy.

    Sourcekubernetes.io/docs/concepts/security/rbac-good-practices

  14. Nuance, true with conditionsSecurity Best Practices

    The notes said'kube-bench run --targets node' on EKS should use the EKS benchmark (--benchmark eks-x.y)

    CorrectedPartly confirmed. kube-bench auto-detects EKS and maps Kubernetes 1.29-1.31 to eks-1.7.0 and 1.32-1.34 to eks-1.8.0. The project's job-eks.yaml passes --benchmark explicitly with --targets node,policies,managedservices,controlplane. Pass --benchmark eks-<version> on clusters outside the documented mapping so generic CIS node checks aren't used.

    Sourcegithub.com/aquasecurity/kube-bench/blob/main/docs/running.md

  15. Wrong, not truePod Security Standards

    The notes saidPod Security Admission is enabled by default in Kubernetes 1.25+ / available in EKS 1.25+.

    CorrectedPodSecurity admission was beta and enabled by default from Kubernetes 1.23 and became stable in 1.25, the release that removed PodSecurityPolicy. EKS enables the PodSecurity admission plugin on every supported version (standard support 1.34-1.37, extended 1.31-1.33 as of 2026-11-19), so the version gate is moot.

    Sourcekubernetes.io/blog/2021/12/09/pod-security-admission-beta/%20;%20https://kubernetes.io/docs/concepts/security/pod-security-admission/%20;%20https://docs.aws.amazon.com/eks/latest/userguide/platform-versions.html

  16. Nuance, true with conditionsPod Security Standards

    The notes saidBaseline/Restricted control lists as described (AppArmor, SELinux, seccomp, sysctls, capabilities, volume types).

    CorrectedThe categories are right but the details are versioned: Baseline AppArmor now checks the appArmorProfile field (GA 1.30) as well as the legacy annotation; the SELinux type allowlist includes container_engine_t since 1.31; procMount must be Default; the safe-sysctl allowlist grows by release (tcp_rmem/tcp_wmem in 1.32, tcp_slow_start_after_idle and tcp_notsent_lowat in 1.37). Cite the PSS page for the target version.

    Sourcekubernetes.io/docs/concepts/security/pod-security-standards

  17. Nuance, true with conditionsPod Security Standards

    The notes saidOPA Gatekeeper and Kyverno can enforce and mutate.

    CorrectedBoth can, but the lesson should add the built-in options: ValidatingAdmissionPolicy (GA 1.30) and MutatingAdmissionPolicy (GA 1.36, admissionregistration.k8s.io/v1). Kyverno (v1.20.0) has CEL-based policy kinds (ValidatingPolicy, MutatingPolicy, GeneratingPolicy, ImageValidatingPolicy in policies.kyverno.io) and marks kyverno.io/v1 ClusterPolicy deprecated; Gatekeeper (v3.23.1) can generate VAPs from templates.

    Sourcekubernetes.io/docs/reference/access-authn-authz/mutating-admission-policy/%20;%20https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/%20;%20https://kyverno.io/docs/guides/migration-to-cel

  18. Wrong, not truePod Security Standards

    The notes saidBaseline 'HostPath volumes are restricted… Some specific paths might be allowed'.

    CorrectedBaseline forbids hostPath volumes entirely: spec.volumes[*].hostPath must be undefined/nil. There is no path allowlist (that was a PodSecurityPolicy feature).

    Sourcekubernetes.io/docs/concepts/security/pod-security-standards

  19. Wrong, not truePod Security Standards

    The notes saidRestricted requires 'runAsUser must specify a non-zero UID'.

    CorrectedRestricted requires runAsNonRoot: true (pod level or every container). runAsUser is optional; the 'Running as Non-root user (v1.23+)' control only forbids runAsUser: 0; any non-zero value or unset is allowed.

    Sourcekubernetes.io/docs/concepts/security/pod-security-standards

  20. Wrong, not truePod Security Standards

    The notes saidRestricted volume allowlist omits csi.

    CorrectedRestricted allows exactly: configMap, csi, downwardAPI, emptyDir, ephemeral, persistentVolumeClaim, projected, secret.

    Sourcekubernetes.io/docs/concepts/security/pod-security-standards

  21. Wrong, not truePod Security Standards

    The notes saidBaseline seccomp restrictions 'prevent disabling the default seccomp profile'.

    CorrectedBaseline only forbids explicitly setting seccompProfile.type: Unconfined (allowed: unset, RuntimeDefault, Localhost). An unset profile runs Unconfined unless the kubelet's SeccompDefault is enabled. Restricted is the level that requires RuntimeDefault or Localhost to be set.

    Sourcekubernetes.io/docs/concepts/security/pod-security-standards

Every correction across the guide, by note and topic.

Sources

Checked against kubernetes.io and AWS documentation for Kubernetes 1.37 on .

  1. kubernetes.io/docs/tasks/configure-pod-container/security-context
  2. kubernetes.io/docs/concepts/security/pod-security-standards
  3. kubernetes.io/docs/concepts/security/pod-security-admission
  4. kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-namespace-labels
  5. kubernetes.io/docs/tasks/configure-pod-container/migrate-from-psp
  6. kubernetes.io/docs/concepts/security/linux-kernel-security-constraints
  7. kubernetes.io/docs/concepts/workloads/pods/user-namespaces
  8. kubernetes.io/docs/concepts/containers/runtime-class
  9. kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy
  10. kubernetes.io/docs/reference/access-authn-authz/mutating-admission-policy
  11. kubernetes.io/docs/reference/command-line-tools-reference/feature-gates
  12. kyverno.io/docs/policy-types/validating-policy
  13. open-policy-agent.github.io/gatekeeper/website/docs/validating-admission-policy
  14. docs.aws.amazon.com/eks/latest/userguide/automode.html
  15. docs.aws.amazon.com/eks/latest/best-practices/pod-security.html
  16. docs.aws.amazon.com/eks/latest/best-practices/identity-and-access-management.html
  17. docs.aws.amazon.com/eks/latest/userguide/al2023.html
  18. docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html
  19. docs.aws.amazon.com/eks/latest/userguide/access-entries.html
  20. docs.aws.amazon.com/eks/latest/userguide/pod-identities.html
  21. docs.aws.amazon.com/eks/latest/userguide/envelope-encryption.html
  22. docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html
  23. docs.aws.amazon.com/guardduty/latest/ug/runtime-monitoring.html
  24. github.com/aquasecurity/kube-bench
  25. docker.com/blog/retiring-docker-content-trust
  26. docs.docker.com/compose/how-tos/use-secrets

Pod security: securityContext and Pod Security Admission

↓ ↑ step, 1 to 7 scene, Esc leave

kind cluster kxLast command: Nothing run yet