Courseiva

CCNA Cks Monitoring Runtime Questions

75 of 133 questions · Page 1/2 · Cks Monitoring Runtime topic · Answers revealed

1
MCQhard

In a Falco rule, you have the condition: 'evt.type=execve and proc.name=bash and container.id!=host'. What does this rule detect?

A.A non-root bash process on the host
B.A bash shell being spawned inside a container
C.An interactive shell session inside a container
D.A bash process reading /etc/shadow
AnswerB

The condition matches execve system calls where the executed process is bash and the container ID is not the host, so it fires on shells spawned inside containers. This detects interactive or scripted bash execution within containerised workloads, not host-level bash.

Why this answer

The rule triggers when a bash shell is executed (execve) inside any container (container.id != host). It does not check for interactive use; it simply detects bash execution.

2
MCQeasy

To ensure a container's filesystem is read-only, which field should be set to 'true' in the container spec?

A.securityContext.readOnlyRootFilesystem
B.securityContext.runAsNonRoot
C.container.fsGroup
D.podSpec.containers.readonly
AnswerA

securityContext.readOnlyRootFilesystem is a boolean field within a container's security context. When set to true, it mounts the container's root filesystem as read-only, blocking any writes to the container layer. This forces all writable data to be stored in explicitly mounted volumes, such as emptyDir or persistent volumes, which is a key security hardening measure.

Why this answer

The `securityContext.readOnlyRootFilesystem` field, when set to `true`, mounts the container's root filesystem as read-only. This prevents any writes to the container's filesystem, enhancing security by making it immutable. It is the correct field to ensure a read-only filesystem.

Exam trap

CKS often tests the exact field name for read-only root filesystem; candidates may confuse it with other securityContext fields like runAsNonRoot or fsGroup.

How to eliminate wrong answers

Option B is wrong because `securityContext.runAsNonRoot` controls the user ID under which the container runs, not filesystem permissions. Option C is wrong because `container.fsGroup` sets the group ownership for volumes, not the root filesystem read-only status. Option D is wrong because `podSpec.containers.readonly` is not a valid Kubernetes field; the correct field is `securityContext.readOnlyRootFilesystem`.

3
Multi-Selectmedium

Which TWO of the following are valid Falco rule priorities?

Select 2 answers
A.MEDIUM
B.WARNING
C.HIGH
D.CRITICAL
E.LOW
AnswersB, D

WARNING is one of the eight valid Falco priorities, sitting between NOTICE and ERROR in the severity ordering. It is intended for events that are security-relevant and should be surfaced to operators, but are not as severe as an error or critical condition. For example, spawning a new shell inside a running container without a known parent process is often assigned WARNING priority to alert on potential lateral movement without flooding the alerting pipeline. It is a suitable default for many behavioral rules that warrant attention but not immediate incident response.

Why this answer

Falco rule priorities follow the syslog severity scale, and both WARNING (option B) and CRITICAL (option D) are valid members of that scale, sitting between NOTICE/ERROR and ALERT/EMERGENCY respectively. The full set of valid Falco priorities is EMERGENCY, ALERT, CRITICAL, ERROR, WARNING, NOTICE, INFORMATIONAL, and DEBUG, so any rule's priority field must be one of these exact strings. MEDIUM (option A), HIGH (option C), and LOW (option E) are not part of the syslog/Falco priority enumeration — they resemble generic severity labels from other tools but are not accepted values in a Falco rule definition.

Exam trap

The trap is assuming Falco uses intuitive severity labels like LOW, MEDIUM, or HIGH, when it actually uses syslog-style names such as WARNING, CRITICAL, ERROR, and DEBUG.

4
MCQeasy

In a Falco rule, what does the 'priority' field indicate?

A.The syscall filter condition
B.The format of the output message
C.The severity level of the event
D.The rule name
AnswerC

The `priority` field indicates the severity level of the event that the rule generates, using Falco's enumerated values from DEBUG (lowest) to EMERGENCY (highest). It is unrelated to the condition, output, or rule name, and it allows operators and integrated systems to apply different response thresholds, such as suppressing low-severity notifications or escalating high-severity alerts to pager escalation.

Why this answer

In a Falco rule, the priority field specifies the severity level of the event, such as EMERGENCY, ALERT, CRITICAL, ERROR, WARNING, NOTICE, INFORMATIONAL, or DEBUG. It determines how the alert is classified and can be used to filter or route notifications based on importance.

Exam trap

The trap is confusing the rule's structural fields: candidates may associate priority with the condition or output, but priority strictly denotes the severity classification of the event.

How to eliminate wrong answers

Option A is wrong because the syscall filter condition is defined in the 'condition' field (e.g., evt.type=open), not in priority. Option B is wrong because the output message format is defined in the 'output' field, which uses format specifiers like %proc.name and %fd.name. Option D is wrong because the rule name is defined in the 'rule' field, which is the human-readable identifier for the rule.

5
MCQmedium

An administrator wants to ensure that containers in the 'secure-app' namespace cannot write to their own filesystem. Which pod security context setting should be used?

A.securityContext: { runAsNonRoot: true }
B.securityContext: { privileged: false }
C.securityContext: { capabilities: { drop: ["ALL"] } }
D.securityContext: { readOnlyRootFilesystem: true }
AnswerD

Setting readOnlyRootFilesystem: true causes the container runtime to mount the container's root filesystem as read-only, so the write layer is not writable from the container's perspective; any attempt to modify an existing file or create a new file in the root directory tree will fail with EROFS. This directly prevents an attacker who compromises the container from persisting changes in the container layer, though ephemeral writes can still be accommodated by mounting volumes (e.g., emptyDir) at specific paths such as /tmp. It is the only option among those listed that enforces the filesystem-level read-only requirement.

Why this answer

Setting readOnlyRootFilesystem: true mounts the container's root filesystem as read-only, preventing any process inside the container from writing to it. This directly satisfies the requirement that containers cannot write to their own filesystem. Writable volumes can still be mounted separately for legitimate write needs.

Exam trap

CKS often tests the confusion between capability dropping and filesystem immutability — candidates who pick capabilities: drop ALL miss that write access to the root filesystem is controlled by the mount flag, not by Linux capabilities.

How to eliminate wrong answers

Option A is wrong because runAsNonRoot: true only enforces that the container process does not run as UID 0 — it says nothing about filesystem write access. Option B is wrong because privileged: false merely disables privileged mode (which grants host device and capability access); it does not make the root filesystem read-only. Option C is wrong because dropping all Linux capabilities removes kernel-level privileges but does not prevent writes to the container's own filesystem, which is a mount-level property, not a capability.

6
MCQmedium

You are writing a Falco rule to detect when a container tries to read /etc/shadow. Which condition should you use?

A.fd.name=/etc/shadow and container.id != host
B.fd.name=/etc/passwd
C.container.id != host
D.fd.name=/etc/shadow
AnswerA

This rule precisely targets a containerized process attempting to read /etc/shadow, the file that stores password hashes on most Linux systems. The condition container.id != host is essential because it restricts the match to events originating from containers, excluding the host itself. This combination avoids false positives from legitimate admin actions while capturing the exact behavior indicative of credential harvesting in a container.

Why this answer

The correct condition 'fd.name=/etc/shadow and container.id != host' ensures the accessed file is /etc/shadow and the event originates from a container (not the host). Option A correctly includes both conditions. Option B specifies /etc/passwd (wrong file).

Option C only checks that it's from a container but does not restrict the file. Option D checks the file but does not exclude host events.

7
MCQmedium

You have configured an audit policy with level: Request. Which request information is logged?

A.Only metadata for the request
B.Nothing is logged because Request is not a valid level
C.Request metadata and request body
D.Request metadata, request body, and response body
AnswerC

When the audit policy level is set to Request, the Kubernetes API server logs a structured audit event containing the full request metadata and the raw request body. This level sits between Metadata, which omits the body, and RequestResponse, which additionally includes the response body. It is the correct behavior for a policy configured with the Request level, matching the official audit level specification.

Why this answer

In the Kubernetes audit policy, the Request level logs the request metadata (who, what, when, where) plus the request body, but not the response body. This is useful for capturing what was sent to the API server without the overhead of logging responses. The Response level would additionally log the response body.

Exam trap

CKS often tests the distinction between Request and RequestResponse audit levels — candidates must remember that Request includes the request body but not the response body.

How to eliminate wrong answers

Option A is wrong because 'Only metadata' describes the Metadata level, not Request. Option B is wrong because Request is a valid audit level in Kubernetes (levels: None, Metadata, Request, RequestResponse). Option D is wrong because including the response body corresponds to the RequestResponse level, not Request.

8
MCQmedium

A cluster administrator wants to enforce that containers run with a read-only root filesystem. Which security context field should be set?

A.privileged: false
B.readOnlyRootFilesystem: true
C.readOnly: true
D.allowPrivilegeEscalation: false
AnswerB

`readOnlyRootFilesystem: true` is a container securityContext field that instructs the container runtime to mount the container's root filesystem as read-only (typically using a read-only overlay). Any attempt to write to the root filesystem will fail with an error unless a writable volume is mounted at a specific path, such as an `emptyDir` for temporary data. This directly satisfies the requirement to make the container's filesystem immutable, and it is the standard Kubernetes‑native way to achieve that guarantee.

Why this answer

The `readOnlyRootFilesystem: true` field in the Pod or container security context explicitly mounts the container's root filesystem as read-only, preventing any writes to the filesystem. This is a key runtime security control to mitigate malware or unauthorized modifications, as required by the CIS Kubernetes Benchmark and common security policies.

Exam trap

The CKS exam often tests the distinction between `readOnlyRootFilesystem` and the non-existent `readOnly` field, exploiting the common misconception that a simple `readOnly` boolean exists in the security context.

How to eliminate wrong answers

Option A is wrong because `privileged: false` only disables privileged mode (which grants all capabilities), but does not enforce a read-only root filesystem; a non-privileged container can still write to its filesystem. Option C is wrong because `readOnly: true` is not a valid field in the Kubernetes security context; the correct field is `readOnlyRootFilesystem`. Option D is wrong because `allowPrivilegeEscalation: false` prevents processes from gaining more privileges than their parent, but does not restrict filesystem writes.

9
MCQmedium

During a runtime incident, you suspect a container has a reverse shell. Which kubectl command can you use to examine the container's running processes?

A.kubectl logs <pod-name>
B.kubectl exec <pod-name> -- ps aux
C.kubectl top pod <pod-name>
D.kubectl describe pod <pod-name>
AnswerB

Correct. `kubectl exec <pod-name> -- ps aux` executes the `ps aux` command inside the container, displaying all active processes. This is the appropriate kubectl command to check for a reverse shell without requiring node-level access.

Why this answer

`kubectl exec <pod-name> -- ps aux` runs the `ps aux` command inside the container, which lists running processes. It is the only kubectl command that allows you to inspect container processes. Options A, C, and D do not provide process listings.

Exam trap

The exam may test that `kubectl exec` is the kubectl command used to run commands inside a container, enabling process inspection.

How to eliminate wrong answers

Option A is wrong because `kubectl logs` only retrieves the container's stdout/stderr logs, not a list of running processes; it cannot reveal a reverse shell that may not produce log output. Option C is wrong because `kubectl top pod` shows CPU and memory usage metrics for the pod, not process listings; it cannot identify specific processes like a reverse shell. Option D is wrong because `kubectl describe pod` provides metadata, events, and configuration details about the pod, not the container's running processes; it cannot inspect runtime process activity.

10
Multi-Selectmedium

Which TWO of the following are valid audit stages in Kubernetes? (Select 2)

Select 2 answers
A.RequestEvaluated
B.All of the above
C.ResponseStarted
D.RequestReceived
E.ResponseSent
AnswersC, D

ResponseStarted is a valid audit stage that is recorded when the HTTP response headers are sent by the kube-apiserver to the client. This stage fires before the response body is fully transmitted, making it useful for observing when a request has begun to be served, especially for long-running or streaming requests.

Why this answer

`ResponseStarted` is a valid Kubernetes audit stage that occurs when the audit handler starts sending the response to the client. This stage is part of the audit event lifecycle defined in the Kubernetes API server, capturing the moment the response headers are sent but before the body is fully transmitted.

Exam trap

The CKS exam often tests the exact naming of audit stages, and the trap here is that candidates confuse `ResponseStarted` with `ResponseSent` or invent stages like `RequestEvaluated`, which sound plausible but are not defined in the Kubernetes audit specification.

11
MCQhard

A Falco rule has priority: CRITICAL and condition: evt.type=execve and proc.name!=bash. What does this rule detect?

A.Any process spawning bash
B.All execve events except bash regardless of namespace
C.All execve events inside containers except bash
D.All execve events on the host except bash
AnswerB

Falco evaluates the condition against every execve event, and the proc.name!=bash filter excludes only processes named bash. No namespace field appears in the condition, so container and host executions alike trigger the CRITICAL alert, matching the option's scope exactly.

Why this answer

The Falco rule `evt.type=execve and proc.name!=bash` with priority CRITICAL detects all `execve` system call events where the process name is NOT `bash`. Falco operates at the host level and monitors all system calls across the entire node, including those from containers. Since the rule does not include a container-specific filter (e.g., `container.id != host`), it applies to all processes regardless of namespace.

Therefore, the rule detects all execve events except bash on the entire node—both host and container processes. Option B correctly captures this scope ('regardless of namespace').

Exam trap

The trap here is that candidates often assume Falco rules are container-scoped by default, but Falco operates at the host level and monitors all system calls unless explicitly filtered by container ID or namespace, so a rule without a container filter applies to the entire host.

How to eliminate wrong answers

Option A is wrong because the rule detects processes that are NOT bash, not processes spawning bash. Option B is wrong because the rule does not exclude bash events; it excludes events where the process name is bash, meaning it detects all execve events except those from bash, but it does not filter by namespace, so it applies to all execve events on the host, not just those inside containers. Option C is wrong because the rule does not limit detection to containers; Falco monitors all system calls on the host, including those from containers, but the rule applies globally to the entire node.

12
MCQhard

A pod has been compromised. You want to isolate it from other pods while preserving its network state for forensics. Which NetworkPolicy rule achieves this?

