← CKAD: Kubernetes applications in production
09 / 12 · 45 MIN

Admission, capabilities, and effective identity

Distinguish API authorization, Pod admission, and process permissions; repair the demonstrated phase without unnecessarily broadening privileges.

Three decisions before the process

Authentication identifies the caller presenting an API request. Authorization checks whether that identity may perform the operation on the resource in the stated scope. Admission evaluates the object after those stages and can reject a configuration even when permission to create Pods exists. kubectl auth can-i helps investigate authorization, but does not validate every admission policy or process behavior.

Read the rejection text and controller events: Forbidden can result from authorization or a policy, depending on the message. Do not grant cluster-admin just because a request ended with that code.

Policy level, mode, and version

Pod Security Admission uses privileged, baseline, and restricted levels. Modes have different consequences: enforce rejects incompatible Pods; warn allows the request with a warning; audit allows it and adds an annotation to the audit event.

A namespace can combine modes at different levels. The version label pins one minor’s rules instead of implicitly following latest. Enforce applies to resulting Pods, not the Deployment object itself.

An accepted Deployment can therefore have ReplicaSets reporting FailedCreate for a policy violation. Warn and audit also inspect workload templates. Examine the namespace, version, and resulting PodSpec before concluding the application started.

Capabilities at container level

Linux capabilities divide process powers into specific operations. Configure capabilities in each container’s securityContext; a Kubernetes Role is not a replacement. Restricted policy for Linux Pods requires drop: ["ALL"] and permits adding only NET_BIND_SERVICE.

This is a policy allowance, not a reason to add that capability to every application. If the application can listen on a high port, use that option and adjust targetPort. If its contract requires a privileged port and the environment needs that capability, add only what is needed. runAsNonRoot, allowPrivilegeEscalation: false, and seccomp address other controls; none alone demonstrates that all capabilities were removed.

Filesystem, identity, and seccomp are distinct controls

readOnlyRootFilesystem protects the image root filesystem; it does not automatically make every volume read-only. An application writing temporary files may need a writable volume only at /tmp. Volume ownership and permissions must allow the effective UID/GID access. runAsNonRoot requires non-root execution; it does not grant directory access.

A RuntimeDefault seccomp profile uses runtime policy, whereas Localhost refers to a profile available on the node. Unconfined is not accepted by Restricted. If the API accepts a Pod but the process fails on a call or file, inspect logs, identity, and effective controls; broader RBAC does not change that process’s Linux permissions.

Publisher identity and workload identity

The identity creating a Deployment is not automatically the ServiceAccount used by its application. The PodSpec selects serviceAccountName, and tokens made available to the Pod belong to that identity. A user’s ability to read Secrets does not prove the application can do so.

Compare namespace, ServiceAccount name, resource, verb, and any subresources. If the process does not need the API, consider disabling automatic token mounting. That does not prevent kubelet from materializing a Secret referenced by a Pod volume; consuming a volume and calling the API are different paths. Protect sensitive values in logs and diagnostic examples.

Accept the repair at the right phase

The fragment shows a context for a Linux container needing no additional capabilities. It is neither a complete Pod nor a guarantee of compliance with every Restricted control. Apply the reasoning to each container, including init containers and sidecars.

After repairing a rejection, confirm Pod creation, startup, readiness, and the function motivating the change. If the problem was a /tmp write, verify that write under the intended UID without making the whole image writable. If it was an API request, verify only the necessary operation by the correct ServiceAccount.

The repair should preserve other boundaries and produce evidence specific to the recovered function.

securityContext:
  runAsNonRoot: true
  runAsUser: 10001
  allowPrivilegeEscalation: false
  readOnlyRootFilesystem: true
  capabilities:
    drop: ["ALL"]
  seccompProfile:
    type: RuntimeDefault
IN PRACTICE

A Deployment is accepted, but ReplicaSet events say its Pods violate Restricted by adding NET_ADMIN. The team proposes a broader Role. The correct response identifies namespace policy and the application’s actual need; it repairs the PodSpec or submits a justified exception through the established process. More API permissions do not resolve the prohibited capability.

Common pitfalls

Confusing a ServiceAccount with a Linux UID; treating warn as blocking; checking only the main container; disabling controls without identifying the failure phase.

Related topics: Workloads and configuration · Observability and security

Take this idea with you

Follow identity to the operation and configuration to the process. Authorization, admission, capabilities, filesystem, and seccomp require their own evidence.

Create account

References

Kubernetes® and CKAD are trademarks or registered trademarks of The Linux Foundation. bigsavant.com is an independent preparation platform and is not affiliated with, associated with, sponsored, authorised or endorsed by The Linux Foundation. Content and questions are original, are not official exam questions, and completing our tests does not award or guarantee any certification. Names are used only to identify the subject. All other trademarks belong to their respective owners.