Courseiva

Certified Kubernetes Security Specialist CKS (CKS) — Questions 451525

720 questions total · 10pages · All types, answers revealed

Page 6

Page 7 of 10

Page 8
451
MCQhard

You have built a custom seccomp profile at /var/lib/kubelet/seccomp/audit.json. Which YAML snippet correctly applies this profile to a container?

A.securityContext: seccompProfile: type: RuntimeDefault
B.securityContext: seccompProfile: type: Localhost localhostProfile: "profiles/audit.json"
C.securityContext: seccomp: type: Localhost profile: "audit.json"
D.securityContext: seccompProfile: type: Localhost localhostProfile: "audit.json"
AnswerD

Correct. It uses the current `seccompProfile` API with `type: Localhost` and `localhostProfile: "audit.json"`, which correctly points to the profile at `/var/lib/kubelet/seccomp/audit.json`.

Why this answer

The seccomp profile is stored at `/var/lib/kubelet/seccomp/audit.json`. The `localhostProfile` field expects a relative path from the base directory `/var/lib/kubelet/seccomp/`. Therefore, `audit.json` correctly resolves to the full path.

The `seccompProfile` API with `type: Localhost` is the current method for applying custom profiles.

Exam trap

The trap here is that candidates confuse the deprecated `seccomp` field (used in older Kubernetes versions) with the current `seccompProfile` API, or they assume a bare filename like `audit.json` works without the required relative path prefix.

How to eliminate wrong answers

Option A is wrong because `type: RuntimeDefault` applies the container runtime's default seccomp profile, not a custom profile at the specified path. Option C is wrong because it uses the deprecated `seccomp` field and `profile` key instead of the current `seccompProfile` API with `localhostProfile`. Option D is wrong because `localhostProfile: "audit.json"` is a bare filename, not a relative path; Kubernetes requires a relative path (e.g., `profiles/audit.json`) to locate the profile under `/var/lib/kubelet/seccomp/`.

452
MCQmedium

You want to drop all Linux capabilities from a container. Which securityContext field should you set?

A.capabilities.allow
B.capabilities.add: ["ALL"]
C.capabilities.drop: ["ALL"]
D.dropCapabilities: true
AnswerC

Drops all capabilities, minimizing privilege.

Why this answer

Setting `capabilities.drop: ["ALL"]` in the container's `securityContext` removes all Linux capabilities from the container's process, effectively running it with zero capabilities. This is the standard Kubernetes approach to drop all capabilities, as defined in the Pod Security Standards and the container runtime interface (CRI).

Exam trap

The trap in this question is that candidates may confuse `capabilities.drop` with `capabilities.add`, or expect a boolean field like `dropCapabilities`. However, Kubernetes requires an explicit list of capabilities to drop, and using `["ALL"]` is the correct way to drop all capabilities.

How to eliminate wrong answers

Option A is wrong because `capabilities.allow` is not a valid field in the Kubernetes `securityContext`; the correct field is `capabilities.add` to add capabilities. Option B is wrong because `capabilities.add: ["ALL"]` adds all Linux capabilities to the container, which is the opposite of dropping them and increases the attack surface. Option D is wrong because `dropCapabilities: true` is not a valid Kubernetes field; the correct syntax uses `capabilities.drop` with a list of capability names.

453
MCQeasy

Which of the following is the correct flag to enable audit logging on the kube-apiserver?

A.--audit-file
B.--audit-log-path
C.--audit-policy-file
D.--audit-log-file
AnswerB

This flag specifies the path for audit log output.

Why this answer

`--audit-log-path` is the flag used to specify the file path where the kube-apiserver writes audit log entries. This flag is defined in the Kubernetes API server component and is required to enable audit logging; without it, no audit logs are written.

Exam trap

The trap here is that candidates confuse `--audit-policy-file` (which defines what to log) with the flag that actually enables logging, or misremember the exact flag name as `--audit-log-file` instead of the correct `--audit-log-path`.

How to eliminate wrong answers

Option A is wrong because `--audit-file` is not a valid kube-apiserver flag; the correct flag for specifying the audit log file path is `--audit-log-path`. Option C is wrong because `--audit-policy-file` specifies the path to the audit policy YAML file that defines which events to log, but it does not enable audit logging by itself—it must be used together with `--audit-log-path`. Option D is wrong because `--audit-log-file` is not a recognized flag; the correct flag name uses `--audit-log-path` as per the Kubernetes API server command-line options.

454
MCQmedium

You run 'crictl ps' and see no output, but the node has running pods. What is the most likely cause?

A.The --runtime-endpoint flag is not set or points to the wrong socket
B.The container runtime is not Docker
C.The pod uses a different container runtime than CRI-O
D.The containers are in a different namespace
AnswerA

Why this answer

The `crictl ps` command queries the container runtime via the CRI (Container Runtime Interface) socket. If it returns no output while the node clearly has running pods (visible via `kubectl` or `kubelet`), the most likely cause is that the `--runtime-endpoint` flag is not set or points to the wrong socket. By default, `crictl` uses `/var/run/dockershim.sock` (deprecated) or may fall back to an incorrect path; if the actual runtime socket (e.g., `/run/containerd/containerd.sock` for containerd, or `/var/run/crio/crio.sock` for CRI-O) is not specified, the tool cannot connect to the runtime and returns an empty list.

Exam trap

The trap here is that candidates assume `crictl ps` shows all containers on the node, but it only shows containers managed by the CRI runtime at the specified endpoint — if the endpoint is misconfigured, it returns nothing even though pods are running.

How to eliminate wrong answers

Option B is wrong because the container runtime not being Docker is irrelevant — `crictl` works with any CRI-compliant runtime (containerd, CRI-O, etc.) and does not require Docker. Option C is wrong because `crictl` is designed to work with any CRI-compliant runtime; it does not care which specific runtime the pod uses as long as the endpoint is correct. Option D is wrong because containers are not namespaced in a way that hides them from `crictl`; `crictl` lists all containers managed by the runtime on that node, regardless of Kubernetes namespaces.

455
MCQhard

A security policy requires that all container images must reference a specific SHA256 digest instead of a tag. You need to enforce this using Kyverno. Which Kyverno rule type and pattern would you use?

A.A generate rule that creates a ConfigMap with allowed digests
B.A mutate rule that replaces the image tag with a digest
C.A validate rule with a pattern that the image field matches '@sha256:'
D.A validate rule checking the annotation 'image.openshift.io/triggers'
AnswerC

A validate rule can enforce that the image string contains a digest. Example: pattern: spec.containers[*].image: "*@sha256:*"

Why this answer

Kyverno's validate rules with a pattern can enforce that the image field in a Pod spec contains '@sha256:', ensuring only digest-based references are used. This directly meets the security policy requirement without altering the image reference or relying on external data.

Exam trap

The CKS exam often tests the distinction between validation and mutation rules, where candidates mistakenly choose a mutate rule to 'fix' the image reference instead of a validate rule to enforce the policy as written.

How to eliminate wrong answers

Option A is wrong because a generate rule creates resources like ConfigMaps but does not enforce image digest usage at admission time; it only provides data that must be referenced elsewhere. Option B is wrong because a mutate rule would automatically replace tags with digests, which violates the policy's intent to require explicit digest references from the user, not automatic remediation. Option D is wrong because the annotation 'image.openshift.io/triggers' is OpenShift-specific for triggering image updates, not a Kyverno mechanism for validating image references.

456
Multi-Selecthard

Which TWO of the following are effective measures to harden the Kubernetes API server against unauthorized access?

Select 2 answers
A.Enable the NodeRestriction admission controller
B.Set --anonymous-auth=true to allow all users
C.Enable audit logging to detect unauthorized attempts
D.Disable all authentication mechanisms and rely on network policies
E.Configure the API server to use TLS certificates for client authentication
AnswersA, E

Limits what nodes can modify, reducing attack surface.

Why this answer

The NodeRestriction admission controller limits the Node and Pod objects a kubelet can modify, preventing compromised nodes from accessing or modifying resources beyond their own. This is a key hardening measure because it enforces the principle of least privilege directly within the API server's admission chain, reducing the blast radius of a node compromise.

Exam trap

CNCF often tests the distinction between preventive controls (like admission controllers and authentication) and detective controls (like audit logging), so candidates mistakenly select audit logging as a hardening measure when it only detects, not prevents, unauthorized access.

457
MCQeasy

Which crictl command lists all running containers on a node?

A.crictl pods
B.crictl images
C.crictl ps
D.crictl stats
AnswerC

Correct: crictl ps lists containers.

Why this answer

crictl ps lists running containers, similar to docker ps.

458
Multi-Selectmedium

Which TWO admission plugins are recommended to be enabled for security hardening?

Select 2 answers
A.AlwaysPullImages
B.NodeRestriction
C.NamespaceLifecycle
D.PodSecurity
E.DefaultStorageClass
AnswersB, D

Limits node modifications.

Why this answer

NodeRestriction is correct because it limits the Node object modifications a kubelet can make, preventing compromised nodes from modifying other nodes or escalating privileges. PodSecurity is correct because it enforces Pod Security Standards (baseline, restricted) via admission, replacing the deprecated PodSecurityPolicy with a built-in, stable mechanism for controlling pod security contexts.

Exam trap

CNCF often tests the distinction between plugins that are 'enabled by default' (like NamespaceLifecycle) versus those that are specifically 'recommended for security hardening' (like NodeRestriction and PodSecurity), causing candidates to pick default plugins that are not security-focused.

459
MCQmedium

Which kubectl command(s) can you use to view the logs of a specific container in a multi-container pod? (Select all that apply)

A.kubectl logs <pod> -c <container>
B.kubectl logs <pod> --container <container>
C.kubectl logs <pod> <container>
D.kubectl logs <pod> --all-containers
AnswerA, B

-c is the short form for --container; both are correct.

Why this answer

The `kubectl logs` command allows you to view logs from a specific container in a multi-container pod using the `-c` or `--container` flag. Both `kubectl logs <pod> -c <container>` (option A) and `kubectl logs <pod> --container <container>` (option B) are correct. Option C is incorrect because it omits the flag, and option D shows logs from all containers, not a specific one.

460
MCQhard

An administrator wants to restrict which nodes a pod can be scheduled on using the NodeRestriction admission plugin. Which flag must be set on the kube-apiserver to enable this plugin?

A.--admission-control=NodeRestriction
B.--enable-admission-plugins=PodNodeSelector
C.--authorization-mode=Node
D.--enable-admission-plugins=NodeRestriction
AnswerD

This flag enables the NodeRestriction admission plugin, which enforces node restrictions on pods.

Why this answer

The NodeRestriction admission plugin limits the labels and taints that a kubelet running on a node can modify on its own Node object. To enable it, the `--enable-admission-plugins=NodeRestriction` flag must be set on the kube-apiserver, as admission plugins are enabled via this flag. This plugin works in conjunction with the Node authorizer and the NodeRestriction admission controller to enforce node-level restrictions.

Exam trap

The trap here is that candidates confuse the deprecated `--admission-control` flag with the current `--enable-admission-plugins` flag, or they mix up the NodeRestriction plugin with the Node authorizer or the PodNodeSelector plugin.

How to eliminate wrong answers

Option A is wrong because `--admission-control` is a deprecated flag; the correct flag is `--enable-admission-plugins`. Option B is wrong because `PodNodeSelector` is a different admission plugin that enforces namespace-level node selector constraints, not the NodeRestriction plugin. Option C is wrong because `--authorization-mode=Node` enables the Node authorizer, which authorizes kubelet API requests, but does not enable the NodeRestriction admission plugin.