A.Deny all ingress and egress traffic to/from the pod's namespace
B.Create a NetworkPolicy with podSelector matching the compromised pod and empty ingress/egress rules (deny all)
C.Add a label to the pod and create a NetworkPolicy allowing only traffic from a forensic pod
D.Delete the pod
AnswerB

This is correct because a NetworkPolicy with a podSelector that matches only the compromised pod and contains no ingress or egress rules creates a default-deny policy for that pod alone. Under Kubernetes NetworkPolicy semantics, any selected pod with no matching rules is isolated: all inbound and outbound traffic is dropped, including DNS and cluster traffic. The policy does not alter the pod itself, so it preserves the running state and evidence. This is the standard, least-privilege method for isolating a single pod without disturbing the rest of the namespace.

Why this answer

A NetworkPolicy with a `podSelector` matching the compromised pod and empty `ingress` and `egress` rules (i.e., no rules specified) defaults to denying all traffic to and from that pod. This isolates the pod from all other pods in the cluster while preserving its network state for forensics, as the pod remains running and its network interfaces are untouched.

Exam trap

The trap here is that candidates often think a NetworkPolicy must explicitly specify `deny all` rules, but Kubernetes uses an implicit deny when the `ingress` or `egress` arrays are empty, which is a subtle but critical distinction tested in the CKS exam.

How to eliminate wrong answers

Option A is wrong because denying all ingress and egress traffic to/from the pod's namespace would affect all pods in that namespace, not just the compromised one, and does not isolate the specific pod while preserving its network state. Option C is wrong because adding a label and creating a NetworkPolicy that allows only traffic from a forensic pod would still permit egress traffic from the compromised pod unless explicitly denied, and it does not achieve full isolation. Option D is wrong because deleting the pod destroys its network state and prevents forensic analysis of its runtime behavior.

13
Multi-Selectmedium

Which TWO of the following Falco fields can be used in a rule condition to detect a shell spawned inside a container? (Choose two.)

Select 2 answers
A.evt.type
B.k8s.ns.name
C.proc.pname
D.container.id
E.proc.name
AnswersC, E

In Falco, proc.pname contains the name of the parent process of the event's process. This field is particularly valuable for detecting suspicious subprocess spawning: a shell like 'bash' is frequently launched by an application (e.g., a web server or a Kubernetes controller) rather than directly by a user. If a rule checks proc.pname for a known parent binary (such as 'nginx' or 'java') and proc.name for 'bash', it can flag a shell being spawned by an unexpected parent. Since proc.pname gives the immediate ancestor, it is a valid Falco field for writing shell-detection rules.

Why this answer

Option C (proc.pname) is correct because it identifies the parent process name, so a rule can match when the parent is a shell or entrypoint such as bash, sh, or a container runtime, indicating a shell was spawned by another process. Option E (proc.name) is correct because it identifies the name of the process that was executed, allowing detection of the spawned shell itself, e.g., proc.name=bash or proc.name=sh. Together, proc.pname and proc.name let Falco express conditions like proc.name in (bash, sh) and proc.pname in (bash, sh, docker, containerd) to catch shells spawned inside containers.

Option A (evt.type) only describes the syscall event type (e.g., execve, clone) and does not by itself identify a shell process. Option B (k8s.ns.name) only scopes the event to a Kubernetes namespace and provides no process-level information. Option D (container.id) merely identifies the container in which the event occurred, not that a shell was spawned.

Exam trap

CKS often tests whether candidates know which Falco fields are process-identity fields versus metadata/enrichment fields — the trap is selecting container.id or k8s.ns.name thinking they 'detect' the shell, when they only scope or locate the event.

14
MCQmedium

You need to create a NetworkPolicy that allows only ingress traffic from pods with label 'app: frontend' in the same namespace. Which policyType and ingress rule should you use?

A.policyTypes: [Ingress] ingress: - from: - podSelector: matchLabels: app: frontend
B.policyTypes: [Ingress] ingress: - from: - podSelector: {}
C.policyTypes: [Ingress] ingress: - from: - namespaceSelector: {}
D.policyTypes: [Egress]
AnswerA

This NetworkPolicy correctly restricts inbound traffic: the `policyTypes` list explicitly includes `Ingress`, and the `ingress` rule uses a `podSelector` with `matchLabels: app: frontend`. This `podSelector` in the `from` field matches only source pods that carry the label `app=frontend` within the same namespace. Because a NetworkPolicy that selects a pod enforces default-deny for the specified policy types, this rule whitelists exactly the intended frontend pods while blocking all other ingress sources.

Why this answer

A NetworkPolicy that restricts ingress traffic to only pods with the label 'app: frontend' in the same namespace must use `policyTypes: [Ingress]` and an `ingress` rule with a `podSelector` that matches that label. The `podSelector` without a `namespaceSelector` implicitly selects pods only within the same namespace as the NetworkPolicy, which satisfies the requirement.

Exam trap

The trap here is that candidates often confuse `podSelector: {}` (which allows all pods in the namespace) with `podSelector` with specific labels, or they incorrectly add a `namespaceSelector` when the requirement explicitly says 'same namespace'.

How to eliminate wrong answers

Option B is wrong because `podSelector: {}` selects all pods in the namespace, which would allow ingress from any pod, not just those with label 'app: frontend'. Option C is wrong because `namespaceSelector: {}` selects all namespaces, allowing ingress from pods in any namespace, which violates the requirement to restrict to the same namespace. Option D is wrong because `policyTypes: [Egress]` only controls outbound traffic, not ingress traffic, so it cannot satisfy the requirement to allow only ingress traffic.

15
MCQhard

An audit policy is configured with the following rule: - level: RequestResponse users: ["system:serviceaccount:kube-system:admin"] verbs: ["get", "list"] resources: - group: "" resources: ["secrets"] What will be logged when the service account 'admin' in kube-system performs a GET request on a Secret?

A.Only the request metadata will be logged
B.Only the response will be logged
C.The request and response metadata and body will be logged
D.Nothing will be logged because the rule uses an empty api group
AnswerC

RequestResponse is the most verbose audit level. For any rule matched at this level, the audit event includes the complete request object and the complete response object, each with both metadata and body payloads. This includes the full submitted resource state and the returned status/object, so all request and response information is logged as the option correctly states.

Why this answer

The audit rule specifies `level: RequestResponse`, which instructs the API server to log both the request metadata and body, as well as the response metadata and body, for matching events. The rule matches the service account `system:serviceaccount:kube-system:admin` performing a GET on secrets (empty API group matches core API group), so the full request and response payloads are captured.

Exam trap

A common misconception is that an empty API group means 'no group' or 'invalid', but in Kubernetes audit policy, `group: ""` explicitly matches the core API group (e.g., pods, secrets, services), so the rule is valid and will log the event.

How to eliminate wrong answers

Option A is wrong because `RequestResponse` level logs both request and response metadata and body, not just request metadata (that would be `Request` level). Option B is wrong because `RequestResponse` logs both request and response, not only the response (no level logs only response). Option D is wrong because an empty `group: ""` in the resources section matches the core API group (e.g., `/api/v1`), which includes secrets, so the rule applies correctly.

16
MCQhard

A compromised pod is making unexpected outbound connections. You want to isolate the pod by blocking all egress traffic while keeping it running for forensic analysis. Which action is correct?

A.Use kubectl exec to kill the outbound processes inside the container
B.Apply a NetworkPolicy that selects the pod and has no egress rules, effectively blocking all outbound traffic
C.Modify the pod's /etc/hosts to block external IPs
D.Delete the pod and recreate it with a restrictive NetworkPolicy
AnswerB

A NetworkPolicy that selects the compromised pod and specifies an empty egress rule list (e.g., `egress: []`) enforces a default-deny model for all outbound traffic. Because NetworkPolicy rules are additive—only traffic explicitly allowed by a matching rule passes—an empty list allows nothing, effectively containing the pod while preserving its state for forensics. For this to work, the cluster must run a CNI that implements NetworkPolicy, such as Calico, Cilium, or Weave Net. Alternatively, setting `policyTypes: [Egress]` with no egress rules achieves the same isolation.

Why this answer

Applying a NetworkPolicy that selects the pod with no egress rules blocks all outbound traffic while leaving the pod running, which is exactly what forensic isolation requires. In Kubernetes, once a pod is selected by a NetworkPolicy with an egress policy type, only explicitly allowed egress is permitted — an empty egress rule set means deny all. This preserves the pod's state and memory for analysis.

Exam trap

CKS often tests whether candidates understand that NetworkPolicy is additive and that an empty egress rule set means deny-all; a common mistake is thinking you must delete the pod or that /etc/hosts changes provide isolation.

How to eliminate wrong answers

Option A is wrong because killing processes inside the container alters the compromised state and may destroy forensic evidence, and it does not guarantee all outbound traffic stops. Option C is wrong because modifying /etc/hosts only affects name resolution for some applications and does not block traffic to IP addresses or other resolution paths. Option D is wrong because deleting the pod destroys volatile evidence (memory, running processes) and violates the requirement to keep it running for forensic analysis.

17
MCQhard

You need to configure a NetworkPolicy that allows egress traffic only to an external database at IP 10.0.0.5 on port 5432, and denies all other egress. Which policy BEST achieves this?

A.apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: db-egress spec: podSelector: {} policyTypes: - Egress egress: - to: - ipBlock: cidr: 0.0.0.0/0 ports: - port: 5432
B.apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: db-egress spec: podSelector: {} policyTypes: - Egress egress: - to: - podSelector: matchLabels: app: db
C.apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: db-egress spec: podSelector: {} policyTypes: - Egress egress: []
D.apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: db-egress spec: podSelector: {} policyTypes: - Egress egress: - to: - ipBlock: cidr: 10.0.0.5/32 ports: - port: 5432
AnswerD

The ipBlock with CIDR 10.0.0.5/32 precisely identifies the database's IP address, and the port 5432 restricts traffic to the database listener, thereby permitting only the intended communication. Because policyTypes includes Egress and this is the sole egress rule, it also establishes an implicit default-deny for any other outbound traffic, aligning with least-privilege security. This is the correct configuration for allowing egress to a specific external IP and port.

Why this answer

The correct policy uses an ipBlock with cidr 10.0.0.5/32 and port 5432, which precisely allows egress only to that single external database IP on the PostgreSQL port. Because policyTypes includes Egress and the egress rule is the only one, all other egress traffic is implicitly denied. This matches the requirement exactly.

Exam trap

CKS often tests the trap of using 0.0.0.0/0 with a port filter, which looks restrictive but actually allows any destination on that port — candidates must verify the CIDR matches the exact target IP.

How to eliminate wrong answers

Option A is wrong because cidr 0.0.0.0/0 allows egress to any IP on port 5432, not just 10.0.0.5 — it violates the 'only to external database' requirement. Option B is wrong because podSelector matches pods by label within the cluster, not an external IP; it would not allow traffic to 10.0.0.5 and would instead allow traffic to labeled pods. Option C is wrong because an empty egress list (egress: []) denies all egress traffic, including the required database connection, so it blocks everything.

18
MCQhard

A cluster runs Kubernetes 1.29 with the AppArmor support enabled. A pod manifest sets securityContext.appArmorProfile.type to Localhost with localhostProfile: k8s-nginx. The pod stays in ContainerCreating and the kubelet logs show a failed to apply AppArmor profile error. Which action most directly resolves the failure?

A.Install the AppArmor profile into the container image at /etc/apparmor.d/k8s-nginx and restart the pod.
B.Add the k8s-nginx profile to the kube-apiserver's --apparmor-profile flag.
C.Change the profile type to RuntimeDefault so the container inherits the runtime's default AppArmor profile.
D.Load the k8s-nginx profile into the kernel on every node in the cluster with apparmor_parser -r before the pod is scheduled.
AnswerD

The Localhost AppArmor type requires the named profile to already be loaded into the kernel on the node where the pod runs. The kubelet does not load profiles from the manifest; it only references them. Running apparmor_parser to load k8s-nginx on each eligible node makes the profile available so the runtime can apply it and the container can start.

Why this answer

Localhost AppArmor profiles must exist in the node kernel before a pod referencing them can start. The kubelet and container runtime only look up the named profile; they do not load it. Loading k8s-nginx with apparmor_parser on each node that may run the pod makes the profile resolvable, allowing the container to be created under the intended policy.

Exam trap

The trap here is thinking the kubelet or the API server loads the AppArmor profile named in the pod spec, when in fact the profile must already be loaded into the node kernel.

19
Multi-Selecthard

Which THREE of the following are recommended steps during incident response for a compromised pod? (Choose three.)

Select 3 answers
A.Take a memory dump of the container for analysis
B.Delete the entire namespace containing the pod
C.Use kubectl logs and kubectl exec to collect forensic data
D.Apply a NetworkPolicy to deny egress traffic from the pod
E.Immediately restart the pod to stop the attack
AnswersA, C, D

Taking a memory dump preserves volatile artifacts—such as running processes, network socket states, environment variables, and injected attack code—that disappear permanently when the container stops. Capturing this snapshot before any other forensic or remediation action allows investigators to run offline analysis against the exact memory image, potentially revealing the initial exploit and any in-memory resident payloads. Using tooling like `docker exec` with `/proc` access or dedicated memory capture utilities ensures the live state is frozen without altering the container.

Why this answer

Option A is correct because capturing a memory dump of the container preserves volatile evidence such as running processes, injected code, and in-memory credentials before the pod is terminated or restarted. Option C is correct because kubectl logs retrieves container stdout/stderr history and kubectl exec allows live inspection of the filesystem, processes, and network state for forensic collection. Option D is correct because applying a NetworkPolicy that denies egress traffic contains the compromised pod, preventing data exfiltration or command-and-control communication while investigation continues.

Option B is not recommended because deleting the entire namespace destroys evidence and may disrupt unrelated workloads. Option E is not recommended because restarting the pod immediately destroys volatile memory and runtime artifacts needed for root-cause analysis.

Exam trap

CKS often tests the tension between containment and evidence preservation — candidates are tempted by 'restart the pod' or 'delete the namespace' as quick fixes, but these destroy forensic evidence and violate incident response best practices.

20
MCQmedium

A security team wants to detect any attempt to read the /etc/shadow file inside a container. Which Falco rule condition would trigger an alert for such an event?

A.evt.type=open and proc.name=bash and fd.name=/etc/shadow
B.evt.type=open and fd.name contains /etc
C.evt.type=open and fd.name=/etc/shadow and evt.arg.flags contains O_WRONLY
D.evt.type=open and fd.name=/etc/shadow and evt.arg.flags contains O_RDONLY
AnswerD

This is the correct Falco rule: it captures the open syscall specifically on /etc/shadow, uses the exact file path to avoid false positives from /etc subdirectories, and filters on the O_RDONLY flag to select only read-only opens. Attackers almost always open the shadow file with O_RDONLY to dump its contents, so this rule reliably surfaces those attempts while ignoring legitimate administrative writes that use O_WRONLY or O_RDWR. The result is a focused, high-signal detection rule.

Why this answer

Reading /etc/shadow requires the open syscall with the O_RDONLY flag. Falco's rule condition `evt.type=open and fd.name=/etc/shadow and evt.arg.flags contains O_RDONLY` precisely matches an attempt to open the file for reading, which is the event that should trigger an alert for unauthorized read access.

Exam trap

The CKS exam often tests the distinction between read and write flags in syscall arguments, and candidates mistakenly choose O_WRONLY (option C) thinking any access to /etc/shadow is malicious, but the question specifically asks for read attempts.

How to eliminate wrong answers

Option A is wrong because it restricts the triggering process to `proc.name=bash`, which would miss attempts by other processes (e.g., cat, less, or a malicious binary) to read /etc/shadow. Option B is wrong because `fd.name contains /etc` is too broad — it would trigger on any file under /etc (e.g., /etc/passwd, /etc/hosts), not specifically /etc/shadow, leading to excessive false positives. Option C is wrong because `evt.arg.flags contains O_WRONLY` matches write operations, not read operations; opening /etc/shadow for writing is a different (and less common) event, and the question asks specifically for detecting read attempts.

21
MCQhard

A security team wants to detect any attempt to read /etc/shadow from within a container using Falco. Which condition in a Falco rule would match this behavior?

A.proc.name contains "shadow" and evt.type=read
B.evt.type=read and fd.name contains "shadow"
C.evt.type=open and fd.name=/etc/shadow
D.container and fd.name=/etc/shadow
AnswerC

The open syscall is the actual attempt to access a file; checking evt.type=open with an exact fd.name=/etc/shadow ensures the rule fires when any process tries to open the shadow password file, whether or not the subsequent read occurs. This catches both successful reads and denied attempts, making it the precise detection predicate.

Why this answer

Reading /etc/shadow from a container requires opening the file first, so the Falco rule must match the `open` system call (evt.type=open) and the exact file path (fd.name=/etc/shadow). The `open` syscall is the entry point for file access, and Falco captures it before any read or write occurs, making it the appropriate event type to detect an attempt to read the shadow file.

Exam trap

A common misconception in CKS is that reading a file is detected via the `read` syscall, but the correct approach is to detect the `open` syscall because that is when the file access is initiated and Falco's rule engine is designed to catch the opening event.

How to eliminate wrong answers

Option A is wrong because `proc.name contains 'shadow'` matches processes with 'shadow' in their name (e.g., a process named 'shadowd'), not the file being accessed; also, `evt.type=read` alone would miss the initial open that triggers the read. Option B is wrong because `evt.type=read` and `fd.name contains 'shadow'` would only match after the file is already opened and a read syscall is made, but Falco typically triggers on the open syscall for file access detection, and using `contains` instead of exact match could produce false positives (e.g., matching '/etc/shadow.bak'). Option D is wrong because it lacks an event type filter (evt.type), so it would match any event (including close, write, etc.) with fd.name=/etc/shadow, which is too broad and may generate noise or miss the specific open attempt.

22
Multi-Selectmedium

Which TWO of the following are valid techniques to detect and respond to runtime incidents in a Kubernetes cluster? (Select TWO.)

Select 2 answers
A.Deleting the compromised pod immediately to stop the attack
B.Using crictl images to list container images on the node
C.Applying a NetworkPolicy to isolate a compromised pod
D.Using kubectl exec to gather forensic data from a running container
E.Running kubectl logs --previous to view logs of a terminated container
AnswersC, D

A NetworkPolicy that selects the compromised pod and has no ingress or egress rules enforces a default-deny policy for that pod, immediately cutting off command-and-control and lateral movement. This is a nondestructive containment action that preserves the pod's filesystem and live state for subsequent forensic collection. Ensure your CNI plugin (e.g., Calico, Cilium) actually enforces the policy—otherwise the rule will be silently ignored.

Why this answer

Option C is correct because applying a NetworkPolicy to a compromised pod lets you isolate it at the network layer — by selecting the pod with a label selector and defining ingress/egress rules (or an empty egress/ingress set) you cut off lateral movement and C2 traffic while keeping the pod alive for investigation, which is a standard containment step in runtime incident response. Option D is correct because kubectl exec into a running container allows you to collect volatile forensic evidence — running processes, open sockets, environment variables, and in-memory artifacts — that would be lost if the pod were deleted or restarted, making it a valid detection/response technique. Option A is not a valid detection technique: deleting the pod destroys evidence and, if the workload is managed by a ReplicaSet/Deployment, the controller immediately recreates it, so the attack resumes.

Option B is not a runtime incident detection/response technique: crictl images only enumerates images cached on the node and provides no runtime behavioral insight. Option E is not correct here because kubectl logs --previous only retrieves logs from a previously terminated container instance and does not itself detect or respond to a live runtime incident.

Exam trap

Candidates may think that deleting the pod is the best immediate response, but the exam expects knowledge of proper incident response steps that preserve evidence and contain the threat.

23
MCQmedium

You run 'kubectl exec -it <pod> -- /bin/sh' inside a pod that has an immutable root filesystem. What happens?

A.The command fails with an error because the container has an immutable root filesystem
B.The shell starts and can write to any directory because 'exec' bypasses the restriction
C.The shell starts successfully, but any attempt to write to the root filesystem will be denied
D.The pod is restarted with a writable filesystem
AnswerC

A successful kubectl exec starts a shell only if the container image contains that shell binary; the readOnlyRootFilesystem flag does not block process creation. Once the shell is running, it inherits the container's read-only root mount, meaning operations like touch /file or redirecting output to /root/out.txt will fail with a read-only file system error. Only paths backed by writable volumes defined in the pod spec, such as emptyDir or a mounted persistent volume, will accept writes.

Why this answer

When a container has an immutable root filesystem (e.g., readOnlyRootFilesystem: true in Kubernetes), the root filesystem is mounted as read-only. Running 'kubectl exec' to start a shell will succeed because the shell binary is already present and executable. However, any attempt to write to the root filesystem (e.g., creating a file) will be denied with a 'Read-only file system' error.

The shell itself does not bypass the restriction.

Exam trap

CKS often tests the misconception that 'exec' provides privileged access that bypasses securityContext restrictions, when in fact it operates within the same constraints.

How to eliminate wrong answers

Option A is wrong because the command does not fail; the shell starts successfully since the binary is readable and executable. Option B is wrong because 'exec' does not bypass the read-only restriction; it simply runs a process in the container's existing namespaces and filesystem. Option D is wrong because the pod is not restarted; the immutable filesystem is a static configuration, and no restart is triggered by an exec command.

24
Multi-Selectmedium

Which TWO of the following are valid audit levels in a Kubernetes audit policy? (Select TWO.)

Select 2 answers
A.Response
B.None
C.Metadata
D.Log
E.Full
AnswersB, C

None is a valid and correct Kubernetes audit level. When set in an audit policy rule, None means that no audit event is logged for requests that match that rule. It is commonly used to exclude high-noise, low-risk endpoints such as health checks, static assets, or service account token requests. Using None for specific rules helps reduce storage and performance overhead while still logging important actions at other levels.

Why this answer

Option B (None) is a valid audit level: it tells the API server not to log matching requests at all, which is useful for excluding noisy or sensitive events from the audit log. Option C (Metadata) is also valid: it logs request metadata such as the user, timestamp, resource, verb, and whether the request succeeded, but omits the request and response bodies. Kubernetes audit policies define exactly these levels — None, Metadata, Request, and RequestResponse — so the remaining choices do not belong: Response (A) is not a level (the response-body level is RequestResponse), Log (D) is not a defined audit level, and Full (E) is not a Kubernetes audit level name.

Exam trap

CKS often tests the exact four audit levels (None, Metadata, Request, RequestResponse) and candidates frequently confuse them with logging levels or invent plausible-sounding names like 'Response', 'Log', or 'Full'.

25
MCQhard

A security engineer is hardening a Kubernetes cluster and wants to ensure that any container attempting to load a kernel module is immediately detected and logged. They have deployed Falco on all nodes. Which Falco rule condition should they use to detect this activity?

A.evt.type=mmap and fd.type=module
B.evt.type=execve and proc.name contains modprobe
C.evt.type=init_module or evt.type=finit_module
D.evt.type=open and fd.name contains /lib/modules
AnswerC

Loading a kernel module involves the init_module or finit_module system calls. Falco can detect these by matching evt.type against those syscall names. This condition directly targets the kernel module loading activity, making it the correct choice for detecting when a container attempts to load a kernel module into the host kernel.

Why this answer

To detect kernel module loading, Falco must monitor the init_module and finit_module system calls, which are the actual kernel interfaces for loading modules. Matching evt.type against these syscall names provides direct, reliable detection regardless of which user-space tool or method is used to initiate the load. This condition is precise and minimizes false positives.

Exam trap

The trap here is focusing on user-space tools like modprobe instead of the underlying syscalls, which are the definitive indicator of kernel module loading.

26
Multi-Selecteasy

Which TWO tools can be used to directly interact with the container runtime (without going through the Kubernetes API) for troubleshooting?

Select 2 answers
A.kubelet
B.docker
C.ctr
D.crictl
E.kubectl
AnswersC, D

ctr is containerd's native CLI that connects directly to the containerd daemon through its gRPC socket, typically /run/containerd/containerd.sock. It operates below the CRI layer and can access containerd's low-level primitives such as images, snapshots, tasks, and namespaces, providing direct and unabstracted interaction with the container runtime on the host. On many Kubernetes nodes, containerd is the underlying runtime, so ctr is a legitimate direct tool, though it requires explicit namespace knowledge when inspecting pod containers.

Why this answer

Options C and D are correct because both ctr and crictl are command-line tools that talk directly to the container runtime rather than to the Kubernetes API server. ctr is the CLI shipped with containerd and interacts with the containerd daemon (via its socket, e.g. /run/containerd/containerd.sock) to list, inspect, and manage containers and images. crictl is a CRI-compatible CLI that connects to any CRI-compliant runtime endpoint (containerd or CRI-O) using the --runtime-endpoint flag, making it ideal for node-level troubleshooting when the API server or kubelet is unavailable. The unmarked options do not belong: kubelet (A) is the node agent that itself calls the CRI, not a tool for directly interacting with the runtime; docker (B) is a higher-level engine/CLI that is not the Kubernetes CRI runtime in modern clusters; and kubectl (E) communicates exclusively through the Kubernetes API server, which the question explicitly excludes.

Exam trap

The trap is assuming docker is still the runtime on modern clusters; since Kubernetes 1.24 removed the dockershim, docker is not the runtime, and kubectl goes through the API server rather than the runtime.

27
Multi-Selecteasy

Which TWO of the following are valid priority levels in Falco rules?

Select 2 answers
A.MEDIUM
B.LOW
C.WARNING
D.HIGH
E.CRITICAL
AnswersC, E

WARNING is a valid Falco priority and represents a mid-to-high severity condition that should be investigated but does not necessarily require immediate emergency response. It sits between NOTICE and ERROR in Falco's syslog-compatible priority ladder. For example, detecting a shell inside a container often uses WARNING or NOTICE depending on policy.

Why this answer

In Falco rule definitions, the priority field accepts a fixed set of severity levels, and both WARNING (option C) and CRITICAL (option E) are among the valid values, alongside EMERGENCY, ALERT, ERROR, NOTICE, INFORMATIONAL, and DEBUG. WARNING is used for suspicious events that warrant attention but are not necessarily malicious, while CRITICAL denotes severe security events requiring immediate action, so both are legitimate priority levels recognized by the Falco rule schema. Options A (MEDIUM), B (LOW), and D (HIGH) are not part of Falco's defined priority enumeration, even though similar terms appear in other logging or severity frameworks, so they would be rejected or misinterpreted in a Falco rule's priority field.

Exam trap

The trap is assuming that common severity labels like HIGH, MEDIUM, or LOW are valid in Falco, when in fact Falco uses syslog-style priorities.

28
MCQhard

You are investigating a pod suspected of being compromised. Which set of commands would provide the most useful forensic evidence without altering the container's state?

A.kubectl logs <pod> && kubectl describe pod <pod>
B.kubectl cp <pod>:/ -c <container> /tmp/forensic && kubectl logs <pod> --previous
C.kubectl exec <pod> -- cat /proc/1/cmdline && kubectl exec <pod> -- ls -la /
D.kubectl exec -it <pod> -- bash && kubectl exec <pod> -- cat /var/log/syslog
AnswerA

Running `kubectl logs <pod>` and `kubectl describe pod <pod>` only retrieves the current container's stdout/stderr logs and pod metadata from the API server. These commands do not access the container's filesystem, process state, or previous terminated container instances, so critical forensic artifacts like binary payloads, configuration changes, or crash evidence remain hidden. Furthermore, they capture live data that can change during investigation, making them unsuitable for preserving a reliable evidentiary snapshot.

Why this answer

Option A is the only set of commands that does not execute anything inside the container. `kubectl logs` and `kubectl describe pod` read information from the API server and kubelet without interfering with the container's runtime state. Options B, C, and D all involve `kubectl exec` (or `kubectl cp`, which uses `kubectl exec` to run tar inside the container), creating new processes and potentially modifying atime or other state, violating the forensic principle of non-interference.