461
MCQeasy

Which flag enables the PodSecurity admission plugin in kube-apiserver?

A.--enable-admission-plugins=PodSecurity
B.--admission-control=PodSecurity
C.--feature-gates=PodSecurity=true
D.--pod-security-policy=true
AnswerA

The PodSecurity plugin is enabled by adding it to the --enable-admission-plugins flag.

Why this answer

The PodSecurity admission plugin is enabled in kube-apiserver by passing the `--enable-admission-plugins=PodSecurity` flag. This flag activates the built-in Pod Security Admission (PSA) controller, which replaced the deprecated PodSecurityPolicy (PSP) in Kubernetes v1.25. The plugin enforces the Pod Security Standards (baseline, restricted, privileged) at the namespace level based on labels.

Exam trap

Candidates often confuse enabling a feature gate with enabling an admission plugin; the trap here is that candidates confuse `--feature-gates=PodSecurity=true` (which only makes the plugin available) with `--enable-admission-plugins=PodSecurity` (which actually activates it), or they mistakenly use the deprecated `--admission-control` flag.

How to eliminate wrong answers

Option B is wrong because `--admission-control` is a legacy flag from older Kubernetes versions (pre-1.10) and is no longer supported; the correct flag is `--enable-admission-plugins`. Option C is wrong because `--feature-gates=PodSecurity=true` only enables the PodSecurity feature gate (which is needed for the plugin to be available), but does not actually activate the admission plugin itself; the plugin must be explicitly added via `--enable-admission-plugins`. Option D is wrong because `--pod-security-policy=true` is not a valid kube-apiserver flag; the PodSecurityPolicy admission controller was enabled via `--enable-admission-plugins=PodSecurityPolicy` (now deprecated and removed in v1.25), and the flag shown does not exist.

462
MCQhard

An admin runs 'kubectl run test-pod --image=nginx:latest' and the Pod is created but immediately enters 'CrashLoopBackOff'. 'kubectl describe pod test-pod' shows 'Back-off restarting failed container'. Which admission controller might cause this if misconfigured?

A.ValidatingAdmissionWebhook
B.MutatingAdmissionWebhook
C.PodSecurity
D.PersistentVolumeClaimResize
AnswerB

A mutating webhook could modify the Pod spec (e.g., adding a sidecar or changing command) causing the container to fail.

Why this answer

A MutatingAdmissionWebhook can modify Pod specifications (e.g., injecting sidecar containers, changing image names, or adding init containers) before the Pod is persisted. If the webhook misconfigures the Pod—such as replacing the image with a non-existent one or adding a failing init container—the container may fail to start, causing a CrashLoopBackOff. The 'Back-off restarting failed container' message indicates the container itself is failing, which aligns with a mutation that breaks the Pod's runtime behavior.

Exam trap

The trap here is that candidates often assume a Pod entering CrashLoopBackOff must be due to a security policy (PodSecurity) or a validation rejection, but the 'Back-off restarting failed container' message indicates the container ran and failed, which points to a mutation that altered the container's runtime configuration, not a rejection or security constraint.

How to eliminate wrong answers

Option A is wrong because ValidatingAdmissionWebhooks only reject or allow requests based on validation logic; they do not modify the Pod spec, so they cannot cause a container to fail at runtime due to a misconfiguration injected into the Pod. Option C is wrong because PodSecurity (formerly PodSecurityPolicy) enforces security contexts (e.g., privileged, hostNetwork) and would either reject the Pod or allow it; it does not mutate the Pod spec to cause a container crash. Option D is wrong because PersistentVolumeClaimResize is an admission controller that handles PVC resize requests, not Pod creation or container execution, so it has no impact on a Pod entering CrashLoopBackOff.

463
MCQmedium

An OPA Gatekeeper ConstraintTemplate uses a Rego rule that denies pods without a specific label. The Constraint is created but pods without the label are still being allowed. What is the MOST likely cause?

A.The Rego policy has a syntax error
B.Gatekeeper is not installed in the cluster
C.The Constraint object has not been created
D.The namespace is excluded via Gatekeeper configuration
AnswerC

Correct. The Constraint instantiates the template.

Why this answer

The most likely cause is that the Constraint object has not been created. In OPA Gatekeeper, a ConstraintTemplate defines the Rego rule logic, but it is only a template. To enforce the policy, you must create a Constraint resource that instantiates the template and specifies parameters (e.g., the required label).

Without the Constraint, the Rego rule is never evaluated against admission requests, so pods without the label are allowed.

Exam trap

In the CNCF CKS exam, be careful to distinguish between a ConstraintTemplate and a Constraint; creating only the template does not enforce the policy.

How to eliminate wrong answers