Exam trap

A common trap is assuming `kubectl cp` is non-invasive because it copies files. In reality, `kubectl cp` uses `kubectl exec` to run `tar` inside the container, which changes the container's state. Any command executed via `kubectl exec`—including those under the hood of `kubectl cp`—is disallowed when the requirement is to preserve the container's state.

Non-invasive options are limited to read-only API calls like `kubectl logs` and `kubectl describe`.

How to eliminate wrong answers

Option A is wrong because `kubectl logs` and `kubectl describe pod` only retrieve metadata and current logs, but do not capture the container's filesystem or state for offline analysis, and `kubectl logs` may alter the log stream or trigger log rotation. Option C is wrong because `kubectl exec` runs commands inside the container, which modifies the container's state (e.g., creates new processes, updates /proc, changes atime on accessed files), potentially destroying forensic evidence. Option D is wrong because `kubectl exec -it -- bash` opens an interactive shell that creates new processes and modifies the container's runtime state, and `cat /var/log/syslog` may not exist in containerized environments (containers typically log to stdout/stderr, not syslog), while also altering file access times.

29
MCQhard

A cluster uses containerd and a security team wants to block containers from loading kernel modules. They apply a pod with securityContext.seccompProfile.type set to Localhost and a profile that returns SCMP_ACT_ERRNO for the init_module and finit_module syscalls. The pod starts but a test binary still loads a module. Which is the most likely cause?

A.The seccomp profile must be stored in the container image rather than referenced by the pod, so the runtime ignored it.
B.The pod needs privileged: true for the profile to be enforced, since restricted pods skip seccomp filtering.
C.Seccomp filters cannot block init_module or finit_module because those syscalls are resolved by the kernel before the filter runs.
D.The container process runs with CAP_SYS_MODULE and the seccomp profile's default action is SCMP_ACT_ALLOW, so the errno rule was placed after a broader allow rule that matched first.
AnswerD

Seccomp evaluates rules in order and applies the first matching rule, so an early broad allow for the syscall group can shadow the later errno rule. Combined with CAP_SYS_MODULE, which grants the capability needed to load modules, the container bypasses the intended block. Reordering the deny rule above the allow and dropping the capability closes the gap.

Why this answer

Seccomp applies the first matching rule, so a broad allow placed before the errno rule for init_module and finit_module neutralizes the block. Keeping CAP_SYS_MODULE also lets the process attempt module loads. Ordering the deny rules first and removing the capability ensures the filter actually stops module loading in this container.

Exam trap

The trap here is assuming that listing a syscall with an errno action always blocks it, when an earlier matching allow rule or a retained capability can let the call succeed.

30
Multi-Selecthard

Which THREE of the following are recommended steps during incident response for a compromised pod?

Select 3 answers
A.Apply a NetworkPolicy to isolate the pod
B.Restart the pod by deleting and recreating it
C.Delete the pod immediately to stop the attack
D.Use kubectl exec to collect running processes and network connections
E.Preserve the pod and its logs for investigation
AnswersA, D, E

Applying a NetworkPolicy isolates the compromised pod by restricting ingress and egress traffic, satisfying the containment requirement during incident response. This prevents lateral movement to other workloads while preserving the pod for forensic analysis, rather than deleting it immediately. NetworkPolicy enforcement depends on a CNI plugin that supports it, such as Calico or Cilium.

Why this answer

Option A is correct because applying a NetworkPolicy to the compromised pod isolates it from other workloads, blocking lateral movement and command-and-control traffic while keeping the pod alive for analysis. Option D is correct because using kubectl exec to collect running processes and network connections captures volatile forensic evidence (e.g., process lists, sockets) that would be lost if the pod were terminated. Option E is correct because preserving the pod and its logs maintains the evidence chain for investigation, including container logs and cluster events needed to determine the attack's scope and root cause.

Option B is not recommended because deleting and recreating the pod destroys volatile evidence and may allow the attacker to re-establish persistence. Option C is not recommended because immediately deleting the pod erases forensic artifacts and prevents understanding the compromise, even though it might stop the immediate attack.

Exam trap

A common trap is that deleting or restarting a compromised pod is a safe containment action, when in fact it destroys critical forensic evidence and violates the 'preserve before eradicate' principle taught in the CKS curriculum.

31
MCQmedium

A security analyst needs to detect and record attempts to modify Kubernetes audit-relevant resources. The cluster already forwards audit logs to a SIEM. Which configuration ensures the API server records both the request and the response for changes to Secrets, while keeping other requests at a lighter level?

A.Set --audit-policy-file to a policy that places a rule with level: RequestResponse and resources: [{group: "", resources: ["secrets"]}] above a catch-all rule with level: Metadata.
B.Set --audit-policy-file to a policy with a rule at level: Request for secrets and a catch-all at level: RequestResponse.
C.Set --audit-policy-file to a policy with a single rule at level: RequestResponse and no resource restriction.
D.Set --audit-policy-file to a policy with a rule at level: Metadata for secrets and a catch-all at level: None.
AnswerA

Audit rules are evaluated in order and the first matching rule wins, so a specific rule for secrets at RequestResponse captures both request and response bodies for Secret changes. The later catch-all at Metadata keeps the rest of the traffic lightweight. This ordering and level pairing is exactly what the requirement describes.

Why this answer

Audit policy rules are matched in order, and the first match determines the level. A resource-specific rule at RequestResponse placed above a broad Metadata rule records full request and response bodies for Secret changes while keeping other traffic light. Reversing the order or using a broad RequestResponse rule would either miss the bodies or flood the audit backend.

Exam trap

The trap here is forgetting that audit rules are first-match-wins, so a broad rule placed above a specific rule silently overrides the intended per-resource level.

32
MCQhard

You need to detect any unexpected outbound connections from pods in the 'production' namespace. Which Falco rule condition is MOST appropriate?

A.evt.type=sendto and fd.sip != "0.0.0.0"
B.evt.type=connect and container.id != host and not fd.snet in ("10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "127.0.0.0/8")
C.container.id != host and evt.type=accept
D.proc.name = curl and evt.type=connect
AnswerB

This is correct because `connect` is the syscall invoked whenever a process initiates an outbound TCP connection (and can also set a default peer for UDP), making it the ideal hook for detecting unexpected egress. The `container.id != host` condition ensures only events from containers are evaluated, excluding host-level connections. The `not fd.snet in (...)` clause excludes RFC1918 private ranges and loopback, so the rule only fires when a container connects to a public IP, i.e., an actual outbound internet connection.

Why this answer

It uses the `connect` syscall to detect outbound connection attempts from containers (excluding the host) and filters out private IP ranges (RFC 1918 and loopback) to flag only unexpected external destinations. This directly matches the requirement to detect unexpected outbound connections from pods in the 'production' namespace.

Exam trap

In the CKS exam, a common pitfall is confusing `connect` (outbound) with `accept` (inbound) syscalls in Falco rules. Candidates may choose `evt.type=accept` thinking it detects outbound connections, but `accept` is for incoming connections. The correct rule uses `connect` to catch outbound attempts and filters private IPs to flag unexpected external destinations.

How to eliminate wrong answers

Option A is wrong because `sendto` is used for sending data on a UDP socket, not for establishing a connection; it also uses `fd.sip` (server IP) but the condition `!= "0.0.0.0"` is too broad and does not filter private ranges, so it would generate many false positives. Option C is wrong because `evt.type=accept` detects incoming connections (server-side), not outbound connections from pods. Option D is wrong because it restricts detection to only the `curl` process, which is far too narrow and misses other tools or libraries (e.g., wget, netcat, or application-level HTTP clients) that could make outbound connections.

33
MCQeasy

Which crictl command is used to view logs from a specific container?

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

crictl logs retrieves stdout/stderr output for a given container ID from the runtime, optionally with --tail or --follow. It satisfies the requirement to inspect a specific container's logs when debugging via the CRI rather than the kubelet.

Why this answer

`crictl logs <container-id>` is the command used to retrieve logs from a specific container managed by a CRI-compatible runtime (e.g., containerd, CRI-O). This command fetches the container's stdout and stderr output, similar to `docker logs`, and is essential for debugging and monitoring containerized applications in Kubernetes.

Exam trap

The trap here is that candidates may confuse `crictl exec` (which runs commands) with `crictl logs` (which retrieves logs), or mistakenly think `crictl ps` shows logs because it lists containers, but it only shows status, not log output.

How to eliminate wrong answers

Option A is wrong because `crictl exec <container-id>` runs a command inside a running container, not view logs. Option B is wrong because `crictl inspect <container-id>` displays detailed metadata and configuration of a container, not its log output. Option C is wrong because `crictl ps` lists all running containers (similar to `docker ps`), but does not show logs for any specific container.

34
MCQmedium

A security analyst notices that a Falco rule intended to detect writes to /etc inside containers is generating alerts for a legitimate application that writes to /etc/app/config. The analyst wants to refine the rule to exclude this specific path while still detecting other writes to /etc. Which Falco rule condition modification should be applied?

A.Add 'and not fd.directory = /etc/app' to the condition
B.Add 'and not proc.name = app' to the condition
C.Change the rule's priority from WARNING to NOTICE
D.Add 'and not fd.name = /etc/app/config' to the condition
AnswerD

Falco's rule condition language supports boolean operators like 'and not' to exclude specific events. Adding 'and not fd.name = /etc/app/config' will prevent alerts when the file descriptor name exactly matches that path, while still triggering for other writes under /etc. This is the precise way to create an exception for a known legitimate file.

Why this answer

Falco rules can be tuned with boolean conditions to exclude known legitimate activity. To suppress alerts for a specific file path, the condition should include a check that the file descriptor name does not equal that path. This maintains detection for all other writes to /etc while eliminating the false positive from the legitimate application's configuration file.

Exam trap

The trap here is using process-based exclusions or severity changes instead of path-based exclusions, which either over-suppress or fail to suppress the false positive.

35
MCQeasy

Which audit policy level logs the request metadata and the request body?

A.None
B.Metadata
C.RequestResponse
D.Request
AnswerD

The Request audit level provides all the metadata fields from the Metadata level and also includes the request body, enabling an administrator to see the exact payload the client submitted. It deliberately omits the response body, so the audit log does not capture what data the apiserver returned. This makes Request the precise answer for the question, which asks for request metadata plus the request body.

Why this answer

In Kubernetes audit logging, the 'Request' level logs both the request metadata (e.g., user, timestamp, resource) and the request body (the full object sent in the API request). This level provides detailed information about the operation without including the response body, which is reserved for the 'RequestResponse' level.

Exam trap

Kubernetes often tests the distinction between 'Request' and 'RequestResponse' levels, where candidates mistakenly choose 'RequestResponse' because they think it includes the request body, but the question specifically asks for only the request metadata and request body, not the response body.

How to eliminate wrong answers

Option A is wrong because 'None' logs no audit events at all, so it captures neither metadata nor the request body. Option B is wrong because 'Metadata' logs only the request metadata (e.g., user, timestamp, resource) but explicitly excludes the request body. Option C is wrong because 'RequestResponse' logs both the request metadata, request body, and the response body, which is more verbose than what the question asks for (only request metadata and request body).

36
MCQmedium

You need to configure Kubernetes audit logging to log all requests at the Metadata level for a specific namespace. Which audit policy level should you use?

A.Request
B.None
C.RequestResponse
D.Metadata
AnswerD

The Metadata audit level logs request metadata such as the user, groups, verb, resource, source IP, and response status, but it deliberately omits both request and response bodies. This is the correct choice for logging all requests because it provides a complete record of who did what and when for security review, without capturing the sensitive contents that would be written to disk. It is the recommended level in the Kubernetes audit policy as the default catch-all, balancing security, compliance, and data minimization.

Why this answer

The Metadata audit level logs request metadata (who, when, what resource, verb, etc.) but not the request or response body. This is exactly what is needed to log all requests at the Metadata level for a specific namespace. The other levels either log too much (Request, RequestResponse) or nothing (None).

Exam trap

CKS often tests the distinction between audit levels, and candidates may confuse 'Request' with 'Metadata' because both log requests, but only Metadata omits the request body.

How to eliminate wrong answers

Option A (Request) is wrong because it logs the request body in addition to metadata, which exceeds the requirement to log only at the Metadata level. Option B (None) is wrong because it disables audit logging entirely for the specified resources, providing no audit trail. Option C (RequestResponse) is wrong because it logs both the request and response bodies, which is more verbose than Metadata and not required here.

37
MCQeasy

Which Kubernetes resource is used to define audit logging configuration?

A.A YAML file specified via `--audit-policy-file`
B.PodSecurityPolicy
C.ConfigMap in kube-system
D.AuditPolicy CRD
AnswerA

The kube-apiserver's audit logging behavior is governed by a YAML policy file located on the apiserver's host filesystem, whose path is passed via the `--audit-policy-file` startup flag. This file is not a Kubernetes API resource; it is a plain configuration file containing a set of rules that map requested attributes (verbs, resources, namespaces, users) to audit levels: None, Metadata, Request, or RequestResponse. The apiserver reads this file at initialization and applies it to all incoming API requests, so changing the policy requires editing the file and restarting the apiserver.

Why this answer

Kubernetes audit logging configuration is defined in a YAML file that specifies the audit policy rules, and this file is passed to the kube-apiserver via the `--audit-policy-file` command-line flag. This YAML file defines which events (e.g., requests to the API server) should be logged and at what level (e.g., Metadata, Request, RequestResponse). No other Kubernetes resource or CRD is used for this purpose.

Exam trap

The trap here is that candidates confuse the audit policy configuration mechanism (a static YAML file passed via `--audit-policy-file`) with a Kubernetes resource like a ConfigMap or CRD, because many other Kubernetes configurations (e.g., kubelet config, scheduler policies) are indeed stored in ConfigMaps or custom resources.

How to eliminate wrong answers

Option B is wrong because PodSecurityPolicy (deprecated in Kubernetes 1.21 and removed in 1.25) is a cluster-level resource that controls security-sensitive aspects of pod specification (e.g., privilege escalation, host namespaces), not audit logging configuration. Option C is wrong because a ConfigMap in kube-system is a generic resource for storing configuration data (e.g., environment variables, small files) and is not the mechanism for defining audit logging policies; while a ConfigMap could theoretically hold the audit policy content, the kube-apiserver does not read audit policy from a ConfigMap—it must be a file on disk referenced by `--audit-policy-file`. Option D is wrong because there is no standard Kubernetes CRD named 'AuditPolicy'; audit logging is configured via a static YAML file, not a custom resource definition.

38
MCQhard

An incident responder needs to isolate a compromised pod immediately without deleting it. Which action should they take?

A.Modify the pod's labels to prevent it from receiving traffic
B.Delete the pod to stop its activity
C.Apply a NetworkPolicy that denies all traffic to and from the pod's labels
D.Scale down the deployment to zero replicas
AnswerC

Applying a NetworkPolicy that selects the compromised pod's labels and declares policyTypes: [Ingress, Egress] with no ingress or egress rules establishes an immediate default-deny boundary. The CNI enforces this at the data path, blocking all existing and new connections while leaving the pod and its logs, memory, and filesystem untouched for forensic analysis. This is the correct incident response because it contains the blast radius without destroying evidence.

Why this answer

Applying a NetworkPolicy that denies all ingress and egress traffic to the pod's labels is the correct isolation action because it preserves the pod for forensic analysis while cutting off all network communication. Kubernetes NetworkPolicy operates at the pod-selector level, so a default-deny policy targeting the compromised pod's labels immediately blocks both inbound and outbound traffic without touching the pod's lifecycle. This satisfies the incident responder's requirement to isolate without deleting, keeping volatile memory and container state intact for investigation.

Exam trap

CKS often tests the distinction between 'isolate' and 'delete' — candidates instinctively pick deletion or label changes as the fastest containment, missing that NetworkPolicy default-deny is the only option that preserves the pod for forensics while cutting all traffic.

How to eliminate wrong answers

Option A is wrong because modifying labels only affects which services or selectors match the pod; it does not stop existing connections or prevent the pod from initiating outbound traffic, and it may break forensic tooling that relies on labels. Option B is wrong because deleting the pod destroys volatile evidence (memory, running processes, network connections) and violates the explicit requirement to isolate without deleting; the ReplicaSet would also recreate it. Option D is wrong because scaling the deployment to zero deletes all pods including the compromised one, again destroying evidence and affecting other replicas rather than isolating a single pod.

39
Multi-Selecthard

Which THREE Falco priority levels sequences are correctly ordered from lowest to highest severity? (Choose three)

Select 3 answers
A.WARNING, ERROR, CRITICAL, ALERT, EMERGENCY
B.DEBUG, INFORMATIONAL, NOTICE, WARNING
C.INFORMATIONAL, NOTICE, DEBUG, WARNING
D.ALERT, CRITICAL, ERROR, WARNING
E.NOTICE, WARNING, ERROR, CRITICAL
AnswersA, B, E

This sequence starts at WARNING and moves through ERROR, CRITICAL, ALERT, and EMERGENCY, which exactly matches Falco's ascending severity ranking for those levels. Each step denotes a progressively more serious security event, from a notable anomaly to a system-wide emergency requiring immediate response.

Why this answer

Options A, B, and E are correctly ordered from lowest to highest severity according to Falco's priority levels, which follow the standard syslog severity ordering (RFC 5424). Option A: WARNING, ERROR, CRITICAL, ALERT, EMERGENCY is correct. Option B: DEBUG, INFORMATIONAL, NOTICE, WARNING is correct.

Option E: NOTICE, WARNING, ERROR, CRITICAL is correct. Options C and D are incorrectly ordered (C has DEBUG after NOTICE, and D starts with ALERT which is higher than ERROR).

Exam trap

The question asks to choose three correct sequences; all three (A, B, E) are valid. Some candidates may mistakenly think that only two are correct due to the ordering complexities, but all three follow the correct ascending severity order.

40
MCQeasy

Falco detects a shell being opened inside a container. Which Falco rule field is used to specify the syscall condition for detection?

A.condition
B.priority
C.output
D.rule
AnswerA

The `condition` field in a Falco rule is the mandatory boolean filter expression that actually defines which events trigger the rule. For shell detection, it combines syscalls such as `evt.type=execve` with process and container fields (e.g., `proc.name in (bash, sh)` and `container.id != host`) to match a shell being opened inside a container. No other rule field performs event matching, so this is the correct place to encode the detection logic.

Why this answer

In Falco, the `condition` field within a rule defines the specific syscall or event filter that triggers the rule. For detecting a shell being opened inside a container, the condition would include a syscall like `execve` or `clone` combined with container context filters such as `container.id != host`. This field is where you specify the exact syscall and its parameters (e.g., `evt.type=execve and proc.name in (bash, sh, zsh)`), making it the correct answer.

Exam trap

The CKS exam often tests the distinction between the `condition` field (which holds the detection logic) and the `rule` field (which is just a label), causing candidates to confuse the rule name with the filtering criteria.

How to eliminate wrong answers

Option B is wrong because `priority` is used to set the severity level of the rule (e.g., CRITICAL, WARNING) and does not define the syscall condition. Option C is wrong because `output` specifies the formatted alert message or action (e.g., stdout, syslog) when the rule triggers, not the detection logic. Option D is wrong because `rule` is the name or identifier of the Falco rule (e.g., 'Terminal shell in container'), not the field containing the syscall condition.

41
MCQhard

An administrator wants to set an immutable root filesystem for a container in a Pod. Which securityContext field should be set to true?

A.allowPrivilegeEscalation
B.readOnlyRootFilesystem
C.runAsNonRoot
D.privileged
AnswerB

Setting readOnlyRootFilesystem to true mounts the container's root filesystem as read-only, so any attempt by the container process to write, create, or delete files in / fails. This makes the root filesystem effectively immutable from the container's perspective because all write operations are blocked at the mount layer. Note that volumes can still be mounted writable, so immutability applies only to the root filesystem itself, not to data volumes.

Why this answer

The readOnlyRootFilesystem field, when set to true in a container's securityContext, mounts the container's root filesystem as read-only. This prevents any process inside the container from writing to the root filesystem, which is a key security hardening measure to prevent runtime modifications, such as an attacker downloading tools or modifying binaries. It directly addresses the requirement for an immutable root filesystem.

Exam trap

CKS often tests the confusion between readOnlyRootFilesystem and other securityContext fields like allowPrivilegeEscalation or runAsNonRoot, where candidates might incorrectly associate privilege escalation or user ID with filesystem immutability.

How to eliminate wrong answers

Option A is wrong because allowPrivilegeEscalation controls whether a process can gain more privileges than its parent (e.g., via setuid or setgid binaries), not filesystem immutability. Option C is wrong because runAsNonRoot ensures the container runs as a non-root user, which is unrelated to making the root filesystem read-only. Option D is wrong because privileged grants the container almost all capabilities of the host, effectively disabling isolation, and does not set the root filesystem to read-only.

42
MCQmedium

You need to configure a Kubernetes Pod to have an immutable root filesystem. Which field should you set in the Pod spec?

A.spec.hostPID: true
B.securityContext.allowPrivilegeEscalation: false
C.securityContext.runAsUser: 1000
D.securityContext.readOnlyRootFilesystem: true
AnswerD

securityContext.readOnlyRootFilesystem: true mounts the container's root filesystem with read-only permissions, so any process inside the container cannot write to the root filesystem at all. This directly enforces immutability of the core container filesystem, which is exactly what this question requires. Note that ephemeral volumes like emptyDir can still be mounted to provide writable directories, so the setting is compatible with workloads that need temporary storage.

Why this answer

Setting `securityContext.readOnlyRootFilesystem: true` in the container's security context makes the container's root filesystem read-only, preventing the container from writing to its own filesystem unless explicitly allowed (e.g., via volume mounts). Option A (`spec.hostPID`) shares the host's PID namespace, not relevant. Option B (`allowPrivilegeEscalation`) controls whether a process can gain more privileges than its parent, not filesystem immutability.

Option C (`runAsUser`) sets the user ID for the container, not filesystem permissions. Thus, only D achieves an immutable root filesystem.

43
MCQmedium

A developer reports that a pod cannot reach an external database at 192.168.1.100:3306. The pod's namespace is 'app'. You need to create a NetworkPolicy that allows egress to that IP only. Which policy is correct?

A.apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-egress namespace: app spec: podSelector: {} egress: - to: - ipBlock: cidr: 192.168.1.100/32 policyTypes: - Egress
B.apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-egress namespace: app spec: podSelector: matchLabels: app: myapp egress: - to: - ipBlock: cidr: 192.168.1.100/32 policyTypes: - Egress
C.apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-egress namespace: app spec: podSelector: {} ingress: - from: - ipBlock: cidr: 192.168.1.100/32 policyTypes: - Ingress
D.apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-egress namespace: app spec: podSelector: {} egress: - to: - ipBlock: cidr: 192.168.1.100/32 ports: - port: 3306 protocol: TCP policyTypes: - Egress
AnswerD

This policy selects all pods in the namespace via podSelector: {} and permits egress traffic specifically to the database IP on TCP port 3306, which is the MySQL port mentioned in the scenario. By including both the destination IP and the exact port, it follows least privilege and directly restores the pod's ability to reach the external data source while blocking other outbound traffic.

Why this answer

The correct NetworkPolicy must allow egress traffic from pods in the 'app' namespace to the specific IP 192.168.1.100 on port 3306. Option D meets this requirement by using 'podSelector: {}' to apply to all pods, specifying an egress rule to the ipBlock with the correct CIDR and port 3306, and setting 'policyTypes: [Egress]'. Option A is missing the port specification, so it would allow egress to the IP on any port, which is too permissive.

Option B uses 'matchLabels: app: myapp', restricting the policy to pods with that label, and also lacks the port. Option C defines an ingress rule instead of egress, which does not address the egress requirement.

44
MCQeasy

You need to enable audit logging for the Kubernetes API server to capture all requests at the RequestResponse level. Which flag should you add to the kube-apiserver configuration?

A.--audit-webhook-config-file=/etc/kubernetes/audit-webhook.yaml
B.--audit-policy-file=/etc/kubernetes/audit-policy.yaml
C.--audit-log-path=/var/log/audit.log
D.--authorization-mode=RBAC
AnswerB

This is the correct flag because it supplies the audit policy YAML that filters and selects which user requests, stages, and response levels are logged by the kube-apiserver. The policy file contains rules with verbs, resources, and audit levels, and it is the mandatory component to enable any audit logging. All other flags, such as log or webhook backends, are secondary and depend on this policy being present.

Why this answer

The --audit-policy-file flag points the kube-apiserver to the YAML file that defines audit levels (None, Metadata, Request, RequestResponse) and rules for which requests to log. To capture requests at the RequestResponse level, you must define that level in the audit policy file and pass it via this flag. Without this flag, the API server has no audit policy and will not produce audit events.

Exam trap

CKS often tests the distinction between the audit policy file (which defines what and at what level to log) and the audit backend flags (which define where logs go), so candidates who confuse --audit-policy-file with --audit-log-path or --audit-webhook-config-file pick the wrong answer.

How to eliminate wrong answers

Option A is wrong because --audit-webhook-config-file only configures the webhook backend that receives audit events; it does not define what to log or at what level. Option C is wrong because --audit-log-path only sets the destination file for the log backend; it does not specify the audit level or rules. Option D is wrong because --authorization-mode controls RBAC/ABAC/Node authorization, not audit logging at all.

45
MCQeasy

You want to run crictl to list all running containers on a node. Which command should you execute?

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

crictl ps is the correct CRI-compatible command to list running containers on a node. By default it shows only currently running containers, mirroring docker ps, and with -a it includes exited ones. It retrieves the container list from the CRI runtime socket (e.g., containerd, CRI-O) and displays fields such as container ID, image, created time, and status.

Why this answer

The crictl ps command lists running containers on a node by querying the CRI-compatible container runtime (containerd or CRI-O). It is the direct equivalent of 'docker ps' in the CRI world and is the correct command to enumerate running containers.

Exam trap

CKS often tests the confusion between crictl subcommands — candidates who pick crictl pods or crictl images forget that ps is the container-listing command, while pods lists sandboxes and images lists image layers.

How to eliminate wrong answers

Option B is wrong because crictl stats reports resource usage (CPU, memory) for containers, not a list of running containers. Option C is wrong because crictl images lists container images present on the node, not running containers. Option D is wrong because crictl pods lists pods (sandboxes) rather than the individual containers inside them — it answers a different question.

46
MCQmedium

You are investigating a compromised pod. You suspect the attacker used 'kubectl exec' to gain shell access. Which command can you use to check the audit logs for exec events?

A.kubectl exec -it pod-name -- cat /var/log/audit/audit.log
B.kubectl get events
C.kubectl logs --audit
D.kubectl describe pod pod-name
AnswerB

Incorrect: kubectl get events shows Kubernetes Event objects, not API server audit logs, and does not display exec audit entries.

Why this answer

None of the listed commands can be used to check Kubernetes audit logs for exec events. Kubernetes audit logs are stored on control plane nodes, commonly at /var/log/kubernetes/audit/audit.log or in the configured audit backend, and are not exposed via 'kubectl get events', 'kubectl logs --audit', or 'kubectl describe pod'. 'kubectl exec' runs inside a container and cannot read control-plane audit files unless a hostPath mount is explicitly configured. To inspect exec audit events, access the control plane and use host-level tools such as 'grep exec /var/log/kubernetes/audit/audit.log' according to your audit log configuration.

47
MCQeasy

Which stage of the Kubernetes API request processing should be audited to capture the final response sent to the client?

A.ResponseStarted
B.Panic
C.ResponseComplete
D.RequestReceived
AnswerC

ResponseComplete is emitted only after the entire HTTP response has been sent to the client, meaning the audit event now carries the final status code, response size, and all processing results. This is the stage at which every phase of request handling—authentication, authorization, admission, and execution—has finished, making it the correct stage for auditing the complete outcome of a request. Without waiting for this stage, an audit log could miss failures or side effects that occur after the initial response begins.

Why this answer

The `ResponseComplete` stage in Kubernetes audit logging captures the moment when the complete HTTP response has been sent to the client. This stage includes the final response body, headers, and status code, providing a full record of what the client actually received. Auditing at this stage is essential for compliance and forensic analysis, as it logs the definitive outcome of the API request.

Exam trap

The CKS exam often tests the distinction between `ResponseStarted` and `ResponseComplete`, where candidates mistakenly choose `ResponseStarted` thinking it captures the response, but it only captures the start of the response transmission, not the final payload.

How to eliminate wrong answers

Option A is wrong because `ResponseStarted` captures the point when the response headers are sent but before the response body is fully transmitted, so it does not include the final response payload. Option B is wrong because `Panic` is a stage that logs when a panic occurs during request processing, not the normal completion of a response. Option D is wrong because `RequestReceived` logs the event when the request is first received by the API server, before any processing or response generation occurs.

48
MCQhard

A security team suspects a compromised pod is making unexpected outbound connections to an external IP. Which of the following is the BEST first step to investigate the network traffic from that pod?

A.Deploy Falco with a rule to detect outbound connections
B.Create a NetworkPolicy to deny all egress traffic
C.Run 'kubectl exec <pod> -- tcpdump -i eth0' to capture packets
D.Check the pod's logs using 'kubectl logs <pod>'
AnswerC

Running 'kubectl exec <pod> -- tcpdump -i eth0' is the correct immediate investigation step because it captures raw network packets directly from the pod's network interface, revealing destination IPs, ports, protocols, and payloads of ongoing communication. This live capture provides the forensic evidence needed to understand the attacker's command-and-control traffic or data exfiltration in real time. However, tcpdump must be installed in the container image and the container must have the necessary privileges, such as CAP_NET_RAW or root access, which may require using an ephemeral container if the tools are missing.

Why this answer

The best first step to investigate unexpected outbound connections from a pod is to capture live network traffic from within the pod using tcpdump. This provides immediate visibility into the actual packets being sent, including destination IPs, ports, and payloads, which is essential for confirming the compromise and identifying the external endpoint. Other options are either reactive (blocking) or less direct.

Exam trap

CKS often tests the difference between detection, mitigation, and investigation; candidates may choose Falco or NetworkPolicy as a first step, but the question asks for the best first step to investigate, which is traffic capture.

How to eliminate wrong answers

Option A is wrong because deploying Falco with a rule is a detection mechanism that may take time to set up and may not capture existing traffic; it is not the immediate first step for investigation. Option B is wrong because creating a NetworkPolicy to deny all egress traffic is a mitigation step that would stop the traffic but also destroy evidence and potentially disrupt the investigation; it is not an investigative first step. Option D is wrong because checking pod logs may not show network-level details and the compromised process may not log its outbound connections; logs are application-specific and may be insufficient.

49
MCQhard

You are writing a Falco rule to detect when a container tries to read the file `/etc/shadow`. Which condition in the Falco rule correctly matches this event?

A.container.name=shadow and evt.type=open
B.evt.type=read and fd.name=/etc/shadow
C.proc.name=cat and fd.name=/etc/shadow
D.evt.type=open and fd.name=/etc/shadow
AnswerD

The `open` syscall is the initial operation that must occur before any file content can be read or modified; when a process calls `open` on `/etc/shadow`, Falco's `fd.name` is populated directly from the path argument, making this condition both reliable and comprehensive. This rule detects any attempt to open the shadow file, regardless of the intended operation (read, write, or execute) and regardless of the process name or container name. It is the precise, minimal condition that catches unauthorized access to sensitive credential files, and it is the standard cornerstone for such Falco rules.

Why this answer

Falco rules use conditions that match system calls (evt.type) and file descriptors (fd.name). The event type 'open' is the syscall used to open a file for reading, and fd.name='/etc/shadow' specifies the target file. This combination correctly detects when a container attempts to open /etc/shadow, which is the typical first step before reading it.

Exam trap

The CKS exam often tests the misconception that 'evt.type=read' is the correct syscall for detecting file reads, but the trap is that 'read' operates on an already-opened file descriptor, while 'open' is the syscall that reveals the file path being accessed.

How to eliminate wrong answers

Option A is wrong because 'container.name=shadow' is not a valid field; Falco uses 'container.name' but the value 'shadow' is not a container name, and 'evt.type=open' alone is insufficient without specifying the file. Option B is wrong because 'evt.type=read' is the syscall for reading from an already-open file descriptor, but the initial detection of file access should target the 'open' syscall, and 'fd.name' is not directly available in a read event without prior open context. Option C is wrong because 'proc.name=cat' is too specific to the 'cat' command; the rule should detect any process attempting to read /etc/shadow, not just 'cat'.

50
MCQmedium

An administrator runs 'falco --list' and sees many default rules. What is the correct way to load a custom Falco rules file?

A.falco --load /path/to/rules.yaml
B.falco --rules /path/to/rules.yaml
C.falco -r /path/to/rules.yaml
D.falco --config /path/to/rules.yaml
AnswerC

This is the correct and dedicated Falco CLI flag for specifying one or more rules files (`-r /path/to/rules.yaml`). It tells Falco to load the provided YAML rule file in addition to or instead of the default rules, depending on how it is used. Running the command with `-r` will make Falco read the custom rules and apply them to the event stream.

Why this answer

The `-r` flag (short for `--rules`) is the standard Falco command-line option to specify a custom rules file. When you run `falco -r /path/to/rules.yaml`, Falco loads the rules from that YAML file instead of or in addition to the default rules. The `--list` flag shows all loaded rules, so using `-r` ensures your custom rules are included in that list.

Exam trap

The trap here is that candidates confuse `--rules` (which is not a valid flag) with `-r` (the correct short form), or they mistakenly think `--load` or `--config` are valid ways to load rules, when in fact `--config` is for the main Falco configuration file and `--load` does not exist.

How to eliminate wrong answers

Option A is wrong because `--load` is not a valid Falco flag; Falco does not support a `--load` option for rules files. Option B is wrong because `--rules` is the long form of `-r`, but the syntax `--rules /path/to/rules.yaml` is incorrect—the correct long form is `--rules-file /path/to/rules.yaml` (though `-r` is the standard short form). Option D is wrong because `--config` is used to specify the Falco configuration file (e.g., `falco.yaml`), not a rules file; rules and configuration are separate concerns.

51
MCQmedium

You are investigating a pod that may have been compromised. Which kubectl command allows you to run a shell inside the running container without overwriting the container's filesystem?

A.kubectl exec -it pod-name -- /bin/bash
B.kubectl debug pod-name --image=busybox
C.kubectl run -it --image=busybox sh
D.kubectl attach pod-name
AnswerA

kubectl exec -it pod-name -- /bin/bash starts a new process inside the already-running container, sharing its mount namespace, PID namespace, and network stack. This gives you direct access to the live filesystem, running processes, and environment variables exactly as they exist in the compromised pod, enabling immediate forensic evidence collection. This is the standard method for interactive shell access to an existing container and is the correct approach for investigating a compromise.

Why this answer

`kubectl exec -it pod-name -- /bin/bash` attaches an interactive shell to the running container without modifying its filesystem. This command uses the container runtime's exec facility to spawn a new process inside the existing container, leaving the container's root filesystem unchanged. It is the standard method for runtime investigation without altering the container's state.

Exam trap

The CKS exam often tests the distinction between `exec` (which runs inside the existing container) and `debug` (which creates a separate container), so the trap here is that candidates may choose `kubectl debug` thinking it provides a shell in the same container, but it actually creates a new container with its own filesystem, potentially overwriting evidence.

How to eliminate wrong answers

Option B is wrong because `kubectl debug pod-name --image=busybox` creates a new ephemeral container or debug pod that shares the target pod's namespaces, but it does not run a shell inside the original container; it runs a separate container with its own filesystem, which could overwrite or mask the original container's filesystem. Option C is wrong because `kubectl run -it --image=busybox sh` creates a completely new pod, not interacting with the existing pod's container, and thus does not allow investigation of the potentially compromised pod. Option D is wrong because `kubectl attach pod-name` attaches to the main process's stdin/stdout/stderr of the container, but it does not spawn a new shell; it only connects to the already-running process, which may not be a shell and cannot provide interactive investigation.

52
MCQeasy

Which kubectl command can be used to exec into a running container for forensic analysis during an incident response?

A.kubectl exec -it <pod> -- /bin/sh
B.kubectl run --stdin --tty --image=busybox
C.kubectl logs <pod>
D.kubectl attach <pod>
AnswerA

kubectl exec -it <pod> -- /bin/sh launches a new /bin/sh process inside the container's namespaces via the kubelet and container runtime. The -i flag keeps STDIN open, -t allocates a pseudo-TTY, and the command after -- is executed directly as a new process in the container. This is the canonical way to get an interactive shell in a running pod's primary container for debugging.

Why this answer

`kubectl exec -it <pod> -- /bin/sh` allows you to start an interactive shell session inside a running container, which is essential for live forensic analysis during incident response. This command uses the Kubernetes API to execute a process (e.g., /bin/sh) in the container's namespaces, enabling you to inspect running processes, file systems, network connections, and memory artifacts without stopping the container.

Exam trap

The trap here is that candidates confuse `kubectl exec` with `kubectl attach` or `kubectl run`, mistakenly thinking attach provides a shell or that run can target an existing container, when in fact only exec gives interactive command execution inside a running container for forensic purposes.

How to eliminate wrong answers

Option B is wrong because `kubectl run --stdin --tty --image=busybox` creates a new pod from the busybox image, not exec into an existing running container; this is used for ad-hoc debugging or testing, not for forensic analysis of a specific container under investigation. Option C is wrong because `kubectl logs <pod>` only retrieves the container's stdout/stderr logs, which may be useful for initial triage but does not provide interactive access to the container's runtime state, processes, or filesystem for deep forensic analysis. Option D is wrong because `kubectl attach <pod>` attaches to the container's main process (PID 1) and its stdio streams, but it does not allow you to execute arbitrary commands or spawn a shell; it is designed for interacting with the container's primary application, not for forensic investigation.

53
MCQmedium

You suspect a container has been compromised. You want to preserve the container's filesystem for forensic analysis before terminating the pod. Which approach should you use?

A.Exec into the container and delete suspicious files
B.Restart the kubelet on the node
C.Use kubectl cp to copy files from the container to a safe location
D.Immediately delete the pod to stop the attack
AnswerC

Using kubectl cp is correct because it reads the container's filesystem through the container runtime and produces a tar archive in a safe location without modifying the source files; the command uses tar and writes to stdout, so the container's storage layer is left untouched for subsequent analysis. This preserves evidence such as dropped payloads, shell history, modified binaries, and configuration files, and it can be performed quickly even while the container remains running. Be aware that kubectl cp does not capture memory or /proc, but for filesystem artifacts it is the advisable first step before any destructive containment.

Why this answer

Using kubectl cp to copy files from the container to a safe location preserves the container's filesystem for forensic analysis without altering the running container. This method allows you to extract files for offline analysis while keeping the container intact for further investigation.

Exam trap

CKS often tests the misconception that deleting the pod or restarting the kubelet is a quick fix, but it destroys evidence needed for forensic analysis.

How to eliminate wrong answers

Option A is wrong because deleting suspicious files destroys evidence and may alert the attacker. Option B is wrong because restarting the kubelet does not preserve the container's filesystem and may cause the container to restart, losing volatile data. Option D is wrong because deleting the pod immediately destroys the container and its filesystem, losing critical forensic evidence.

54
MCQmedium

Which crictl command is used to view the logs of a specific container in a node?

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

crictl logs <container-id> is the correct command because it directly retrieves the container's stdout/stderr streams through the CRI (Container Runtime Interface). It functions analogously to 'docker logs', letting you inspect application output for debugging or monitoring, and it reads from the runtime's buffer for the specified container.

Why this answer

The crictl logs command retrieves the logs of a specific container identified by its container ID, analogous to docker logs or kubectl logs. It queries the container runtime (via CRI) for the container's stdout/stderr output. This is the correct tool for inspecting logs directly on a node without going through the Kubernetes API.

Exam trap

The trap is confusing crictl subcommands — candidates may pick exec or ps thinking they retrieve logs, but only crictl logs returns container log output.

How to eliminate wrong answers

Option B is wrong because crictl exec -it <container-id> sh opens an interactive shell inside the container rather than displaying its logs. Option C is wrong because crictl pods lists pods known to the runtime, not container logs. Option D is wrong because crictl ps -a lists all containers including stopped ones, providing status information rather than log output.

55
MCQmedium

An audit policy is configured with level: Request. Which operations are recorded in the audit log?

A.Nothing, only the fact that a request occurred
B.Request metadata and the request body
C.Request and response metadata and bodies
D.Only metadata about the request
AnswerB

Request level is the correct configuration: it captures audit event metadata (e.g., user, source IP, verb, resource) and the complete request body. This gives deep visibility into exactly what the client sent, while intentionally omitting the response data to reduce storage and sensitive-data exposure. Because the question explicitly specifies level 'Request', this is precisely what gets logged.

Why this answer

When an audit policy is configured with `level: Request`, the API server logs the request metadata and the request body for all operations. This is defined in the Kubernetes audit policy specification, where the `Request` level captures the entire request object, including metadata and the body, but does not include the response. This level is useful for debugging and security analysis without the overhead of logging response data.

Exam trap

The CKS exam often tests the distinction between `Metadata`, `Request`, and `RequestResponse` levels, and the trap here is that candidates confuse `Request` with `Metadata`, thinking it only logs metadata, or mistakenly believe `Request` includes response data.

How to eliminate wrong answers

Option A is wrong because `level: Request` does record the request body and metadata, not just the fact that a request occurred (which would be `level: Metadata`). Option C is wrong because logging both request and response metadata and bodies corresponds to `level: RequestResponse`, not `Request`. Option D is wrong because logging only metadata about the request is the behavior of `level: Metadata`, which omits the request body.

56
MCQmedium

Which crictl command can you use to view the logs of a specific container?

A.crictl inspect <container-id>
B.crictl exec <container-id> cat /var/log/syslog
C.crictl ps
D.crictl logs <container-id>
AnswerD

This is the correct command. It fetches the log output of the specified container, capturing what the container wrote to stdout/stderr as captured by the container runtime (e.g., containerd). It works similarly to `docker logs` and is the standard way to view container logs in a CRI-compatible environment. The container ID can be obtained from `crictl ps`, and the command shows both historical and, with `-f`, live logs.

Why this answer

`crictl logs` is the dedicated command to retrieve and display the logs of a specific container managed by a CRI-compatible runtime (e.g., containerd, CRI-O). It works similarly to `docker logs` and reads the container's stdout/stderr streams, which are captured by the container runtime.

Exam trap

The CKS exam often tests the distinction between `crictl` and `docker` commands, and the trap here is that candidates might confuse `crictl inspect` (which shows metadata) with log retrieval, or assume `crictl exec` can read logs from a file inside the container, ignoring that container logs are streamed to stdout/stderr by default.

How to eliminate wrong answers

Option A is wrong because `crictl inspect` returns detailed configuration and state information about a container (e.g., mounts, environment variables, resource limits), not its log output. Option B is wrong because `crictl exec` runs a command inside a running container, but `/var/log/syslog` is not the standard location for container logs; container logs are captured via stdout/stderr, not written to syslog by default. Option C is wrong because `crictl ps` lists running containers with their IDs, names, and statuses, but does not display log content.

57
Multi-Selecthard

Which THREE of the following are recommended incident response steps when a container is compromised?

Select 3 answers
A.Ignore the incident and monitor for further activity
B.Copy the container's filesystem using kubectl cp for offline analysis
C.Capture the container logs using kubectl logs
D.Apply a NetworkPolicy to isolate the pod
E.Immediately terminate the pod to contain the threat
AnswersB, C, D

Using `kubectl cp` to copy the container’s filesystem is a forensically sound step because it preserves the writable layer, arbitrary files, and binaries without altering the running state. This offline copy lets you analyze the image, look for persistence mechanisms (e.g., cron jobs, backdoors), and inspect configuration files while the container remains responsive. Because `kubectl cp` reads the live filesystem, it is non-destructive and is a best practice before any termination decision. It also gives you a baseline for detecting changes if you later compare with the original image.

Why this answer

Option B is correct because copying the container's filesystem with kubectl cp preserves volatile evidence for offline forensic analysis before the container is destroyed or restarted. Option C is correct because kubectl logs captures the container's stdout/stderr output, which may contain indicators of compromise, attacker commands, or error traces useful for scoping the incident. Option D is correct because applying a NetworkPolicy to the pod isolates it from other workloads, limiting lateral movement and exfiltration while still keeping the container alive for investigation.

Option A is wrong because ignoring a compromise allows the attacker to persist and expand access. Option E is wrong because immediately terminating the pod destroys volatile evidence such as memory, running processes, and network connections, and may trigger automated redeployment that erases the compromised instance before it can be examined.

Exam trap

The trap is choosing to immediately terminate the pod as a containment step, but that destroys evidence; the correct approach is to isolate and preserve first.

58
MCQhard

During a security incident, you need to isolate a compromised pod named 'malicious-pod' in namespace 'default' to prevent it from communicating with other pods. Which command should you run?

A.kubectl run networkpolicy --image=nginx --restart=Never
B.kubectl delete pod malicious-pod
C.kubectl apply -f networkpolicy.yaml
D.kubectl create networkpolicy isolate --pod-selector=app=malicious --policy-types=Ingress,Egress
AnswerC

Applying a NetworkPolicy YAML is the correct method because this API resource is designed to select pods by label and restrict their ingress and egress traffic. A properly written manifest with a podSelector matching 'app=malicious' and policyTypes: [Ingress, Egress] but no ingress/egress rules creates a default-deny rule for that pod, blocking all inbound and outbound connections non-destructively. kubectl apply is also idempotent and the only reliable way to declare such a policy, since kubectl does not offer a native 'create networkpolicy' command.

Why this answer

Pod isolation is achieved by applying a NetworkPolicy that denies ingress/egress traffic. 'kubectl apply -f networkpolicy.yaml' applies the policy. The policy must be written to deny all traffic.

59
MCQmedium

A security admin needs to audit all API requests to the Kubernetes API server. Which audit policy level logs the request body and response body?

A.Request
B.None
C.RequestResponse
D.Metadata
AnswerC

RequestResponse records the full request and response bodies alongside metadata, satisfying the requirement to audit complete API request content. Lower levels such as Metadata or Request omit response bodies entirely, so they cannot capture the payloads the admin needs. This level therefore provides the body-level detail the stem explicitly demands.

Why this answer

The RequestResponse audit level logs the request body and response body, along with metadata. This is the most verbose audit level, capturing the full content of API requests and responses. It is used when complete visibility into API interactions is required, such as for deep security auditing or debugging.

However, it can generate large amounts of data and may expose sensitive information, so it should be used judiciously.

Exam trap

CKS often tests the distinction between audit levels, and candidates may confuse 'Request' with 'RequestResponse', forgetting that only the latter includes the response body.

How to eliminate wrong answers

Option A is wrong because the Request level logs only the request body and metadata, not the response body. Option B is wrong because the None level logs nothing; it is used to exclude events from auditing. Option D is wrong because the Metadata level logs only request metadata (such as user, timestamp, resource, verb) but not request or response bodies.

60
MCQmedium

A Falco rule is configured to detect privilege escalation via setuid binaries. Which syscall is commonly associated with this activity?

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

The setuid syscall is the kernel API that changes the process's effective (and optionally real) user ID, and it is the direct primitive used in a privilege-escalation attack when a process transitions from an unprivileged UID to a privileged one such as root. Because an exploit often invokes setuid (or one of its variants like seteuid) to permanently or temporarily raise privileges, Falco can catch credential-state changes by filtering on this syscall. In a Falco rule for privilege escalation, setuid is the semantically correct event to monitor, since it represents the moment of privilege elevation, not just a side effect.

Why this answer

The setuid syscall is used to change the effective user ID of a process, and it is the mechanism by which setuid binaries elevate privileges. Falco rules that detect privilege escalation via setuid binaries monitor this syscall (often combined with execve of a setuid binary) to flag unauthorized elevation attempts.

Exam trap

CKS often tests whether candidates confuse execve (program execution) with setuid (credential change) — privilege escalation via setuid binaries requires the setuid syscall, not just execve.

How to eliminate wrong answers

Option A is wrong because connect is a network syscall used to initiate outbound connections, unrelated to privilege escalation. Option C is wrong because open is a file-access syscall and does not change process credentials. Option D is wrong because execve executes a program but does not itself elevate privileges — it is the setuid bit plus the setuid syscall (or the kernel's handling of the setuid bit during execve) that grants elevation.

61
MCQmedium

You suspect a pod is making unexpected outbound connections. Which tool can you use to inspect network connections from within the container?

A.kubectl port-forward
B.crictl exec
C.falco
D.kubectl logs
AnswerB

crictl exec is the correct choice because it lets you run a command inside the container via the container runtime (containerd/CRI-O), such as `crictl exec -it <container-id> ss -tpn` or `netstat -an`, to inspect active TCP/UDP connections initiated by the container. Unlike `kubectl exec`, it works directly against the runtime, even if the Kubernetes API server is unreachable. This allows you to see the exact source, destination, and process for each outbound connection.

Why this answer

`crictl exec` allows you to run commands inside a container managed by CRI-compatible runtimes (like containerd), enabling you to inspect network connections from within the container using tools like `ss`, `netstat`, or `ip`. This is the direct method to check outbound connections from the container's network namespace, which is isolated from the host.

Exam trap

The trap here is that candidates may choose `kubectl logs` thinking it shows network activity, but logs only capture application output, not kernel-level connection states, while `crictl exec` provides direct access to the container's network namespace.

How to eliminate wrong answers

Option A is wrong because `kubectl port-forward` is used to forward local ports to a pod for debugging or accessing applications, not to inspect network connections from within the container. Option C is wrong because Falco is a runtime security tool that monitors system calls and detects anomalous behavior at the host level, but it does not provide an interactive shell to inspect connections from inside the container. Option D is wrong because `kubectl logs` retrieves container logs (stdout/stderr), which typically do not contain real-time network connection information unless the application explicitly logs them.

62
MCQeasy

An admin runs 'kubectl get pods' and sees a pod in 'CrashLoopBackOff' state. The pod's containers have a restart policy of 'Always'. What is the most likely cause?

A.The image pull secret is missing
B.The pod's resource requests exceed node capacity
C.The node is out of memory
D.The container's command fails immediately after start
AnswerD

If the container's main command exits with a non-zero code immediately after startup, the kubelet sees a stopped container and, with the default restartPolicy of Always, schedules another attempt. Each restart fails again, and the kubelet applies exponential backoff, eventually reporting CrashLoopBackOff. This is the exact scenario the exam question refers to: a successfully launched container that fails at runtime, not a scheduling or image-pull problem.

Why this answer

A CrashLoopBackOff state indicates that the container starts, fails, and is repeatedly restarted by kubelet due to the 'Always' restart policy. The most likely cause is that the container's command or entrypoint fails immediately after start (e.g., a non-zero exit code from a misconfigured binary or script), triggering the restart loop. Unlike resource or node-level issues, this is a container-level failure that produces the rapid restart pattern characteristic of CrashLoopBackOff.

Exam trap

Candidates often confuse CrashLoopBackOff (container starts but fails) with ImagePullBackOff (container never starts due to image issues), leading them to mistakenly select image-related options like missing pull secrets.

How to eliminate wrong answers

Option A is wrong because a missing image pull secret would cause an ImagePullBackOff state, not CrashLoopBackOff, as the container never starts. Option B is wrong because resource requests exceeding node capacity would prevent the pod from being scheduled (Pending state with insufficient resources), not cause a running container to crash. Option C is wrong because an out-of-memory node would lead to OOMKilled containers or pod eviction, but the pod would not enter CrashLoopBackOff; instead, it would show OOMKilled in the container status or be terminated by the kubelet.

63
MCQeasy

You suspect a container is running an unexpected process. Which crictl command can you use to list all running containers on the node?

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

crictl ps is correct because, like `docker ps`, it lists the currently running containers managed by the container runtime, showing the container ID, image, state, and name. Once you have the container ID from `crictl ps`, you can use `crictl inspect` or `crictl exec` to enumerate actual processes, making it the essential starting point for investigating a suspected unexpected process in a Kubernetes node's container.

Why this answer

The `crictl ps` command lists all running containers on a node by querying the CRI-compatible container runtime (containerd or CRI-O) through the Container Runtime Interface. It returns container ID, image, state, name, and pod association, making it the correct tool for identifying unexpected processes running inside containers on a Kubernetes node.

Exam trap

CKS often tests confusion between crictl subcommands — candidates must distinguish `ps` (running containers) from `pods` (sandboxes), `images` (image cache), and `stats` (resource metrics).

How to eliminate wrong answers

Option A is wrong because `crictl stats` reports live resource usage (CPU, memory, disk, network) for containers, not a listing of running containers. Option B is wrong because `crictl pods` lists pod sandboxes, not the individual containers running inside them. Option D is wrong because `crictl images` lists container images present on the node, not running container instances.

64
MCQhard

A Falco rule has the following condition: spawned_process and container and proc.name = bash and proc.pname != sshd. What does this rule detect?

A.Any process named bash on the host
B.A bash shell started in a container via SSH
C.An SSH connection to a container
D.A bash shell started in a container from a non-SSH parent process
AnswerD

The rule fires on process-spawn events inside containers where the executable is bash and the parent process name is not sshd. This matches interactive shells launched by kubectl exec, docker exec, or exploited entrypoints, satisfying the stem's condition that the parent process is anything other than sshd.

Why this answer

The Falco rule condition `spawned_process and container and proc.name = bash and proc.pname != sshd` specifically detects a bash shell process that is spawned inside a container, where the parent process is not sshd. This means the bash shell was started from a non-SSH parent process, such as a shell or an application, rather than via an SSH session. The rule excludes SSH-triggered bash shells by checking that the parent process name is not sshd.

Exam trap

The trap here is that candidates may misinterpret `proc.pname != sshd` as detecting SSH connections or SSH-triggered shells, when in fact it excludes them, and they may overlook the `container` condition, thinking the rule applies to host processes.

How to eliminate wrong answers

Option A is wrong because the rule includes the `container` condition, so it only detects processes running inside a container, not on the host. Option B is wrong because the rule explicitly checks `proc.pname != sshd`, which excludes bash shells started via SSH; thus, it detects bash shells that are NOT started via SSH. Option C is wrong because the rule detects a bash shell process, not an SSH connection; SSH connections are typically detected by rules monitoring network connections or sshd processes, not by a spawned_process and proc.name condition.

65
Multi-Selecthard

Which THREE of the following are common indicators of a container compromise that Falco can detect? (Select 3)

Select 3 answers
A.Unexpected outbound network connections
B.Reading sensitive files like /etc/shadow
C.High CPU usage
D.Spawning a shell inside a container
E.Pod restarting in a loop
AnswersA, B, D

Falco monitors the connect() syscall as applications initiate TCP or UDP outbound traffic, so an unexpected destination IP, port, or domain pattern for a given container image can signal data exfiltration or command-and-control activity. Unlike high-level metrics, this is a definitive, event-level behavioral indicator because it captures the exact moment a new network connection is established, and allows correlation with process context.

Why this answer

Falco is a runtime security tool that monitors system calls and container behavior. Unexpected outbound network connections are a classic indicator of compromise, such as a reverse shell or data exfiltration, and Falco can detect these by monitoring syscalls like `connect()` and `sendto()` against a rule set that flags connections to suspicious destinations or on unusual ports.

Exam trap

The CKS exam often tests the distinction between runtime security monitoring (syscall-based) and cluster-level or resource-level metrics, so the trap here is confusing operational issues like pod restarts or high CPU with actual security events that Falco is designed to detect.

66
MCQhard

A pod is stuck in Pending state. You run 'kubectl describe pod' and see the event: '0/3 nodes are available: 3 Insufficient cpu'. What is the likely cause?

A.The pod's image pull policy is set to Always and the registry is unreachable
B.The pod's CPU request exceeds the available CPU capacity on all nodes
C.The cluster has a taint that the pod does not tolerate
D.The scheduler is misconfigured and not running
AnswerB

The scheduler computes the sum of CPU requests for existing pods and compares it against each node's allocatable CPU capacity. If the requested CPU for this pod is greater than any node's available (allocatable minus already requested) CPU, the scheduler emits a FailedScheduling event with 'Insufficient cpu' and lists the nodes that could not fit. As a result, the pod remains Pending until a node's resources change or the request is reduced. This is exactly the situation indicated by an Insufficient cpu event.

Why this answer

The event '0/3 nodes are available: 3 Insufficient cpu' directly indicates that the scheduler attempted to place the pod on each of the three nodes but found that none had enough allocatable CPU to satisfy the pod's CPU request. This means the sum of CPU requests across all pods on each node, plus the new pod's request, exceeds the node's capacity. The pod remains in Pending state because no node can accommodate its resource requirements.

Exam trap

In the CKS exam, you must carefully read the event message to distinguish between resource insufficiency (Insufficient cpu) and other scheduling issues like taints/tolerations or node selectors.

How to eliminate wrong answers

Option A is wrong because an unreachable registry would cause ImagePullBackOff or ErrImagePull events, not 'Insufficient cpu' — the scheduler does not check image availability before scheduling. Option C is wrong because taint/toleration mismatches produce events like '0/3 nodes are available: 3 node(s) had taint {key:value}, that the pod didn't tolerate', not a CPU insufficiency message. Option D is wrong because if the scheduler were misconfigured or not running, the pod would remain in Pending state without any scheduling events at all, or you would see 'no matching node' errors, not a specific resource insufficiency message.

67
MCQeasy

You have deployed a pod and set `securityContext.readOnlyRootFilesystem: true`. The pod is failing to start with an error about writing to `/tmp`. What is the most likely cause?

A.The `securityContext` is misspelled
B.The pod is missing an emptyDir volume mounted at `/tmp`
C.The container image does not have `/tmp` directory
D.The container is running as a non-root user
AnswerB

The correct fix is to create a dedicated emptyDir volume and mount it at /tmp. When readOnlyRootFilesystem is true, the container's root filesystem is mounted with the MS_RDONLY flag, so every write attempt to any path on that filesystem returns EROFS — regardless of permissions. An emptyDir volume provides a separate, writable filesystem (initially empty, typically backed by the node's disk or tmpfs) that can be mounted exactly where the application expects to write temporary data, allowing the container to work while preserving the immutability of the root filesystem.

Why this answer

When `securityContext.readOnlyRootFilesystem: true` is set, the container's root filesystem becomes read-only. Many applications, including those that write temporary files, expect to write to `/tmp`. Without a writable volume mounted at `/tmp`, the container fails to start because it cannot write to that directory.

Mounting an `emptyDir` volume at `/tmp` provides a writable location that is ephemeral and tied to the pod's lifecycle, resolving the issue.

Exam trap

The exam often tests the misconception that a read-only root filesystem prevents all writes, but candidates may overlook the need for an explicit writable volume mount like emptyDir for directories such as /tmp that applications expect to be writable.

How to eliminate wrong answers

Option A is wrong because `securityContext` is a valid Kubernetes field and is not misspelled; the error is about filesystem permissions, not a syntax issue. Option C is wrong because the container image does have a `/tmp` directory (it is part of the Linux filesystem hierarchy), but it is read-only due to the security context. Option D is wrong because running as a non-root user does not prevent writing to `/tmp` if the directory is writable; the problem is the read-only root filesystem, not the user ID.

68
MCQmedium

A security team wants to detect any attempt to spawn an interactive shell inside a container. Which Falco rule condition would be appropriate?

A.container.id != host and evt.type = read and fd.name = /etc/shadow
B.evt.type = connect and container.id != host
C.proc.name = bash and evt.type = execve
D.container.id != host and evt.type = execve and proc.name = bash
AnswerD

This is the exact Falco rule needed: it combines the execve syscall (new process execution), proc.name = bash (the shell binary), and container.id != host (restricting to container events). The combination logically isolates the moment a bash shell is spawned from inside a container while excluding host-level bash runs, giving a high-fidelity signal for interactive shell activity. Because it checks the syscall that actually creates the process, it correctly captures shell starts rather than related but distinct activities like file reads or network connections.

Why this answer

Falco uses syscall events. The condition container.id != host and evt.type = execve and proc.name = bash detects a bash exec in a container, which is a common interactive shell.

69
Multi-Selecthard

Which THREE of the following are effective methods to preserve evidence during a container security incident?

Select 3 answers
A.Delete the pod immediately
B.Take a memory dump of the container
C.Run kubectl exec to explore and modify files
D.Create a forensic snapshot of the container filesystem
E.Capture container logs
AnswersB, D, E

Taking a memory dump preserves the ephemeral volatile data that exists only inside the running container's user-space processes and its shared host kernel view. Tools like `gcore` on the container PID, or CRIU-based dump, capture open file descriptors, decrypted secrets, injected shellcode, and active network socket states that vanish when the container stops. This is critical for detecting in-memory-only attacks (e.g., process hollowing) that leave no disk footprint, and it should be performed before the container is terminated or filesystem is altered.

Why this answer

Taking a memory dump of the container captures volatile data (processes, network connections, encryption keys) that is lost when the container stops. This preserves runtime evidence critical for forensic analysis, as memory artifacts are not persisted to disk and must be collected before the container is terminated.

Exam trap

A common trap is confusing incident response containment (which may require isolating the pod via network policies or cordoning the node) with evidence preservation (which requires capturing data before deletion). Immediate pod deletion destroys evidence and should be avoided until forensic data is collected.

70
MCQmedium

An administrator runs 'crictl ps' and sees no containers listed, but kubectl shows running pods. What is the most likely cause?

A.crictl is not configured to connect to the correct container runtime socket
B.The images have not been pulled yet
C.The containers are running in a different namespace
D.The kubelet is not running
AnswerA

crictl is a CLI that communicates with a CRI-compliant runtime via a gRPC endpoint, and it must be told where that runtime's socket lives via the --runtime-endpoint flag or a configuration file such as /etc/crictl.yaml. If it points to a default or stale socket (for example /var/run/dockershim.sock instead of /run/containerd/containerd.sock), it will not see the containers managed by the actual containerd or CRI-O runtime. Even though pods are running, a misconfigured runtime endpoint commonly produces a misleading empty list or a connection error, so this is the correct explanation.

Why this answer

The most likely cause is that crictl is not configured to connect to the correct container runtime socket. crictl is a command-line tool for interacting with CRI-compatible container runtimes. If it is not pointed to the correct socket (e.g., /var/run/containerd/containerd.sock or /var/run/crio/crio.sock), it will not see any containers, even though kubectl (which communicates with the kubelet) shows running pods. This is a common misconfiguration when multiple runtimes are installed or when the default socket path differs.

Exam trap

CKS often tests the distinction between kubectl and crictl; candidates might think crictl is namespace-aware or that it relies on the kubelet, but it directly queries the container runtime, so socket misconfiguration is a common trap.

How to eliminate wrong answers

Option B is wrong because if images have not been pulled, the containers would not be running, and kubectl would not show running pods. Option C is wrong because crictl operates at the node level and is not namespace-aware in the Kubernetes sense; it lists all containers regardless of Kubernetes namespaces. Option D is wrong because if the kubelet were not running, kubectl would not show running pods (assuming kubectl is communicating with the cluster and the node is not ready).

71
MCQeasy

Which audit stage is logged after the request is fully processed and the response is sent?

A.Panic
B.ResponseComplete
C.ResponseStarted
D.RequestReceived
AnswerB

ResponseComplete is emitted after the API server has sent the entire HTTP response, including the body, to the client. This stage means all processing phases — authentication, authorization, admission, and any mutation or storage operations — have finished and the complete response payload has been transmitted. It is the definitive final audit stage for a fully processed request, making it the correct answer.

Why this answer

The ResponseComplete audit stage is logged after the request is fully processed and the response is sent. It includes the final status and any response data. This stage is the last in the audit logging sequence, following RequestReceived, ResponseStarted, and Panic (if applicable).

Exam trap

CKS often tests the order of audit stages, confusing ResponseStarted with ResponseComplete, leading candidates to pick the wrong stage for after response is sent.

How to eliminate wrong answers

Option A is wrong because Panic is logged when a panic occurs during request processing, not after the response is sent. Option C is wrong because ResponseStarted is logged when the response headers are sent but before the response body is fully sent. Option D is wrong because RequestReceived is logged when the request is first received, before processing.

72
MCQmedium

You need to detect any attempt to run a shell inside a container using Falco. Which macro or condition should you use?

A.evt.type=read and fd.name=/etc/passwd
B.evt.type=execve and proc.name in (bash, sh)
C.evt.type=clone and proc.name=bash
D.evt.type=open and fd.name=/bin/bash
AnswerB

This rule is correct because 'execve' is the fundamental Linux syscall that executes a new program by replacing the caller's memory image. In Falco, for an 'execve' event, 'proc.name' is the basename of the new executable, so filtering for 'bash' or 'sh' directly matches the execution of those shell binaries. This aligns exactly with the intended goal of detecting an attempt to run a shell, and it intentionally ignores file access and process creation events that do not themselves indicate shell execution.

Why this answer

Detecting a shell inside a container requires monitoring the execution of shell binaries. Falco's `evt.type=execve` captures process execution events, and `proc.name in (bash, sh)` filters for common shell programs. This combination directly identifies when a shell process is started, which is a strong indicator of interactive access or potential compromise.

Exam trap

The CKS exam often tests the distinction between file access events (open, read) and process execution events (execve), leading candidates to pick options that detect file operations on shell binaries or configuration files instead of actual shell execution.

How to eliminate wrong answers

Option A is wrong because reading `/etc/passwd` is a file access event, not a shell execution; it could indicate reconnaissance but not a shell itself. Option C is wrong because `clone` is the syscall for creating processes or threads, but `proc.name=bash` would match only if the parent process is named bash, not the spawned shell; also, `clone` is too broad and not specific to shell execution. Option D is wrong because opening the `/bin/bash` binary file is a file open event, not execution; it could happen during file copying or inspection without actually running a shell.

73
MCQmedium

A pod is running in the 'default' namespace with a container that has an immutable root filesystem (readOnlyRootFilesystem: true). The application writes logs to /var/log/app.log. What will happen?

A.The container will be automatically restarted by the kubelet
B.The write succeeds because logs are written to a temporary filesystem
C.The write to /var/log/app.log fails, and the container may crash or log an error
D.Kubernetes will create an emptyDir volume to hold the logs
AnswerC

With readOnlyRootFilesystem: true, any write to a path outside a mounted writable volume returns EROFS (read-only file system). Since /var/log/app.log is inside the container's root filesystem and no volume is mounted at /var/log, the application cannot create or append to that file. The application may catch the error and continue, log to stderr, or exit if log failure is fatal, which would cause the container to crash or be marked as failed.

Why this answer

When a container is configured with `readOnlyRootFilesystem: true`, its entire root filesystem is mounted as read-only. Since `/var/log/app.log` resides within the root filesystem, any attempt to write to it will fail with a permission error. This can cause the application to crash or log an error, depending on how the application handles write failures.

Exam trap

The CKS exam often tests the misconception that Kubernetes automatically handles logging by providing writable space, but in reality, the user must explicitly mount a writable volume when using a read-only root filesystem.

How to eliminate wrong answers

Option A is wrong because the kubelet does not automatically restart a container solely due to a write failure on a read-only filesystem; restarts only occur if the container exits with a non-zero exit code or fails a liveness probe. Option B is wrong because there is no temporary filesystem mounted at `/var/log` by default; the write goes directly to the read-only root filesystem and fails. Option D is wrong because Kubernetes does not automatically create an emptyDir volume to hold logs; the user must explicitly define an emptyDir volume and mount it at the desired path.

74
MCQeasy

Which audit policy level logs all requests and responses, including the request body and response body?

A.None
B.Request
C.Metadata
D.RequestResponse
AnswerD

The `RequestResponse` audit level logs the request metadata, the request body, and the response body for matching requests, providing a complete record of the API interaction. This is the only level that enables full reconstruction of what was sent and what the API server returned, including the exact object created, updated, or returned in error. Because it includes potentially sensitive data from both sides, it should be applied selectively (e.g., to Secrets or `exec` endpoints) and is the most resource-intensive level in terms of storage and performance.

Why this answer

RequestResponse logs both the request object and the response object, including bodies. Request logs only the request object. Metadata logs only metadata.

None logs nothing.

75
Multi-Selectmedium

Which TWO of the following are valid audit policy levels in Kubernetes? (Choose two.)

Select 2 answers
A.RequestResponse
B.Verbose
C.Response
D.All
E.Metadata
AnswersA, E

RequestResponse is a valid audit level that captures the full request and response objects, including the body content, in addition to all metadata. It is one of the four levels defined by Kubernetes (None, Metadata, Request, RequestResponse) and is the most verbose level available. This level is useful for deep debugging but can produce a large volume of logs, so it should be used selectively.

Why this answer

In Kubernetes audit policy, the valid audit levels are None, Metadata, Request, and RequestResponse, so option A (RequestResponse) is correct because it logs the request metadata and body plus the response metadata and body, providing the most complete audit record. Option E (Metadata) is also correct because it logs only the request metadata (such as the user, timestamp, resource, and verb) without request or response bodies, which is one of the officially supported audit levels. The unmarked options do not belong: Verbose is not a Kubernetes audit level, Response is not a standalone audit level (response logging is part of RequestResponse), and All is not a valid audit policy level in Kubernetes.

Exam trap

The trap here is confusing audit policy levels with general logging verbosity terms like 'Verbose' or 'All', or assuming 'Response' is a standalone level when the actual level is RequestResponse.

Page 1 of 2 · 133 questions totalNext →

Ready to test yourself?

Try a timed practice session using only Cks Monitoring Runtime questions.