Option A is wrong because a syntax error in the Rego policy would typically cause the ConstraintTemplate to fail validation or produce an error in the Gatekeeper logs, but the question states the Constraint is created, implying the template is valid. Option B is wrong because if Gatekeeper were not installed, the ConstraintTemplate and Constraint resources would not be processed at all, and the question implies the Constraint is created (which requires Gatekeeper's webhook to be present). Option D is wrong because namespace exclusion via Gatekeeper configuration would prevent the policy from applying to pods in excluded namespaces, but the question does not mention any namespace exclusion; the most common and direct cause is the missing Constraint object.

464
MCQmedium

A pod runs with a service account that has a ClusterRoleBinding granting cluster-admin. What is the best practice to reduce the risk of privilege escalation?

A.Use a PodSecurityPolicy to restrict the service account
B.Delete the service account and create a new one without any roles
C.Create a more restrictive Role/ClusterRole with only required permissions and bind it to the service account, removing the cluster-admin binding
D.Add a NetworkPolicy to block outbound traffic from the pod
AnswerC

This follows the principle of least privilege.

Why this answer

The principle of least privilege dictates that a service account should only have the permissions necessary for its function. By creating a more restrictive Role/ClusterRole with only required permissions and binding it to the service account, you remove the excessive cluster-admin privileges, directly reducing the risk of privilege escalation. This aligns with Kubernetes RBAC best practices for hardening cluster setup.

Exam trap

CNCF often tests the distinction between RBAC (who can do what) and other security controls like PodSecurityPolicy or NetworkPolicy, expecting candidates to recognize that only RBAC changes can directly reduce service account permissions.

How to eliminate wrong answers

Option A is wrong because PodSecurityPolicy (PSP) is a deprecated admission controller that controls pod security contexts (e.g., privileged containers, host namespaces), not RBAC permissions; it cannot restrict what a service account can do via ClusterRoleBindings. Option B is wrong because deleting the service account and creating a new one without any roles would break the pod's functionality entirely, as it would have no permissions to perform any API operations, which is not a practical security fix. Option D is wrong because NetworkPolicy controls network traffic at the pod level (e.g., ingress/egress rules), not RBAC permissions; it cannot prevent a service account from abusing its cluster-admin privileges to escalate privileges via the Kubernetes API.

465
MCQmedium

You run 'kubectl auth can-i --list --as=admin' and see that the admin user has full cluster-admin access. Which command would create a ClusterRoleBinding for a user named 'viewer' with read-only access to all resources?

A.kubectl create rolebinding viewer-binding --clusterrole=view --user=viewer
B.kubectl create clusterrole viewer --verb=get,list,watch --resource=*
C.kubectl create clusterrolebinding viewer-binding --role=view --user=viewer
D.kubectl create clusterrolebinding viewer-binding --clusterrole=view --user=viewer
AnswerD

This binds the 'view' ClusterRole to user 'viewer'.

Why this answer

It uses `kubectl create clusterrolebinding` to bind the built-in `view` ClusterRole (which grants read-only access: get, list, watch) to the user `viewer` at the cluster scope. A ClusterRoleBinding is required to grant permissions across all namespaces, and the `--clusterrole` flag correctly references the ClusterRole, not a Role.

Exam trap

The trap here is that candidates confuse `rolebinding` with `clusterrolebinding` and `--role` with `--clusterrole`, leading them to pick options that either limit permissions to a single namespace or use incorrect syntax for binding a ClusterRole.

How to eliminate wrong answers

Option A is wrong because `kubectl create rolebinding` creates a namespaced RoleBinding, which only grants permissions within a specific namespace (default if not specified), not across all resources cluster-wide. Option B is wrong because it creates a new ClusterRole with `*` as the resource, which is invalid syntax (resources must be specific, e.g., `'*'` is not a valid resource name) and it does not bind the role to the user. Option C is wrong because it uses `--role=view` instead of `--clusterrole=view`; `--role` expects a namespaced Role, not a ClusterRole, and a ClusterRoleBinding cannot reference a namespaced Role.

466
MCQeasy

Which flag on the kubelet disables anonymous access?

A.--anonymous-auth=false
B.--disable-anonymous
C.--no-anonymous
D.--enable-anonymous-auth=false
AnswerA

This is the correct flag on kubelet.

Why this answer

The `--anonymous-auth` flag on the kubelet controls whether anonymous requests are allowed. Setting `--anonymous-auth=false` explicitly disables anonymous access, requiring all requests to present valid authentication credentials. This is a critical hardening measure to prevent unauthenticated users from interacting with the kubelet API.

Exam trap

CNCF often tests the exact flag name and syntax, so candidates may confuse `--anonymous-auth` with `--enable-anonymous-auth` or invent non-existent flags like `--disable-anonymous` or `--no-anonymous`.

How to eliminate wrong answers

Option B is wrong because `--disable-anonymous` is not a valid kubelet flag; the kubelet uses `--anonymous-auth` to control anonymous access. Option C is wrong because `--no-anonymous` is not a recognized flag; the kubelet does not support a `--no-` prefix for this setting. Option D is wrong because `--enable-anonymous-auth=false` is not a valid flag; the correct flag is `--anonymous-auth`, and setting it to `false` disables anonymous access, not `--enable-anonymous-auth`.

467
MCQeasy

You want to isolate a compromised pod by blocking all network traffic to and from it. Which NetworkPolicy would you apply?

A.A policy with podSelector matching the pod, and only ingress rules denying from all
B.A policy with podSelector matching the pod, and policyTypes: [Ingress, Egress] with no rules
C.A policy with podSelector matching the pod, and egress rules allowing to 0.0.0.0/0
D.A policy with podSelector: {} and no rules
AnswerB

Why this answer

To isolate a compromised pod, you must deny both ingress and egress traffic. Option B applies a NetworkPolicy that selects the pod and specifies both Ingress and Egress policy types without any rules, which results in a default deny-all for both directions, effectively isolating the pod. Option A only blocks ingress, leaving egress unaffected.

Option D selects all pods, which would isolate the compromised pod but also impact all other pods unnecessarily. Option C allows all egress, which defeats isolation.

468
MCQmedium

A developer created a ClusterRoleBinding that grants cluster-admin to a service account. What is the security concern?

A.Service accounts must use RoleBindings only
B.ClusterRoleBindings are deprecated
C.Service accounts cannot use ClusterRoleBindings
D.It gives the service account full cluster-wide permissions, which is excessive
AnswerD

Cluster-admin grants unrestricted access to all resources.

Why this answer

Granting a service account cluster-admin via a ClusterRoleBinding provides unrestricted, cluster-wide permissions, violating the principle of least privilege. This is a significant security risk as it allows the service account to perform any action on any resource in any namespace, including modifying RBAC rules, secrets, or node configurations. In Kubernetes, service accounts should be bound only to the minimal roles required for their function, typically using RoleBindings scoped to a specific namespace.

Exam trap

CNCF often tests the misconception that service accounts are restricted to namespace-scoped bindings, leading candidates to incorrectly choose Option A or C, when in fact Kubernetes allows any subject to be bound to any ClusterRole.

How to eliminate wrong answers

Option A is wrong because service accounts can use both RoleBindings (namespace-scoped) and ClusterRoleBindings (cluster-scoped) depending on the required scope; there is no Kubernetes restriction limiting them to RoleBindings only. Option B is wrong because ClusterRoleBindings are not deprecated; they remain a core, actively supported RBAC resource for granting cluster-wide permissions. Option C is wrong because service accounts can absolutely use ClusterRoleBindings; the Kubernetes API allows binding any subject (user, group, or service account) to a ClusterRole via a ClusterRoleBinding.

469
MCQmedium

A cluster administrator wants to ensure that pods cannot modify node objects. Which admission plugin should be enabled?

A.PodSecurityPolicy
B.NodeAffinity
C.PodNodeSelector
D.NodeRestriction
AnswerD

This plugin restricts node modifications.

Why this answer

The NodeRestriction admission plugin limits the kubelet's ability to modify node and pod objects to only those nodes it is authorized to manage. This prevents a compromised or misconfigured kubelet from modifying arbitrary node objects, enforcing the principle of least privilege. Option D is correct because it directly addresses the requirement to restrict node object modifications.

Exam trap

The trap here is that candidates often confuse admission plugins that affect pod scheduling (like NodeAffinity or PodNodeSelector) with those that enforce node-level security restrictions, leading them to overlook NodeRestriction as the correct answer.

How to eliminate wrong answers

Option A is wrong because PodSecurityPolicy (deprecated in Kubernetes 1.21 and removed in 1.25) controls security-sensitive aspects of pod specs (e.g., privileged containers, host namespaces) but does not restrict modifications to node objects. Option B is wrong because NodeAffinity is a scheduling constraint that influences pod placement based on node labels, not an admission plugin that enforces node object modification restrictions. Option C is wrong because PodNodeSelector is an admission plugin that enforces namespace-level node selector constraints on pods, but it does not prevent pods or kubelets from modifying node objects.

470
MCQmedium

A pod runs with an immutable root filesystem (readOnlyRootFilesystem: true). The application attempts to write to /tmp. What is the expected behavior?

A.The write fails with a permission error unless a writable volume is mounted at /tmp
B.The application can write to any directory because /tmp is always writable
C.The container crashes immediately
D.The write succeeds and is silently dropped
AnswerA

Why this answer

When a pod is configured with `readOnlyRootFilesystem: true`, the container's root filesystem is mounted as read-only. The `/tmp` directory is part of the root filesystem, so any write attempt to it will fail with a permission error (EPERM) unless a writable volume (e.g., `emptyDir`, `hostPath`, or `PersistentVolumeClaim`) is explicitly mounted at `/tmp`. This is enforced by the Linux kernel's mount flags and is a common security hardening practice to prevent unauthorized writes.

Exam trap

In the CKS exam, a common pitfall is assuming that /tmp is inherently writable or that the container will crash. The correct understanding is that the kernel enforces the read-only flag at the filesystem level, and writes fail with a permission error unless a writable volume is mounted at /tmp.

How to eliminate wrong answers

Option B is wrong because `/tmp` is not always writable; its writability depends on the filesystem mount flags, and with `readOnlyRootFilesystem: true`, the entire root filesystem, including `/tmp`, is read-only. Option C is wrong because the container does not crash; the write operation simply fails with an error, and the application may handle it gracefully or log the failure, but the container continues running. Option D is wrong because writes are not silently dropped; the kernel returns an explicit error (e.g., EROFS or EACCES) to the application, and the data is not written.

471
MCQeasy

An admin runs 'crictl ps' on a node and sees multiple containers. Which command should they use to view the logs of a specific container?

A.crictl logs <container-id>
B.crictl exec <container-id> logs
C.crictl inspect <container-id>
D.crictl ps -a <container-id>
AnswerA

crictl logs fetches logs of the specified container.

Why this answer

`crictl logs` is the dedicated command to retrieve container logs from the container runtime interface (CRI), fetching stdout and stderr output from the specified container, which is essential for debugging and monitoring containerized workloads on a Kubernetes node.

Exam trap

The trap here is that candidates may confuse `crictl` with other container command-line tools, assuming `crictl exec` or `crictl inspect` can retrieve logs, when in fact only `crictl logs` provides that functionality, and `crictl ps -a` merely lists containers without log content.

How to eliminate wrong answers

Option B is wrong because `crictl exec` is used to run a command inside a running container (e.g., `crictl exec -it <container-id> sh`), not to view logs; there is no `logs` subcommand for `exec`. Option C is wrong because `crictl inspect` returns detailed metadata and configuration of a container (e.g., mounts, environment variables, resource limits), not its log output. Option D is wrong because `crictl ps -a` lists all containers (including stopped ones) with their status and IDs, but does not display logs; appending a container ID to `ps` is syntactically invalid.

472
Multi-Selecthard

Which THREE of the following are recommended measures to reduce the attack surface of Kubernetes nodes?

Select 3 answers
A.Disable unnecessary system services on nodes
B.Minimize host access from containers (avoid hostPID, hostNetwork, hostIPC)
C.Open all ports on nodes to allow easy debugging
D.Run all containers as root user
E.Apply Pod Security Standards to enforce least privilege
AnswersA, B, E

Reduces attack surface by removing unused services.

Why this answer

Disabling unnecessary system services on Kubernetes nodes reduces the number of running processes and open ports that could be exploited by an attacker. Services like telnet, rsh, or unused SNMP daemons provide additional attack vectors. This aligns with the principle of minimalism in system hardening, as recommended by the CIS Kubernetes Benchmark.

Exam trap

The CNCF CKS exam often tests the misconception that opening all ports aids debugging, but in Kubernetes, debugging should be done via kubectl exec or ephemeral containers, not by exposing node ports. Additionally, running containers as root is a common mistake that violates Pod Security Standards and the principle of least privilege.

473
Multi-Selecteasy

Which TWO of the following are valid modes for an AppArmor profile?

Select 2 answers
A.unconfined
B.complain
C.enforce
D.permissive
E.audit
AnswersB, C

In complain mode, violations are logged but not blocked.

Why this answer

AppArmor profiles operate in two primary modes: 'complain' (also known as 'learning' mode) and 'enforce' (also known as 'confined' mode). In complain mode, policy violations are logged but not blocked, allowing administrators to test and refine profiles. In enforce mode, violations are both logged and blocked, actively restricting the application's behavior according to the profile.

Exam trap

CNCF often tests the distinction between AppArmor and SELinux terminology, where candidates mistakenly apply SELinux concepts (like 'permissive' or 'enforcing') to AppArmor, which uses 'complain' and 'enforce' as its only two valid modes.

474
Multi-Selecteasy

You are asked to secure a set of microservices running in a Kubernetes cluster. Which TWO of the following practices help minimize vulnerabilities in microservices?

Select 2 answers
A.Manually inject sidecar proxies into every pod to enforce mTLS.
B.Run containers in privileged mode to allow them to perform necessary system calls.
C.Ensure containers run with a non-root user.
D.Use a read-only root filesystem for containers.
E.Store secrets directly in container images for easy access.
AnswersC, D

Running as non-root limits the permissions available to an attacker if the container is compromised.

Why this answer

Running containers with a non-root user (via the `securityContext.runAsNonRoot: true` field or a specific `runAsUser` directive) prevents privilege escalation and limits the blast radius of a container compromise. This aligns with the principle of least privilege, a core mitigation against container breakout attacks in Kubernetes.

Exam trap

CNCF often tests the misconception that sidecar proxies must be manually injected to enforce mTLS, but the correct approach is to use automated injection via admission controllers to avoid misconfiguration and ensure consistent policy enforcement.

475
MCQhard

A security scan reports that the etcd data directory is not encrypted at rest. The cluster uses etcd v3.5. Which steps are required to enable encryption?

A.Use etcdctl to encrypt the data directory
B.Create an EncryptionConfiguration resource with aescbc, restart API server with --encryption-provider-config
C.Set --encryption-provider=secretbox on etcd
D.Set ETCD_ENABLE_ENCRYPTION=true environment variable
AnswerB

This is the correct procedure for enabling encryption at rest.

Why this answer

Etcd data encryption at rest in Kubernetes is implemented via an EncryptionConfiguration resource that specifies a provider (e.g., aescbc) and a key. The kube-apiserver must be restarted with the --encryption-provider-config flag pointing to that configuration file, which instructs the API server to encrypt resources before writing them to etcd. This is the only supported method for enabling encryption at rest in Kubernetes clusters using etcd v3.5.

Exam trap

The trap here is that candidates often assume encryption at rest is configured directly on etcd (via flags or environment variables), when in fact it is a kube-apiserver-level feature that uses an EncryptionConfiguration resource and the --encryption-provider-config flag.

How to eliminate wrong answers

Option A is wrong because etcdctl does not have a command to encrypt the entire data directory; encryption is handled at the Kubernetes API server level, not by directly manipulating etcd. Option C is wrong because --encryption-provider is not a valid flag for etcd; etcd itself does not natively support encryption at rest via a flag, and the encryption provider configuration is applied to the kube-apiserver, not etcd. Option D is wrong because ETCD_ENABLE_ENCRYPTION is not a recognized environment variable in etcd v3.5; encryption at rest is not enabled by setting an environment variable on etcd.

476
MCQmedium

You are implementing a Gatekeeper policy to deny pods that run as root. Which Rego rule should you include in the ConstraintTemplate?

A.allow[{"msg": msg}] { msg := "container runs as root"; input.spec.containers[_].securityContext.runAsNonRoot == false }
B.deny[msg] { msg := "container runs as root"; not input.spec.containers[_].securityContext.runAsNonRoot }
C.deny[{"msg": msg}] { msg := "container runs as root"; not input.spec.containers[_].securityContext.runAsNonRoot }
D.deny[msg] { input.spec.containers[_].securityContext.runAsNonRoot == false }
AnswerC

This option fails to deny pods that specifically run as root (UID 0). The rule `not input.spec.containers[_].securityContext.runAsNonRoot` only checks for the absence or falsity of the `runAsNonRoot` flag. A container can still run as a non-root user (e.g., UID 1000) even if `runAsNonRoot` is unset, making this rule too broad for the objective of identifying actual root execution. It is tempting because `runAsNonRoot` relates to root prevention. This rule would be correct if the policy required all containers to explicitly declare `securityContext.runAsNonRoot: true` as a security best practise.

Why this answer

Option C uses the correct logic: the 'not' operator handles missing or false 'runAsNonRoot'. It also returns the expected object format {"msg": "..."}, which Gatekeeper requires. While Gatekeeper ConstraintTemplates typically require a rule named 'violation', this option contains the correct pattern and logic for denying containers that do not run as non-root.

Exam trap

A common trap is to assume that a rule named 'deny' is acceptable in Gatekeeper. Gatekeeper requires a rule named 'violation' that returns an object with a 'msg' key. Candidates often mistakenly choose 'deny' rules (options B and D) or use incorrect logic (option A).

How to eliminate wrong answers

Option A is wrong because it uses 'allow' instead of 'deny', which would incorrectly permit pods that run as root rather than denying them. Option B is wrong because it uses 'deny[msg]' without wrapping the message in an object, but Gatekeeper expects violations to be objects with a 'msg' key, so the syntax is invalid. Option D is wrong because it uses 'deny[msg]' without the object wrapper and also lacks the 'not' operator, which would only catch cases where runAsNonRoot is explicitly false, missing cases where the field is missing or undefined.

477
MCQmedium

You need to isolate a compromised pod named 'malicious-pod' in the 'default' namespace so that it cannot communicate with any other pod, but can still receive traffic from a specific monitoring pod. Which NetworkPolicy should you apply?

A.apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: isolate-pod spec: podSelector: matchLabels: app: malicious-pod ingress: - from: - podSelector: matchLabels: app: monitoring-pod policyTypes: - Ingress - Egress
B.apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: isolate-pod spec: podSelector: matchLabels: app: malicious-pod egress: - {} policyTypes: - Egress
C.apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: isolate-pod spec: podSelector: matchLabels: app: malicious-pod policyTypes: - Ingress - Egress
D.apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: isolate-pod spec: podSelector: matchLabels: app: malicious-pod ingress: - {} policyTypes: - Ingress
AnswerA

Allows ingress only from monitoring-pod, and blocks all egress by default. This isolates the pod while allowing monitoring.

Why this answer

It selects the compromised pod, allows ingress only from the monitoring pod (using podSelector), and specifies policyTypes as both Ingress and Egress. Since no egress rules are defined, egress traffic is denied by default, isolating the pod from initiating communication. Option B incorrectly allows all egress via an empty egress rule.

Option C denies all ingress (no ingress rules) and thus blocks the monitoring pod. Option D allows all ingress and does not restrict egress, failing to isolate the pod.

Exam trap

A common mistake is thinking that an empty `ingress` or `egress` array denies all traffic, but in NetworkPolicy, if the policy type is specified and no rules are provided, all traffic of that direction is denied. However, if the policy type is not specified, traffic is allowed.

478
MCQeasy

Which kubectl command would you use to create a ValidatingWebhookConfiguration from a YAML file?

A.kubectl run webhook --image=webhook --restart=Never
B.kubectl apply -f webhook.yaml
C.kubectl create -f webhook.yaml
D.kubectl expose deployment webhook --port=443
AnswerB

This is the standard command to create or update resources from a file.

Why this answer

`kubectl apply -f webhook.yaml` is the standard command to create or update Kubernetes resources from a YAML file, including a ValidatingWebhookConfiguration. This command uses declarative management, applying the configuration defined in the file to the cluster, which is the recommended approach for creating admission webhooks.

Exam trap

In the CKS exam, candidates often confuse `kubectl create` and `kubectl apply`. While `kubectl create -f` creates a resource, `kubectl apply -f` is the preferred declarative approach for managing resources like ValidatingWebhookConfiguration because it supports idempotent updates and better handles changes over time.

How to eliminate wrong answers

Option A is wrong because `kubectl run` creates a Pod (or Deployment) from an image, not a ValidatingWebhookConfiguration; it cannot parse a YAML file for custom resource types. Option C is wrong because `kubectl create -f webhook.yaml` would attempt to create resources from the file, but it uses imperative management and may fail if the resource already exists or if the YAML contains complex configurations that require `apply` semantics; more importantly, `kubectl create` is not the typical command for ValidatingWebhookConfiguration as it does not handle updates gracefully. Option D is wrong because `kubectl expose` creates a Service to expose a deployment, not a ValidatingWebhookConfiguration; it has no relation to webhook configuration resources.

479
MCQeasy

Which kubelet flag should be set to ensure the kubelet does not allow anonymous requests?

A.--authentication-token-webhook=true
B.--read-only-port=0
C.--anonymous-auth=false
D.--protect-kernel-defaults=true
AnswerC

Setting this flag to false on the kubelet disables anonymous requests to the kubelet.

Why this answer

Setting `--anonymous-auth=false` explicitly disables anonymous requests to the kubelet. By default, anonymous authentication is enabled, which allows unauthenticated users to access the kubelet API. Disabling this flag ensures that only authenticated requests are processed, aligning with the principle of least privilege and hardening the cluster.

Exam trap

The trap here is that candidates often confuse `--anonymous-auth=false` with `--authentication-token-webhook=true`, thinking token webhook alone blocks anonymous requests, but anonymous auth must be explicitly disabled as a separate step.

How to eliminate wrong answers

Option A is wrong because `--authentication-token-webhook=true` enables webhook-based token authentication (e.g., for service accounts), but it does not affect anonymous requests; anonymous auth is controlled by a separate flag. Option B is wrong because `--read-only-port=0` disables the read-only port (10255), which reduces exposure but does not prevent anonymous requests on the secure port (10250). Option D is wrong because `--protect-kernel-defaults=true` ensures kernel-level security settings (e.g., sysctl parameters) are enforced, but it has no impact on kubelet authentication or anonymous request handling.

480
MCQhard

A pod is stuck in Pending state. 'kubectl describe pod' shows the event: '0/4 nodes are available: 1 node had taint {node-role.kubernetes.io/control-plane: }, that the pod didn't tolerate, 3 Insufficient memory.' The pod YAML does not specify any tolerations. Which command would allow the pod to schedule on the control-plane node?

A.kubectl taint nodes control-plane node-role.kubernetes.io/control-plane-
B.kubectl cordon control-plane
C.Edit the pod YAML to add tolerations for node-role.kubernetes.io/control-plane
D.kubectl delete pod --all
AnswerC

Adding the appropriate toleration allows the pod to schedule on tainted nodes.

Why this answer

The pod is failing to schedule on the control-plane node due to the `node-role.kubernetes.io/control-plane` taint, which by default prevents pods without a matching toleration from being scheduled. Since the pod YAML does not specify any tolerations, editing it to add a toleration for that taint (e.g., `tolerations: - key: node-role.kubernetes.io/control-plane operator: Exists`) explicitly allows the pod to run on the control-plane node, resolving the Pending state.

Exam trap

The trap here is that candidates often choose to remove the taint (Option A) because it seems like a quick fix, but the CKS exam emphasizes security best practices—taints are a security mechanism to isolate control-plane components, and removing them globally is insecure and unnecessary when a toleration can be added to the specific pod.

How to eliminate wrong answers

Option A is wrong because `kubectl taint nodes control-plane node-role.kubernetes.io/control-plane-` removes the taint from the control-plane node, which would allow all pods to schedule there, but this is a cluster-wide change that violates security best practices (control-plane nodes should remain tainted to isolate critical components). Option B is wrong because `kubectl cordon control-plane` marks the node as unschedulable, which would prevent any new pods from being scheduled on it, making the problem worse. Option D is wrong because `kubectl delete pod --all` deletes all pods in the current namespace, which does not address the scheduling issue caused by the taint and may disrupt running workloads.

481
Multi-Selectmedium

Which TWO of the following are valid Pod Security Standards levels?

Select 2 answers
A.secure
B.default
C.privileged
D.baseline
E.strict
AnswersC, D

Valid level.

Why this answer

The Pod Security Standards (PSS) define three levels: privileged, baseline, and restricted. 'Privileged' is the most permissive level, allowing all known privilege escalations and is intended for system-level workloads that require unrestricted access to host resources.

Exam trap

The CKS exam often tests the exact naming of the three Pod Security Standards levels, and candidates mistakenly invent plausible-sounding names like 'secure', 'default', or 'strict' instead of the official terms 'privileged', 'baseline', and 'restricted'.

482
MCQeasy

To reduce the attack surface, a security best practice is to drop all capabilities from a container and add only those required. Which securityContext field is used to drop all capabilities?

A.capabilities.disable: ["ALL"]
B.capabilities.remove: ["ALL"]
C.capabilities.drop: ["ALL"]
D.privileged: false
AnswerC

This correctly drops all capabilities from the container.

Why this answer

In Kubernetes, the `capabilities.drop` field in the securityContext is used to explicitly remove Linux capabilities from a container. Setting `capabilities.drop: ["ALL"]` drops all capabilities, effectively reducing the attack surface by ensuring the container starts with no privileges, and then specific capabilities can be added back via `capabilities.add` if needed.

Exam trap

CNCF often tests the exact Kubernetes API field name `capabilities.drop` versus common but incorrect synonyms like `disable` or `remove`, and candidates may confuse dropping all capabilities with simply disabling privileged mode.

How to eliminate wrong answers

Option A is wrong because `capabilities.disable` is not a valid field in the Kubernetes securityContext; the correct field is `capabilities.drop`. Option B is wrong because `capabilities.remove` is not a recognized field in the Kubernetes API; the field is specifically named `drop`. Option D is wrong because `privileged: false` only disables privileged mode, but the container still retains its default set of capabilities; it does not drop all capabilities.

483
MCQmedium

You want to ensure that the Kubernetes Dashboard is accessed only by authenticated users with specific permissions. What is the BEST approach?

A.Expose Dashboard via NodePort and rely on network firewalls
B.Create a ClusterRoleBinding granting cluster-admin to all service accounts
C.Set Dashboard to use HTTP instead of HTTPS
D.Use an ingress with authentication, and create RBAC roles for Dashboard users
AnswerD

This ensures secure access with authentication and least privilege.

Why this answer

The Kubernetes Dashboard should be secured using an Ingress controller with authentication (e.g., OIDC, basic auth, or client certificate) combined with fine-grained RBAC roles to restrict what each authenticated user can do. This ensures that only authorized users with specific permissions can access the Dashboard, following the principle of least privilege and cluster hardening best practices.

Exam trap

The trap here is that candidates often think network-level controls (NodePort + firewall) are sufficient for securing the Dashboard, but the CKS exam emphasizes that Kubernetes security requires authentication and authorization at the API level, not just network segmentation.

How to eliminate wrong answers

Option A is wrong because exposing the Dashboard via NodePort bypasses authentication and authorization, relying solely on network firewalls which do not provide user-level access control or audit logging. Option B is wrong because granting cluster-admin to all service accounts would give every service account full administrative privileges, violating the principle of least privilege and creating a massive security risk. Option C is wrong because setting the Dashboard to use HTTP instead of HTTPS exposes all traffic in plaintext, allowing man-in-the-middle attacks and credential theft, and does not address authentication or authorization.

484
MCQmedium

A Kubernetes cluster has Kyverno installed. A policy requires that all images come from a trusted registry 'trusted.example.com'. A Deployment uses the image 'nginx:latest'. When the Deployment is created, it is blocked. What Kyverno policy action is being used?

A.validate with failureAction: enforce
B.audit
C.mutate
D.generate
AnswerA

Enforce validation blocks non-compliant resources.

Why this answer

Kyverno's `validate` policy with `failureAction: enforce` is the mechanism that blocks resource creation when validation rules are violated. In this scenario, the policy checks that the image comes from `trusted.example.com`, and since `nginx:latest` does not match, the policy actively denies the Deployment, which is the behavior of `enforce` mode.

Exam trap

The trap here is that candidates confuse `audit` mode (which reports violations but allows creation) with `enforce` mode (which blocks creation), or they mistakenly think `mutate` can block resources when it only modifies them after admission.

How to eliminate wrong answers

Option B is wrong because `audit` mode only generates a policy violation report without blocking the resource; the Deployment would be created but flagged. Option C is wrong because `mutate` policies modify resources to meet policy requirements (e.g., prepending a registry prefix) rather than blocking them; they do not deny creation. Option D is wrong because `generate` policies create additional resources (e.g., NetworkPolicies) based on triggers, not block or validate existing resources.

485
MCQeasy

In a CI/CD pipeline, which step is MOST effective for detecting known vulnerabilities in a container image before deployment?

A.Run a vulnerability scan on the container image
B.Check the image size
C.Run unit tests on the application code
D.Lint the Dockerfile
AnswerA

Scanning the image for CVEs identifies known security issues.

Why this answer

Running a vulnerability scan on the container image (Option A) is the most effective step because it directly checks the image layers and installed packages against known Common Vulnerabilities and Exposures (CVEs) databases, such as the National Vulnerability Database (NVD). This identifies security flaws in base images and dependencies before deployment, which is a core requirement of supply chain security in Kubernetes.

Exam trap

The CKS exam often tests the distinction between static analysis of build files (like Dockerfile linting) and runtime or image-level security scanning, leading candidates to mistakenly choose linting as a vulnerability detection method.

How to eliminate wrong answers

Option B is wrong because checking the image size only helps with storage and performance optimization, not with detecting known vulnerabilities. Option C is wrong because unit tests validate application logic and functionality, not the security posture of the container image or its dependencies. Option D is wrong because linting the Dockerfile checks for syntax errors and best practices in the build instructions, but it does not scan the resulting image for known CVEs.

486
MCQmedium

You need to set up a ValidatingWebhookConfiguration to deny pods that run as root. The webhook server is deployed in the 'webhook' namespace with service 'webhook-svc' on port 443. Which of the following is a correct snippet for the webhook configuration?

A.clientConfig: service: name: webhook-svc namespace: webhook path: /validate port: 443
B.clientConfig: url: https://10.96.0.1:443/validate
C.clientConfig: url: https://webhook-svc.webhook.svc:443/validate
D.clientConfig: service: name: webhook-svc namespace: webhook path: /validate caBundle: <base64>
AnswerA

This correctly references the service within the cluster.

Why this answer

It properly defines a service reference with the required fields: name, namespace, and path. The port field is explicitly set to 443, matching the webhook server's listening port. In Kubernetes, when using a service reference and the webhook server's certificate is signed by the cluster's CA (which is typical for in-cluster services), the caBundle field may be omitted as the API server can use its own CA bundle to verify the connection.

Thus, the configuration in A is complete and valid for this scenario.

Exam trap

A common pitfall is assuming that a `caBundle` is always mandatory when using a `service` reference. In fact, if the webhook server's certificate is signed by the cluster's CA (as is typical for in-cluster services), the API server can use its own CA bundle, making `caBundle` optional. Another trap is using a raw IP or service DNS name in the `url` field instead of a proper `service` reference, or omitting the `port` field when using a `service` reference.

How to eliminate wrong answers

Option B is wrong because it uses a raw IP address (10.96.0.1) which is not a stable or recommended way to reference a Kubernetes service; the URL should use the service DNS name to ensure reliability and avoid hardcoding IPs that may change. Option C is wrong because the URL uses an incomplete DNS name: `webhook-svc.webhook.svc` is missing the `.cluster.local` suffix (the full DNS name is `webhook-svc.webhook.svc.cluster.local`), and the port is appended to the hostname incorrectly (should be `https://webhook-svc.webhook.svc.cluster.local:443/validate`). Option D is wrong because it omits the `port` field; while the default port is 443, the `caBundle` field is required when using a service reference to secure the connection, but the absence of `port` is not the primary issue—the real problem is that a `caBundle` is mandatory for service references to verify the webhook server's TLS certificate, and without it the configuration will fail admission checks.

487
MCQeasy

Which of the following is the correct way to drop all capabilities in a container's security context?

A.securityContext: capabilities: drop: ['ALL']
B.securityContext: capabilities: remove: ['ALL']
C.securityContext: capabilities: []
D.securityContext: capabilities: add: []
AnswerA

This drops all capabilities.

Why this answer

In Kubernetes, the `securityContext.capabilities.drop` field is used to explicitly remove Linux capabilities from a container. Setting `drop: ['ALL']` removes all capabilities, ensuring the container runs with the least privilege. This is the standard and recommended way to harden container security.

Exam trap

The CKS exam often tests the distinction between `drop` and `add` fields, and candidates may mistakenly think that setting `add: []` or an empty `capabilities` list achieves the same effect as dropping all capabilities.

How to eliminate wrong answers

Option B is wrong because `remove` is not a valid field in the Kubernetes security context; the correct field is `drop`. Option C is wrong because setting `capabilities: []` is invalid syntax—the `capabilities` field must be an object with `add` and/or `drop` arrays, not an empty list. Option D is wrong because `add: []` adds no capabilities but does not drop any existing ones, so the container retains its default capabilities, failing to drop all.

488
Multi-Selectmedium

Which TWO of the following are valid methods to verify the integrity of a container image in a Kubernetes supply chain? (Select 2)

Select 2 answers
A.Signing the image with Cosign and verifying the signature before deployment
B.Running the container in a separate namespace
C.Using a SHA256 digest instead of a tag in the image reference
D.Scanning the image for vulnerabilities using Trivy
E.Using a base image with the latest tag
AnswersA, C

Image signing ensures the image has not been tampered with and originated from a trusted source.

Why this answer

Cosign is a tool for signing container images using cryptographic keys, and verifying the signature before deployment ensures that the image has not been tampered with since it was signed. This provides integrity and authenticity in the software supply chain, as the signature can be validated against a trusted public key or a keyless identity (e.g., via Fulcio).

Exam trap

The CNCF CKS exam often tests the distinction between integrity verification (e.g., signatures, digests) and other security practices like vulnerability scanning or namespace isolation, leading candidates to mistakenly select scanning or isolation as valid integrity checks.

489
MCQeasy

Which kubectl command can be used to execute a shell inside a running container for forensic analysis?

A.kubectl delete pod <pod>
B.kubectl logs <pod>
C.kubectl describe pod <pod>
D.kubectl exec -it <pod> -- /bin/sh
AnswerD

Correct: This starts an interactive shell.

Why this answer

'kubectl exec -it <pod> -- /bin/sh' provides an interactive shell inside a running container, which is useful for forensic analysis. Option A is for deleting pods, option B is for viewing logs, option C is for describing resources, and option D is the correct exec command.

490
MCQmedium

A security engineer is configuring a Kubernetes cluster to meet CIS benchmark recommendations. The cluster uses kubeadm for bootstrapping. Which action should be taken to ensure the kube-apiserver is hardened against unauthorized access?

A.Set --insecure-port=8080 on the kube-apiserver
B.Disable the NodeRestriction admission plugin
C.Enable encryption at rest for secrets in etcd
D.Set --anonymous-auth=false on the kube-apiserver
AnswerD

Disables anonymous requests, requiring authentication for all API access.

Why this answer

Setting `--anonymous-auth=false` on the kube-apiserver disables anonymous requests, ensuring that all API requests must be authenticated. This directly addresses CIS benchmark recommendations for hardening the API server against unauthorized access by preventing unauthenticated users from reaching the API.

Exam trap

CNCF often tests the distinction between authentication hardening (anonymous-auth) and authorization or encryption controls, leading candidates to confuse enabling encryption at rest (Option C) with preventing unauthorized API access.

How to eliminate wrong answers

Option A is wrong because setting `--insecure-port=8080` enables an unencrypted, non-authenticated HTTP port, which is a severe security risk and explicitly deprecated in Kubernetes; the CIS benchmark recommends disabling the insecure port entirely. Option B is wrong because disabling the NodeRestriction admission plugin would allow compromised nodes to modify their own Node and Pod objects, reducing security; the CIS benchmark recommends enabling it to enforce node authorization. Option C is wrong because enabling encryption at rest for secrets in etcd protects data confidentiality at the storage layer but does not prevent unauthorized access to the kube-apiserver itself; it addresses a different control (data protection) rather than authentication hardening.

491
MCQhard

A cluster has a PodSecurityPolicy that requires 'RunAsAny' for the user. An administrator wants to enforce that all pods in namespace 'production' must run with a specific seccomp profile. Which approach is recommended given PSP is deprecated?

A.Enable PodSecurity admission with 'restricted' policy in enforce mode
B.Create a new PSP with seccomp profile and assign it to the namespace
C.Set seccomp profile in the kubelet configuration
D.Use a mutating admission webhook to add seccomp profile
AnswerA

Enforces seccomp as part of the restricted policy.

Why this answer

PodSecurity admission (the replacement for PSP) allows enforcing a 'restricted' policy that mandates a seccomp profile (e.g., RuntimeDefault) at the namespace level. This directly meets the requirement without relying on deprecated PSPs, and the 'enforce' mode ensures pods violating the policy are rejected.

Exam trap

CNCF often tests the deprecation of PSP and the shift to PodSecurity admission; the trap here is that candidates may still choose a PSP-based option (B) or overcomplicate with webhooks (D), missing the built-in, recommended replacement.

How to eliminate wrong answers

Option B is wrong because PSP is deprecated and will be removed in Kubernetes 1.25+, so creating a new PSP is not a recommended long-term solution; also, PSPs are cluster-scoped and cannot be directly assigned to a namespace without additional RBAC. Option C is wrong because kubelet configuration sets a default seccomp profile for all pods on the node, not per-namespace enforcement, and it cannot selectively target the 'production' namespace. Option D is wrong because while a mutating admission webhook could add the seccomp profile, it is more complex and less standard than using the built-in PodSecurity admission controller, which is the recommended approach per Kubernetes documentation.

492
Multi-Selecthard

Which THREE of the following are valid methods to secure etcd?

Select 3 answers
A.Use HTTP instead of HTTPS to reduce overhead
B.Encrypt secrets at rest using EncryptionConfiguration
C.Enable RBAC authorization on etcd
D.Open etcd port 2379 to all network interfaces
E.Enable TLS client certificates for authentication
AnswersB, C, E

This encrypts data stored in etcd.

Why this answer

Kubernetes supports encrypting secrets at rest in etcd via an EncryptionConfiguration object. This configuration specifies which resources (e.g., secrets) should be encrypted and which encryption provider (e.g., AES-CBC, secretbox) to use, ensuring that data stored on disk is protected against unauthorized access to the etcd data directory.

Exam trap

The trap here is that candidates may think HTTP reduces overhead and is acceptable for internal cluster traffic, but the CKS exam strictly requires TLS encryption for all etcd communication, and exposing ports to all interfaces is a clear security violation.

493
MCQhard

An administrator wants to ensure that containers in a pod cannot run with any Linux capabilities except the minimal required for the container runtime. The pod is subject to the 'restricted' Pod Security Standard. Which capability configuration should be set in the pod's security context?

A.capabilities: drop: ["ALL"]
B.capabilities: drop: ["NET_RAW", "CHOWN"]
C.capabilities: add: ["NET_BIND_SERVICE"]
D.capabilities: add: ["ALL"]
AnswerA

Under the restricted profile, you must drop all capabilities. Adding capabilities is not allowed.

Why this answer

The 'restricted' Pod Security Standard (PSS) requires that all Linux capabilities be dropped except those essential for the container runtime (e.g., CAP_NET_BIND_SERVICE is allowed by default in some runtimes, but the standard explicitly mandates dropping all capabilities). Option A correctly uses `drop: ["ALL"]` to remove every capability, ensuring the container runs with the minimal set required by the runtime, which aligns with the PSS 'restricted' profile. This approach enforces the principle of least privilege by preventing the container from gaining any unnecessary kernel privileges.

Exam trap

CNCF often tests the misconception that dropping only specific dangerous capabilities (like `NET_RAW` and `CHOWN`) is sufficient for the 'restricted' PSS, when in fact the standard requires dropping all capabilities to achieve the minimal privilege level.

How to eliminate wrong answers

Option B is wrong because dropping only `NET_RAW` and `CHOWN` does not satisfy the 'restricted' PSS requirement to drop all capabilities; it leaves other potentially dangerous capabilities (e.g., `SYS_ADMIN`, `NET_ADMIN`) intact, violating the standard. Option C is wrong because adding `NET_BIND_SERVICE` is unnecessary and contradicts the 'restricted' PSS, which expects no capabilities to be added; the runtime already provides minimal capabilities, and explicit adds can introduce privileges beyond the allowed set. Option D is wrong because adding `ALL` capabilities grants every Linux capability to the container, which directly violates the 'restricted' PSS and defeats the purpose of capability dropping, creating a severe security risk.

494
Multi-Selecthard

Which THREE of the following are valid ways to manage secrets in a Kubernetes environment? (Select THREE)

Select 3 answers
A.Use an external secret manager like HashiCorp Vault and inject secrets via sidecar or CSI driver.
B.Store secrets in environment variables directly in the Deployment YAML.
C.Use Kubernetes Secret objects mounted as volumes in pods.
D.Encrypt Secret objects at rest using EncryptionConfiguration.
E.Store secrets in ConfigMaps and reference them in pods.
AnswersA, C, D

External secret managers provide secure storage and dynamic secrets.

Why this answer

External secret managers like HashiCorp Vault can inject secrets into pods via a sidecar container (e.g., Vault Agent) or a CSI driver (e.g., Secrets Store CSI Driver). This approach avoids storing raw secrets in the cluster, reduces the attack surface, and enables dynamic secret rotation without pod restarts.

Exam trap

A common misconception is that Kubernetes Secrets are inherently secure because they are base64-encoded, but the trap is that base64 is not encryption, and Secrets are stored in plaintext in etcd unless explicitly encrypted with EncryptionConfiguration.

495
MCQmedium

An administrator runs 'kubectl get clusterrolebindings' and notices a ClusterRoleBinding named 'admin-binding' that binds the 'cluster-admin' ClusterRole to a service account in the 'default' namespace. What security concern does this raise?

A.The service account can now perform any action across all namespaces, which violates least-privilege.
B.The service account can only access resources in the 'default' namespace.
C.No concern; service accounts are allowed to have cluster-admin.
D.The ClusterRoleBinding should be replaced with a RoleBinding.
AnswerA

cluster-admin grants full cluster-level permissions, which is excessive for most service accounts.

Why this answer

A ClusterRoleBinding grants cluster-wide permissions, and the 'cluster-admin' ClusterRole provides superuser access to perform any action on any resource across all namespaces. Binding this to a service account violates the principle of least privilege because the service account gains unrestricted access to the entire cluster, including sensitive system resources, rather than being limited to only the permissions necessary for its function.

Exam trap

The trap here is that candidates may think a service account bound to a ClusterRole is limited to its namespace, or that 'cluster-admin' is acceptable for any service account, when the CKS exam specifically tests the principle of least privilege and the distinction between RoleBindings (namespace-scoped) and ClusterRoleBindings (cluster-scoped).

How to eliminate wrong answers

Option B is wrong because a ClusterRoleBinding applies cluster-wide, not just to the 'default' namespace; the service account can access resources in all namespaces. Option C is wrong because while service accounts can be bound to cluster-admin, doing so without justification is a significant security concern that violates least-privilege and should be avoided unless absolutely necessary. Option D is wrong because replacing the ClusterRoleBinding with a RoleBinding would limit the binding to a single namespace, but the core issue is the excessive privilege of the 'cluster-admin' ClusterRole, not the binding type; a RoleBinding with 'cluster-admin' is not possible (RoleBindings can only reference ClusterRoles for resources in the same namespace, but 'cluster-admin' still grants cluster-wide scope via a RoleBinding).

496
Matchingmedium

Match each Kubernetes network security concept to its definition.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

Outbound network traffic from a pod to external endpoints

Inbound network traffic to a pod from external sources

Specification of how groups of pods are allowed to communicate

Container Network Interface plugin that implements networking for pods

Infrastructure layer for handling service-to-service communication, often with mTLS

Why these pairings

Correct matches: NetworkPolicy defines ingress/egress rules; Calico network policy extends with advanced features; Ingress rule controls inbound traffic; Egress rule controls outbound traffic; Default deny blocks all unless allowed. Common confusions include swapping ingress and egress definitions and mistaking non-native policies as native.

497
Multi-Selectmedium

Which TWO of the following are valid methods to apply a custom seccomp profile to a pod in Kubernetes?

Select 2 answers
A.Setting the annotation 'seccomp.security.alpha.kubernetes.io/pod' on the pod
B.Using 'securityContext.seccompProfile.type: RuntimeDefault' with 'localhostProfile' set
C.Configuring the kubelet with --seccomp-default-profile flag
D.Using 'securityContext.seccompProfile.type: Localhost' with 'localhostProfile' set
E.Adding a seccomp profile to the container image and referencing it in the pod spec
AnswersA, D

This is a valid (though deprecated) method.

Why this answer

The annotation 'seccomp.security.alpha.kubernetes.io/pod' was the original method to apply a seccomp profile to a pod in Kubernetes versions prior to 1.19. This annotation is still valid in older clusters or when using the alpha API, and it directly specifies the seccomp profile path or type for the pod.

Exam trap

CNCF often tests the distinction between the deprecated annotation method and the current 'securityContext.seccompProfile' field, and the trap here is that candidates may think 'localhostProfile' can be combined with 'RuntimeDefault' or that profiles can be embedded in container images, which is incorrect.

498
Multi-Selectmedium

Which TWO of the following are best practices for minimizing microservice vulnerabilities in a Kubernetes cluster?

Select 2 answers
A.Enable mutual TLS (mTLS) for service-to-service communication using a service mesh.
B.Run containers as root to avoid permission issues.
C.Allow all egress traffic from pods to simplify network management.
D.Set resource limits (CPU/memory) on containers to prevent resource exhaustion attacks.
E.Use hostNetwork: true for pods to improve network performance.
AnswersA, D

mTLS provides encryption and mutual authentication, reducing vulnerability to eavesdropping and impersonation.

Why this answer

Mutual TLS (mTLS) encrypts and authenticates all service-to-service traffic within the cluster, preventing eavesdropping, man-in-the-middle attacks, and unauthorized access. A service mesh like Istio or Linkerd transparently enforces mTLS without requiring application code changes, ensuring that only verified services can communicate. This directly minimizes the attack surface for microservice vulnerabilities by enforcing zero-trust network principles.

Exam trap

CNCF often tests the misconception that 'simplifying network management' (e.g., allowing all egress traffic) is a security best practice, when in fact it removes critical network segmentation controls required for microservice isolation.

499
Multi-Selecteasy

Which TWO crictl commands can be used to inspect a running container?

Select 2 answers
A.crictl logs <container-id>
B.crictl run <image>
C.crictl create <pod-config>
D.crictl stats <container-id>
E.crictl exec <container-id> <command>
AnswersA, E

Shows container logs.

Why this answer

crictl logs shows logs, crictl exec runs a command in the container.

500
Multi-Selectmedium

Which TWO of the following are best practices for securing secrets in Kubernetes?

Select 2 answers
A.Storing secrets as environment variables
B.Using the default secret type (Opaque) for all secrets
C.Enabling encryption at rest for secrets
D.Limiting the number of secrets in the cluster
E.Using an external secrets management system like HashiCorp Vault
AnswersC, E

Encryption at rest protects secrets if etcd is compromised.

Why this answer

Kubernetes stores secrets in etcd by default without encryption. Enabling encryption at rest (via the EncryptionConfiguration resource with a provider like AES-CBC or KMS) ensures that secret data is encrypted before being written to etcd, protecting it from unauthorized access to the underlying storage. This is a fundamental security control required for compliance and defense-in-depth.

Exam trap

The CKS exam often tests the misconception that storing secrets as environment variables is acceptable because it is 'convenient' or 'standard practice,' but the CKS exam strictly penalizes this as insecure due to exposure in process listings and logs.

501
MCQmedium

Which of the following is NOT a recommended method to reduce the attack surface on Kubernetes nodes?

A.Using read-only root filesystems
B.Running containers as non-root
C.Running containers with privileged: true
D.Disabling unnecessary system services on nodes
AnswerC

Privileged containers have elevated capabilities, increasing attack surface.

Why this answer

Setting `privileged: true` in a container's security context grants it elevated capabilities equivalent to running as root on the host, including access to all kernel namespaces and devices. This directly increases the attack surface by allowing the container to perform host-level operations, such as loading kernel modules or modifying network settings, which violates the principle of least privilege. The CKS exam emphasizes that privileged containers should be avoided unless absolutely necessary, and they are never a recommended method for reducing the attack surface.

Exam trap

The trap here is that candidates may confuse 'privileged containers' with 'containers running as root' and incorrectly think that running as non-root is the only requirement, when in fact privileged mode grants far more dangerous host-level access regardless of the user ID.

How to eliminate wrong answers

Option A is wrong because using read-only root filesystems prevents containers from writing to their own filesystem, which limits the impact of a compromise by making it harder for an attacker to persist or modify binaries. Option B is wrong because running containers as non-root (e.g., with `runAsUser: 1000`) reduces the risk of privilege escalation by ensuring the container process does not have root UID 0 inside the container, which is a fundamental security best practice. Option D is wrong because disabling unnecessary system services on nodes (e.g., stopping unused daemons like `cups` or `rpcbind`) reduces the number of potential entry points for an attacker, directly shrinking the node's attack surface.

502
Multi-Selecteasy

You are auditing a cluster for runtime security best practices. Which TWO of the following actions are recommended to improve container runtime security?

Select 2 answers
A.Deploy Falco to monitor system calls and detect anomalous behavior.
B.Disable the container runtime's security engine to reduce overhead.
C.Run containers in privileged mode for better performance.
D.Enable seccomp profiles to restrict available system calls.
E.Set AppArmor to unconfined for all pods to avoid profile conflicts.
AnswersA, D

Falco is a standard runtime security tool.

Why this answer

Falco is a CNCF-graduated runtime security tool that uses eBPF or kernel modules to monitor system calls in real time, detecting anomalous behavior such as unexpected process execution or file writes. Deploying Falco is a recommended best practice for runtime security because it provides deep visibility into container activity without requiring application changes, and it can trigger alerts or actions based on customizable rules.

Exam trap

CNCF often tests the misconception that disabling security features (like seccomp or AppArmor) improves performance without understanding the severe security trade-offs, or that privileged mode is an acceptable performance tuning technique.

503
Multi-Selectmedium

Which TWO resources can be used to implement RBAC in Kubernetes?

Select 2 answers
A.ClusterRole
B.NetworkPolicy
C.PodSecurityPolicy
D.ServiceAccount
E.Role
AnswersA, E

ClusterRole defines cluster-scoped permissions or can be used in namespaces.

Why this answer

A is correct because ClusterRole is a Kubernetes RBAC resource that defines a set of permissions (rules) that are not namespaced, allowing cluster-wide access. RBAC in Kubernetes uses Role and ClusterRole objects to specify allowed verbs (e.g., get, list, create) on resources (e.g., pods, secrets), and they are bound to subjects via RoleBinding or ClusterRoleBinding.

Exam trap

CNCF often tests the distinction between RBAC authorization resources (Role/ClusterRole) and other Kubernetes objects that deal with security but serve different purposes, such as NetworkPolicy (network segmentation) or PodSecurityPolicy (pod security constraints), leading candidates to confuse authorization with other security controls.

504
MCQhard

Refer to the exhibit. A cluster has the ClusterImagePolicy shown. A developer creates a pod with an image from registry.example.com/myapp:v1, which was built and signed by a GitHub Actions workflow that is NOT defined in the policy (different workflow). Which behavior will occur when the pod is created?

A.The pod is admitted because keyless signing does not enforce identity matching.
B.The pod is admitted because the policy only applies to images with a tag 'v*'.
C.The pod is admitted because the image is from the allowed registry.
D.The pod is denied because the image's signer identity does not match the policy.
AnswerD

The identity check fails, so cosigned denies the admission.

Why this answer

The ClusterImagePolicy enforces that images must be signed by a specific identity (the GitHub Actions workflow defined in the policy). The image from registry.example.com/myapp:v1 was signed by a different workflow, so the signer identity does not match the policy's required identity. Sigstore keyless signing verifies the OIDC identity embedded in the signature, and if the identity does not match the policy's `issuer` and `subject` patterns, the admission controller denies the pod.

Exam trap

CNCF often tests the misconception that keyless signing only verifies the signature's cryptographic validity, not the identity of the signer, but in reality the policy enforces identity matching via OIDC claims.

How to eliminate wrong answers

Option A is wrong because keyless signing does enforce identity matching via OIDC tokens; the policy specifies allowed identities, and mismatches cause denial. Option B is wrong because the policy uses a regex `v*` which matches any tag starting with 'v', and 'v1' matches that pattern, so the policy applies. Option C is wrong because the policy restricts based on signer identity, not just registry; the image is from an allowed registry but the signer identity does not match, so admission is denied.

505
Drag & Dropmedium

Arrange the steps to enable and configure audit logging in Kubernetes.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4

Why this order

Audit logging requires a policy file, mounting it, adding flags, restarting, and verifying logs.

506
MCQmedium

A cluster has PodSecurity admission enabled. A developer creates a pod with the following security context: 'securityContext: { capabilities: { drop: ["ALL"], add: ["NET_ADMIN"] } }'. The namespace is labeled 'pod-security.kubernetes.io/enforce: baseline'. Will the pod be allowed?

A.No, because baseline requires dropping ALL first
B.Yes, because the pod drops all capabilities before adding specific ones
C.No, because dropping ALL capabilities is not allowed by baseline
D.Yes, because the baseline policy allows adding NET_ADMIN
AnswerD

Baseline allows NET_ADMIN to be added.

Why this answer

The Pod Security Standards (PSS) baseline policy explicitly allows adding the NET_ADMIN capability. The baseline policy restricts certain capabilities but does not prohibit adding NET_ADMIN; it only restricts capabilities that could lead to host-level privilege escalation. Dropping ALL capabilities first and then adding NET_ADMIN is a valid pattern that satisfies the baseline policy's requirements.

Exam trap

The trap here is that candidates assume 'baseline' is more restrictive than it actually is, or they confuse the 'restricted' policy's capability restrictions with the 'baseline' policy, leading them to incorrectly think NET_ADMIN is forbidden.

How to eliminate wrong answers

Option A is wrong because baseline does not require dropping ALL capabilities first; it only restricts a specific set of capabilities (e.g., CAP_SYS_ADMIN, CAP_NET_RAW) but allows others like NET_ADMIN. Option B is wrong because while the pod does drop ALL and then add NET_ADMIN, the reason it is allowed is not simply because of that order but because NET_ADMIN is permitted by baseline. Option C is wrong because dropping ALL capabilities is not prohibited by baseline; in fact, dropping ALL is a common security hardening practice and is allowed.

507
Multi-Selectmedium

Which TWO of the following are recommended practices for etcd security?

Select 2 answers
A.Use anonymous authentication for etcd
B.Disable TLS for performance
C.Restrict etcd access to only the API server and kubelets using firewall rules
D.Expose etcd on a public IP for monitoring
E.Enable TLS client certificate authentication
AnswersC, E

Network restrictions limit which hosts can connect to etcd.

Why this answer

Etcd stores sensitive cluster data (secrets, config maps, state). Restricting network access to only the API server and kubelets via firewall rules (e.g., iptables or cloud security groups) minimizes the attack surface and prevents unauthorized nodes or external actors from reaching the etcd data store. This aligns with the principle of least privilege for control plane components.

Exam trap

CNCF often tests the misconception that disabling TLS or exposing etcd is acceptable for monitoring or performance, when in reality etcd must always be isolated and encrypted to protect the cluster's root of trust.

508
MCQmedium

During a CI/CD pipeline, you run 'trivy image myapp:latest' and get a high number of vulnerabilities. What is the BEST action to reduce the vulnerability count?

A.Increase CPU and memory limits for the container
B.Switch to a distroless base image
C.Sign the image with Cosign
D.Remove all environment variables from the Dockerfile
AnswerB

Distroless images have fewer components, reducing the attack surface and vulnerability count.

Why this answer

Distroless base images contain only the essential runtime dependencies (e.g., glibc, libssl) and exclude package managers, shells, and other utilities that are common sources of CVEs. By switching to a distroless image, you drastically reduce the attack surface and the number of packages that Trivy scans, directly lowering the vulnerability count without changing application code.

Exam trap

CKS often tests the misconception that operational changes (like resource limits or environment variable removal) can fix supply chain vulnerabilities, when the correct answer always involves reducing the software footprint or patching dependencies at the image build level.

How to eliminate wrong answers

Option A is wrong because increasing CPU and memory limits does not affect the software packages or libraries present in the container image; resource limits only control runtime behavior, not the vulnerability surface. Option C is wrong because signing an image with Cosign provides integrity and provenance verification but does not remove or patch any vulnerabilities within the image. Option D is wrong because removing environment variables from the Dockerfile reduces the risk of secret leakage but has no impact on the vulnerability count reported by Trivy, which scans filesystem packages and libraries.

509
MCQeasy

Which kubectl command is used to check the AppArmor status on a Kubernetes node?

A.kubectl describe node <node> | grep AppArmor
B.kubectl get apparmor
C.kubectl node-shell <node> -- aa-status
D.kubectl exec <pod> -- aa-status
AnswerC

Using 'kubectl node-shell' (or similar) to run 'aa-status' on the node is correct.

Why this answer

`kubectl node-shell` provides a shell into the node's filesystem, allowing you to run `aa-status` directly on the node to check the AppArmor status. This is the standard method to verify AppArmor profiles and their enforcement state on a Kubernetes node, as AppArmor operates at the host kernel level and is not managed via the Kubernetes API.

Exam trap

The trap here is that candidates assume AppArmor status can be checked via standard Kubernetes API commands like `kubectl describe node` or `kubectl get`, when in reality it requires direct node-level access because AppArmor is a host-level security mechanism not abstracted by the Kubernetes API.

How to eliminate wrong answers

Option A is wrong because `kubectl describe node <node> | grep AppArmor` only shows the AppArmor annotations on the node object (like whether a pod requests a profile), not the actual AppArmor status or loaded profiles on the node. Option B is wrong because `kubectl get apparmor` is not a valid kubectl command; AppArmor is not a Kubernetes resource and cannot be queried via the API. Option D is wrong because `kubectl exec <pod> -- aa-status` runs the command inside a container, which typically lacks the necessary privileges and access to the host's AppArmor subsystem; `aa-status` must be executed on the node itself.

510
MCQhard

An administrator wants to enable Kubernetes audit logging with the following requirements: log all requests at the Metadata level, but log all responses at the Request level. Which audit policy configuration achieves this?

A.Set default level to Metadata and use a dynamic level based on request size
B.Use the --audit-log-maxbackup flag to adjust levels
C.Set default level to Metadata and use a rule with level: Request for specific resources
D.Use separate rules with 'stages: ["RequestReceived"]' level Metadata, and 'stages: ["ResponseComplete"]' level Request
AnswerD

Correct: stages allow different levels per request vs response.

Why this answer

Audit policies allow setting different levels for different stages. To meet the requirement of logging requests at Metadata level and responses at Request level, you need separate rules for each stage. Option D does this by using two rules: one with stages: ['RequestReceived'] and level: Metadata, and another with stages: ['ResponseComplete'] and level: Request.

This ensures that request events are logged at Metadata level and response events at Request level.

511
Multi-Selecthard

Which THREE of the following are valid audit stages in Kubernetes audit logging? (Select THREE.)

Select 3 answers
A.ResponseStarted
B.RequestReceived
C.ResponseBuffered
D.RequestProcessing
E.ResponseComplete
AnswersA, B, E

Correct. Occurs when response headers are sent.

Why this answer

Audit stages are: RequestReceived, ResponseStarted, ResponseComplete, Panic. 'RequestProcessing' and 'ResponseBuffered' are not valid stages.

512
Multi-Selectmedium

Which TWO of the following are recommended CIS Kubernetes Benchmark controls for securing the kube-apiserver?

Select 2 answers
A.Enable insecure port 8080
B.Disable anonymous authentication
C.Set --authorization-mode to AlwaysAllow
D.Enable audit logging
E.Disable TLS
AnswersB, D

Correct. CIS recommends --anonymous-auth=false.

Why this answer

The CIS Kubernetes Benchmark recommends disabling anonymous authentication to ensure that all requests to the kube-apiserver are authenticated. This prevents unauthenticated users from accessing the API server, which is a critical security control. Option D is correct because enabling audit logging is a recommended control to record all API requests, providing an audit trail for security monitoring and incident response.

Exam trap

CNCF often tests the misconception that disabling anonymous authentication is optional or that audit logging is only for compliance, but both are mandatory for a hardened control plane per the CIS Benchmark.

513
MCQhard

You want to detect any attempt to run a shell inside a container that is not running as root. Which Falco condition would you use?

A.evt.type=execve and proc.name in (bash, sh) and container.id != host and user.name != root
B.evt.type=execve and proc.aname in (bash, sh) and container.id != host and user.name != root
C.evt.type=execve and proc.name in (bash, sh) and container.id != host
D.evt.type=execve and proc.name in (bash, sh) and container.id != host and user.name = root
AnswerA

Correctly detects shell execution by non-root users in containers.

Why this answer

Ly checks for execve of bash or sh within a container (container.id != host) and ensures the user is not root (user.name != root), which matches the requirement to detect shell execution by non-root users. Option B uses proc.aname (parent process name) instead of proc.name, making it incorrect. Option C omits the user check, so it would flag even root-run shells.

Option D checks for user.name = root, which is the opposite of the requirement.

514
MCQeasy

Which kubectl flag disables anonymous authentication on the API server?

A.--anonymous-enabled=false
B.--no-anonymous
C.--anonymous-auth=false
D.--disable-anonymous
AnswerC

Correct flag to disable anonymous authentication.

Why this answer

The kube-apiserver uses the `--anonymous-auth` flag to control whether anonymous requests are allowed. Setting `--anonymous-auth=false` disables anonymous authentication, meaning the API server will reject requests that do not present valid credentials. This is a critical hardening step to ensure only authenticated users can access the cluster.

Exam trap

The trap here is that candidates may confuse the `--anonymous-auth` flag with other authentication-related flags or invent plausible-sounding flag names like `--disable-anonymous`, while the actual flag uses the `--<setting>-auth` naming convention with a boolean value.

How to eliminate wrong answers

Option A is wrong because `--anonymous-enabled=false` is not a valid kube-apiserver flag; the correct flag is `--anonymous-auth`. Option B is wrong because `--no-anonymous` is not a recognized flag; the kube-apiserver uses boolean flags like `--anonymous-auth` rather than negated prefixes. Option D is wrong because `--disable-anonymous` is not a valid flag; the API server uses `--anonymous-auth` with a boolean value to control anonymous access.

515
Matchingmedium

Match each Kubernetes security tool or feature to its purpose.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

Checks whether Kubernetes is deployed securely according to CIS benchmarks

Penetration testing tool for Kubernetes clusters

Policy engine for enforcing custom policies on Kubernetes resources

Runtime security monitoring tool that detects abnormal behavior

Vulnerability scanner for container images, filesystems, and Git repos

Why these pairings

Correct matches: Pod Security Admission enforces pod security standards; Network Policies control traffic; RBAC governs API access; kube-bench performs CIS checks. Common confusion arises from swapping definitions between PSA and Network Policies.

516
MCQmedium

You need to configure Kubernetes audit logging to log all requests to the 'secrets' resource at the RequestResponse level. Which audit policy rule would achieve this?

A.- level: Metadata resources: - group: "" resources: ["secrets"]
B.- level: RequestResponse resources: - group: "" resources: ["secrets"]
C.- level: RequestResponse resources: - group: "" resources: ["pods"]
D.- level: Request resources: - group: "" resources: ["secrets"]
AnswerB

Correct. This rule matches all API groups (empty string) and the secrets resource, logging at RequestResponse level.

Why this answer

An audit policy rule with resources: groups: [""]; resources: ["secrets"]; level: RequestResponse will log all requests to secrets at the RequestResponse level (metadata + request + response).

517
MCQhard

You deploy the Kubernetes Dashboard using the official YAML manifests. Which of the following is the MOST secure approach to expose the Dashboard?

A.Use 'kubectl proxy' to access it locally
B.Create a NodePort Service to expose it on a port
C.Expose it with a LoadBalancer Service
D.Use an Ingress with a public DNS
AnswerA

This method uses your existing kubectl authentication and does not expose the Dashboard to the network.

Why this answer

The most secure approach is to use 'kubectl proxy' because it creates a local HTTP proxy between your workstation and the Kubernetes API server, authenticating your requests using your kubeconfig credentials. This ensures the Dashboard is never exposed to the network, eliminating any attack surface from external or internal cluster access. All traffic is tunneled through the API server, which enforces RBAC and audit logging.

Exam trap

CNCF often tests the misconception that exposing the Dashboard via a Service (NodePort, LoadBalancer, or Ingress) is acceptable if TLS is enabled, but the trap is that any network exposure increases the attack surface and violates the principle of least privilege, whereas 'kubectl proxy' provides no network exposure at all.

How to eliminate wrong answers

Option B is wrong because a NodePort Service exposes the Dashboard on a static port on every node's IP address, making it accessible from within the cluster network and potentially from outside if network policies are misconfigured, violating the principle of least exposure. Option C is wrong because a LoadBalancer Service provisions a public-facing cloud load balancer, directly exposing the Dashboard to the internet or broader network, which is unnecessary and increases the attack surface significantly. Option D is wrong because using an Ingress with a public DNS exposes the Dashboard via a hostname, often terminating TLS at the ingress controller, but still making the service reachable from outside the cluster and requiring additional security controls like authentication and network policies that are easy to misconfigure.

518
MCQmedium

A security engineer runs 'kubesec scan deployment.yaml' and receives a score of -1. What does this score indicate?

A.The deployment passed all security checks
B.The deployment is not secure and needs immediate attention
C.The scan failed due to an error or invalid YAML
D.The deployment has critical vulnerabilities
AnswerC

Kubesec returns -1 when the file cannot be parsed or scanned correctly.

Why this answer

In kubesec, a score of -1 indicates that the scan could not complete successfully, typically due to an error in the YAML file (e.g., invalid syntax, malformed structure) or a failure in the scanning process itself. Kubesec returns scores from 0 to 10 for valid deployments, where higher scores indicate better security; -1 is a special sentinel value reserved for scan failures, not a security assessment.

Exam trap

The CKS exam often tests the distinction between error codes and security scores; the trap here is that candidates assume -1 means 'worst security' (like a negative vulnerability score) rather than recognizing it as a sentinel value for scan failure.

How to eliminate wrong answers

Option A is wrong because a score of -1 is not a valid security score; kubesec returns positive scores (0-10) for successful scans, and a passed scan would yield a score of at least 0, not -1. Option B is wrong because -1 does not indicate a security posture; it signals a scan failure, and a deployment needing immediate attention would receive a low positive score (e.g., 0 or 1) with specific vulnerability details. Option D is wrong because critical vulnerabilities are reported with a low positive score (e.g., 0-2) and detailed findings, not a -1 error code.

519
MCQhard

You are writing a Falco rule to detect privilege escalation via setuid binaries. Which syscall should the rule monitor?

A.open
B.execve
C.connect
D.setuid
AnswerD

Correct. The setuid syscall is used to set the user ID of the current process, which can escalate privileges.

Why this answer

setuid and setgid syscalls are used to change user/group identity, which can be used for privilege escalation. Falco can monitor these syscalls to detect unauthorized attempts.

520
Drag & Dropmedium

Order the steps to perform a Kubernetes cluster upgrade from version 1.24 to 1.25.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4

Why this order

Upgrade involves upgrading kubeadm, draining, applying upgrade, upgrading worker nodes, and verifying.

521
MCQmedium

You are configuring etcd encryption at rest. After placing the EncryptionConfiguration YAML file, you must modify which file to point the API server to it?

A./etc/kubernetes/manifests/kube-apiserver.yaml
B./etc/kubernetes/admin.conf
C./etc/kubernetes/pki/etcd/ca.crt
D./etc/kubernetes/kubelet.conf
AnswerA

Correct file to modify for API server flags.

Why this answer

The API server is deployed as a static pod in a typical Kubernetes cluster, with its manifest located at /etc/kubernetes/manifests/kube-apiserver.yaml. To enable encryption at rest, you must add the `--encryption-provider-config` flag to this manifest, pointing to the EncryptionConfiguration YAML file. The kubelet automatically detects the change and restarts the API server pod to apply the new encryption configuration.

Exam trap

CNCF often tests the distinction between static pod manifests and kubeconfig files; the trap here is that candidates may confuse /etc/kubernetes/admin.conf or /etc/kubernetes/kubelet.conf with the API server's configuration, thinking they need to modify a kubeconfig file instead of the static pod manifest.

How to eliminate wrong answers

Option B is wrong because /etc/kubernetes/admin.conf is the kubeconfig file used by kubectl and administrators for cluster authentication and authorization, not a configuration file for the API server itself. Option C is wrong because /etc/kubernetes/pki/etcd/ca.crt is the CA certificate for etcd, used for TLS communication between etcd members and clients; it has no role in configuring API server encryption at rest. Option D is wrong because /etc/kubernetes/kubelet.conf is the kubeconfig file for the kubelet to authenticate to the API server, not a file that controls API server encryption settings.

522
MCQmedium

A container has been compromised. You need to isolate it by denying all network traffic. Which NetworkPolicy manifest achieves this?

A.apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: isolate spec: podSelector: matchLabels: app: compromised ingress: []
B.apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: isolate spec: podSelector: matchLabels: app: compromised policyTypes: - Ingress ingress: - from: - podSelector: {}
C.apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: isolate spec: podSelector: matchLabels: app: compromised policyTypes: - Egress egress: - to: - podSelector: {}
D.apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: isolate spec: podSelector: matchLabels: app: compromised policyTypes: - Ingress - Egress
AnswerD

Correctly blocks all ingress and egress.

Why this answer

Option A creates a NetworkPolicy with only an empty ingress rule and no explicit policyTypes. Because no policyTypes are specified, the default policyTypes become ["Ingress"]. This blocks all incoming traffic but allows all outgoing traffic, failing to isolate the pod.

Option B allows all ingress from any pod, which does not isolate. Option C allows all egress to any pod, which does not isolate. Option D explicitly sets policyTypes to both Ingress and Egress without any rules, effectively denying all traffic in both directions, achieving the required isolation.

Exam trap

Candidates often overlook that omitting policyTypes while specifying only some rules (e.g., only ingress) results in partial isolation, leaving egress traffic open. Isolation requires blocking both directions.

523
Multi-Selectmedium

Which TWO of the following are valid audit stages in Kubernetes audit logging?

Select 2 answers
A.ResponseStarted
B.ResponseDelay
C.ResponseComplete
D.RequestProcessing
E.RequestReceived
AnswersA, E

Correct: This is a valid stage.

Why this answer

The Kubernetes audit stages include RequestReceived, ResponseStarted, ResponseComplete, and Panic. In the given options, ResponseStarted (A) and RequestReceived (E) are valid stages and are the two correct answers according to the question. Option C (ResponseComplete) is also a valid stage, but since the question explicitly asks for two, it is not selected as a correct answer here.

Options B (ResponseDelay) and D (RequestProcessing) are not valid audit stages.

524
MCQmedium

You are using `crictl` to debug a container that is not responding. Which command should you use to get the list of running containers?

A.crictl pods
B.crictl ps
C.crictl images
D.crictl stats
AnswerB

crictl ps lists containers (including running, paused, exited).

Why this answer

`crictl ps` is the correct command because it lists running containers managed by the CRI-compatible runtime (e.g., containerd, CRI-O). This is analogous to `docker ps` but for the Kubernetes container runtime interface, allowing you to see container IDs, names, and statuses for debugging.

Exam trap

The trap here is that candidates familiar with Docker may confuse `crictl ps` with `docker ps` but forget that `crictl pods` exists for pod-level operations, leading them to incorrectly choose `crictl pods` when the question asks for running containers.

How to eliminate wrong answers

Option A is wrong because `crictl pods` lists pods (groups of containers), not individual containers, and is used for pod-level debugging. Option C is wrong because `crictl images` lists container images stored locally, not running containers. Option D is wrong because `crictl stats` shows resource usage statistics (CPU, memory) for running containers, not a list of them.

525
MCQeasy

Which flag on the kubelet helps ensure it runs securely by enforcing kernel defaults?

A.--read-only-port=0
B.--security-context
C.--protect-kernel-defaults
D.--kernel-security
AnswerC

The --protect-kernel-defaults flag ensures the kubelet enforces kernel security settings.

Why this answer

The `--protect-kernel-defaults` flag on the kubelet ensures that the node's kernel parameters are set to secure defaults, preventing container escapes or privilege escalations that could exploit weak kernel settings. This flag enforces the kubelet's built-in kernel validator, which checks that critical sysctls (e.g., `net.ipv4.ip_forward`, `kernel.panic`) are set to safe values, and fails to start if they are not. It is a key hardening measure for cluster nodes, directly addressing kernel-level security.

Exam trap

CNCF often tests the distinction between kubelet flags that control network ports (like `--read-only-port`) and those that enforce kernel-level security, leading candidates to confuse `--protect-kernel-defaults` with non-existent or unrelated flags such as `--kernel-security` or `--security-context`.

How to eliminate wrong answers

Option A is wrong because `--read-only-port=0` disables the read-only port (10255) on the kubelet, which prevents unauthenticated access to node metrics, but it does not enforce kernel defaults. Option B is wrong because `--security-context` is not a valid kubelet flag; security contexts are configured at the Pod or container level via the Kubernetes API, not on the kubelet itself. Option D is wrong because `--kernel-security` is not a recognized kubelet flag; the correct flag for enforcing kernel defaults is `--protect-kernel-defaults`.

Page 6

Page 7 of 10

Page 8

All pages