Courseiva

CCNA Cks Monitoring Runtime Questions

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

76
MCQmedium

You run 'crictl ps' and see a container with state CONTAINER_RUNNING. What does this indicate?

A.The container has exited
B.The container is paused
C.The container is starting up
D.The container is running normally
AnswerD

CONTAINER_RUNNING is the state crictl reports for a container whose process is active and healthy, matching the stem's observation directly. Unlike CONTAINER_EXITED or CONTAINER_CREATED, it confirms the container runtime has started the workload and it has not terminated, so the container is operating normally.

Why this answer

In crictl, the state CONTAINER_RUNNING indicates that the container's processes are actively executing and the container is in a normal operational state. This corresponds to the container runtime (e.g., containerd) reporting the container as fully started and not in any transitional or halted state.

Exam trap

The trap here is that candidates may confuse CONTAINER_RUNNING with a container that is 'healthy' or 'ready', but crictl only reflects the runtime state, not application health or readiness checks.

How to eliminate wrong answers

Option A is wrong because CONTAINER_RUNNING explicitly means the container has not exited; an exited container would show state CONTAINER_EXITED. Option B is wrong because a paused container would show state CONTAINER_PAUSED, not CONTAINER_RUNNING. Option C is wrong because a container that is starting up would show state CONTAINER_CREATED or CONTAINER_WAITING, not CONTAINER_RUNNING.

77
Multi-Selecthard

Which THREE of the following are required components to enable audit logging in Kubernetes? (Select three.)

Select 3 answers
A.The --audit-policy-file flag on kube-apiserver
B.The --audit-log-path flag on kube-apiserver
C.An audit policy YAML file
D.The --audit-dynamic-configuration flag
E.An audit webhook backend
AnswersA, B, C

The --audit-policy-file flag tells kube-apiserver where to find the audit policy defining which events to record and at what level. Without it, the API server has no ruleset, so no audit events are generated regardless of any log destination configured.

Why this answer

Option A is correct because the kube-apiserver must be started with the --audit-policy-file flag pointing to the audit policy file; without this flag the API server has no policy to apply and audit logging cannot be enabled. Option B is correct because --audit-log-path tells the kube-apiserver where to write the audit log; specifying this flag is what actually enables the log backend and causes events to be recorded to a file. Option C is correct because an audit policy YAML file defines the rules (levels such as None, Metadata, Request, RequestResponse) that determine which requests are logged and at what detail, and it is the file referenced by --audit-policy-file.

Option D is not required because --audit-dynamic-configuration is an optional feature that allows the audit policy to be changed at runtime without restarting the API server, not a prerequisite for basic audit logging. Option E is not required because an audit webhook backend is only one alternative sink for audit events; file-based logging via --audit-log-path satisfies the requirement without any webhook configuration.

Exam trap

The trap here is that candidates often think a webhook backend or dynamic configuration is required for audit logging, but the CKS exam expects you to know that only the policy file, the policy flag, and the log path flag are the mandatory components for enabling basic audit logging.

78
MCQmedium

You have a pod that is in CrashLoopBackOff. You want to inspect the logs from the previous instance of the container. Which flag should you use with kubectl logs?

A.--previous
B.--tail
C.--all-containers
D.--since
AnswerA

The --previous flag instructs kubectl to fetch log output from the previously terminated container instance rather than the current one. In a CrashLoopBackOff scenario, the current container has just restarted and may only show startup messages (if any), while the actual panic or error that caused the crash lives in the previous container's stdout/stderr. This flag is the correct way to retrieve that historical crash output and diagnose the root cause.

Why this answer

When a pod is in CrashLoopBackOff, the current container instance has crashed and restarted, so its logs may be empty or not reflect the crash. The `--previous` flag (or `-p`) tells `kubectl logs` to show logs from the previous instance of the container, which contains the output from the crashed process. This is the correct way to retrieve crash-related logs without waiting for the new instance to produce output.

Exam trap

The exam often tests the misconception that `--tail` or `--since` can retrieve logs from a crashed container, but these flags only filter the current container's logs, not the previous instance's logs.

How to eliminate wrong answers

Option B is wrong because `--tail` specifies the number of recent log lines to display (e.g., `--tail=50`), but it still reads from the current container instance, not the previous one, so it cannot show logs from the crashed instance. Option C is wrong because `--all-containers` is used to stream logs from all containers in a pod (useful for multi-container pods), but it does not access logs from a previous container instance. Option D is wrong because `--since` filters logs by a time duration (e.g., `--since=5m`), but it operates on the current container instance's logs, not the previous one, so it cannot retrieve logs from a terminated container.

79
MCQmedium

You are configuring Kubernetes audit logging. You want to log all requests to the `secrets` resource in the `kube-system` namespace at the `RequestResponse` level, while logging all other requests at the `Metadata` level. Which audit policy configuration achieves this?

A.rules: [- level: RequestResponse, resources: [group: '', resources: [*]], - level: Metadata]
B.rules: [- level: RequestResponse, resources: [group: '', resources: [secrets]], namespaces: [kube-system], - level: Metadata]
C.rules: [- level: Metadata, resources: [group: '', resources: [secrets]], namespaces: [kube-system], - level: RequestResponse]
D.rules: [- level: Metadata, resources: [group: '', resources: [secrets]], namespaces: [kube-system], omitStages: [RequestReceived], - level: RequestResponse]
AnswerB

Audit policy rules are evaluated in order, first match wins. Placing the RequestResponse rule for secrets in kube-system first captures that resource at full detail, while the trailing Metadata rule acts as the catch-all for every other request, satisfying both logging requirements in one policy.

Why this answer

It defines an audit policy rule that matches requests to the `secrets` resource (core API group, empty string) in the `kube-system` namespace and sets the audit level to `RequestResponse`, which logs both the request metadata and the response body. The subsequent `- level: Metadata` rule acts as a catch-all for all other requests, logging only metadata. Audit policy rules are evaluated in order, and the first matching rule applies, so the specific rule for secrets must come before the general rule.

Exam trap

Kubernetes often tests the order of audit policy rules and the specific resource/namespace matching syntax, where candidates mistakenly think a wildcard resource rule can be overridden by a later rule, or confuse the `Metadata` and `RequestResponse` levels.

How to eliminate wrong answers

Option A is wrong because it uses `resources: [*]` which matches all resources, including secrets, and sets the level to `RequestResponse` for everything, then adds a `Metadata` rule that would never be reached due to the order. Option C is wrong because it reverses the levels: it logs secrets at `Metadata` level and all other requests at `RequestResponse` level, which is the opposite of what is required. Option D is wrong because it also logs secrets at `Metadata` level (not `RequestResponse`) and includes `omitStages: [RequestReceived]`, which is unnecessary and does not change the incorrect level assignment.

80
MCQmedium

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

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

crictl relies on a CRI runtime endpoint to communicate with the container runtime. If --runtime-endpoint is omitted, crictl uses its built-in default, which usually points to a non-existent dockershim socket on modern CRI runtimes such as containerd or CRI-O. A wrong or missing endpoint means the gRPC connection silently fails, so crictl ps returns no output even though containers are running.

Why this answer

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

Exam trap

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

How to eliminate wrong answers

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

81
MCQeasy

Which crictl command lists all running containers on a node?

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

crictl ps is the correct command because it queries the CRI runtime for all containers and, by default, filters to those in the running state. It displays each container's unique ID, the associated pod, name, and status, directly satisfying the question's request. This is the standard CRI-O/containerd equivalent of docker ps for inspecting active containers on a node.

Why this answer

The crictl ps command lists running containers on a node by querying the CRI runtime, similar to docker ps. It shows container ID, image, state, and other details for containers currently running, and with the -a flag it also shows stopped containers.

Exam trap

The trap is confusing the CRI object hierarchy: candidates may pick crictl pods thinking it lists containers, but pods lists pod sandboxes while ps lists the containers themselves.

How to eliminate wrong answers

Option A is wrong because crictl pods lists pod sandboxes (the pod-level CRI objects), not the individual containers running within them. Option B is wrong because crictl images lists container images available on the node, not running containers. Option D is wrong because crictl stats displays resource usage statistics (CPU, memory) for running containers, not a listing of them.

82
MCQmedium

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

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

The `-c` flag is the shorthand for `--container` and tells kubectl which container's logs to read from the pod. This is essential when the pod runs multiple containers, because kubectl logs by default only returns logs from the first container or fails with an ambiguity error. Both `-c` and `--container` are valid, so this command correctly targets a specific container.

Why this answer

The `kubectl logs` command supports both `-c` and `--container` flags to specify a container name in a multi-container pod. Both are equivalent and valid. The other options are either incorrect syntax or would display logs from all containers, which does not target a specific container.

Exam trap

CKS often tests kubectl command syntax; candidates might think positional arguments work for container names, but only flags are valid.

How to eliminate wrong answers

Option C is wrong because `kubectl logs <pod> <container>` is not valid syntax; the container must be specified with a flag. Option D is wrong because `--all-containers` displays logs from all containers in the pod, not a specific one, so it does not meet the requirement.

83
MCQmedium

A Falco rule is triggered when a shell is spawned inside a container. Which syscall is typically used to detect shell execution?

A.clone
B.open
C.read
D.execve
AnswerD

Falco detects shell execution by monitoring the execve syscall, which replaces the calling process image with a new program. When a shell binary such as /bin/sh is launched inside a container, execve fires, letting the rule match the spawned process and satisfy the stem's requirement to detect shell execution.

Why this answer

Falco detects shell execution by monitoring the `execve` syscall, which is the standard Linux system call used to execute a new program. When a shell like `/bin/bash` or `/sh` is spawned inside a container, the kernel invokes `execve` to replace the current process image with the shell binary. Falco's rule engine matches this syscall against its default rule set (e.g., `run_shell_untrusted`) to trigger an alert.

Exam trap

Candidates often mistakenly think that shell execution is detected via process creation syscalls like `clone` or `fork`. However, Falco specifically monitors the `execve` syscall because that is the system call that actually loads the shell binary into memory. In the CKS exam, understanding this distinction is crucial for writing Falco rules.

How to eliminate wrong answers

Option A is wrong because `clone` is used to create a new process or thread (like a container), not to execute a shell binary; spawning a shell typically uses `execve` after `fork`/`clone`. Option B is wrong because `open` is used to open a file descriptor, not to execute a program; a shell spawn would not be detected by monitoring file opens. Option C is wrong because `read` reads data from a file descriptor and has no role in program execution; it is unrelated to shell invocation.

84
MCQeasy

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

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

This is the correct method: a NetworkPolicy that selects the compromised pod via its podSelector and explicitly lists policyTypes: [Ingress, Egress] with no rules. With this configuration, the pod is isolated because the policy enforces an implicit deny: any traffic that is not explicitly allowed is dropped, and since there are no allow rules, all ingress and egress traffic is blocked. This effectively quarantines the pod without affecting other pods.

Why this answer

To isolate a compromised pod by blocking all network traffic, you need a NetworkPolicy that selects the pod and denies both ingress and egress. A policy with podSelector matching the pod and policyTypes: [Ingress, Egress] with no rules will deny all ingress and egress traffic because an empty rule set means no traffic is allowed. This effectively isolates the pod.

Exam trap

CKS often tests the misconception that a policy with only ingress rules blocks all traffic, when in fact egress remains open unless explicitly denied, leading candidates to choose incomplete isolation.

How to eliminate wrong answers

Option A is wrong because it only denies ingress, leaving egress traffic allowed, which does not fully isolate the pod. Option C is wrong because it allows egress to all destinations (0.0.0.0/0), which is the opposite of isolation. Option D is wrong because a policy with podSelector: {} and no rules applies to all pods in the namespace and denies all traffic, but it does not specifically target the compromised pod and would disrupt other pods.

85
MCQmedium

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

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

The write fails because `securityContext.readOnlyRootFilesystem: true` makes the container's root filesystem read-only at the kernel level, so every path on the root filesystem—including /tmp—is immutable. The `write()` syscall returns `EROFS` (read-only file system) or `EACCES` (permission denied) unless a writable volume such as an `emptyDir` is explicitly mounted at /tmp. The error is surfaced to the application, not hidden.

Why this answer

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

Exam trap

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

How to eliminate wrong answers

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

86
MCQeasy

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

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

crictl logs <container-id> is the correct command because it directly retrieves the container's stdout/stderr log stream from the CRI-compatible runtime (containerd, CRI-O, etc.). The runtime stores these logs separately from the container's filesystem, and crictl logs queries that store, analogous to `docker logs`. You can further tailor it with flags like `--tail` or `--timestamps`, but the base command is what fetches the log output for a given container ID.

Why this answer

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

Exam trap

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

How to eliminate wrong answers

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

87
MCQmedium

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

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

This policy correctly isolates the compromised pod by selecting it with podSelector and defining an ingress rule that only allows traffic from pods labeled app: monitoring-pod. Because policyTypes explicitly includes both Ingress and Egress, and no egress rules are present, the pod gets a default egress deny. Thus, the pod cannot reach outbound destinations and only accepts incoming traffic from the monitoring pod, achieving effective quarantine while preserving observability.

Why this answer

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

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

Exam trap

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

88
MCQeasy

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

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

kubectl exec -it <pod> -- /bin/sh is correct because -i keeps stdin open for the session, -t allocates a pseudo-TTY, and the -- separates the command to run inside the container. This combination starts an interactive shell as long as /bin/sh is present in the container's filesystem; if it is not, a similar command with /bin/bash or an ephemeral debug container would be needed.

Why this answer

The `kubectl exec -it <pod> -- /bin/sh` command opens an interactive TTY (`-it`) into a running container and launches a shell (`/bin/sh`), which is exactly what's needed for live forensic analysis inside a compromised or suspect container. It does not restart or alter the pod, preserving volatile evidence like running processes, open file descriptors, and in-memory artifacts. This is the standard CKS-recommended approach for container-level incident response.

Exam trap

CKS often tests whether candidates confuse read-only inspection commands (`logs`, `describe`) with interactive execution — the trap is picking `logs` because it 'shows what's happening' when the question actually requires shell access.

How to eliminate wrong answers

Option A is wrong because `kubectl delete pod` destroys the pod and all its ephemeral evidence, which is the opposite of forensic preservation. Option B is wrong because `kubectl logs` only retrieves stdout/stderr from the container — it cannot run commands, inspect the filesystem, or examine running processes. Option C is wrong because `kubectl describe pod` only shows metadata, events, and status from the API server, not the live container runtime state.

89
MCQmedium

You need to preserve evidence (container logs) from a compromised pod before deleting it. Which command should you run first?

A.kubectl exec <pod> -- cat /var/log/*
B.kubectl cp <pod>:/var/log ./pod-logs
C.kubectl logs <pod> --tail=-1 > pod.log
D.kubectl delete pod <pod>
AnswerC

Capturing the full log stream before deletion preserves volatile evidence that vanishes with the pod. The --tail=-1 flag retrieves every retained line rather than the default last ten, satisfying the requirement to secure container logs prior to removing the compromised workload.

Why this answer

`kubectl logs --tail=-1` retrieves the complete log history (all lines) from the container's stdout/stderr stream, which is the primary source of container logs in Kubernetes. Redirecting this output to a file preserves the evidence before the pod is deleted, ensuring the logs are not lost when the pod is removed.

Exam trap

The CKS exam often tests the misconception that `kubectl cp` or `kubectl exec` can reliably retrieve container logs, but in Kubernetes, stdout/stderr logs are not stored as regular files inside the container's filesystem, so only `kubectl logs` can capture them before pod deletion.

How to eliminate wrong answers

Option A is wrong because `kubectl exec` runs a command inside the container, which may alter the container's state or trigger additional logging, and `/var/log/*` may not contain container stdout/stderr logs (which are typically written to a log file managed by the container runtime, not directly accessible via exec). Option B is wrong because `kubectl cp` copies files from the pod's filesystem, but container logs from stdout/stderr are not stored as regular files in the pod; they are streamed to the container runtime and may not be available for copying, especially if the pod is in a crash loop or the log file is rotated. Option D is wrong because deleting the pod first destroys all evidence, including logs, before any preservation can occur.

90
MCQhard

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

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

Using stages explicitly lets you tailor logging per phase: placing level: Metadata for stages: ["RequestReceived"] captures lightweight metadata early, and level: Request for stages: ["ResponseComplete"] captures the full request body after processing. Since the first matching rule in the policy file wins, order these rules appropriately to avoid the default rule catching the RequestReceived stage. This is the correct way to achieve stage-specific audit levels.

Why this answer

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

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

91
Multi-Selecthard

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

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

ResponseStarted is a valid audit stage that fires when the kube-apiserver begins sending response headers to the client. It occurs after the response status code and headers have been written, allowing audit tooling to capture the HTTP status and header metadata before the body streams. This stage is crucial for detecting errors or slow responses where the connection may be interrupted before the body completes.

Why this answer

In Kubernetes audit logging, the audit policy's `stage` field accepts exactly four values: RequestReceived, ResponseStarted, ResponseComplete, and Panic. Option B (RequestReceived) is correct because it is the stage generated as soon as the API server receives the request, before the response is sent. Option A (ResponseStarted) is correct because it is emitted once the response headers have been sent but before the response body is fully transmitted, which applies to long-running requests like watch operations.

Option E (ResponseComplete) is correct because it is generated after the response body has been fully sent and the request lifecycle is finished. Option C (ResponseBuffered) is not a valid stage — no such value exists in the audit.k8s.io API. Option D (RequestProcessing) is also invalid; the API server does not expose a stage by that name, so it cannot be configured in an audit policy.

Exam trap

The trap is that candidates may invent plausible-sounding stages like 'RequestProcessing' or 'ResponseBuffered' because they sound logical, but Kubernetes only defines four specific stages.

92
MCQmedium

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

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

RequestResponse for secrets is the correct choice because it logs the complete API exchange: metadata, the request body (e.g., a Secret create or update payload), and the response body (e.g., the decoded secret data returned by a GET). For core secrets (group ""), this rule ensures that every operation—from read to write—is fully captured, enabling auditors to see exactly what secret material was accessed or modified. This is the only level that provides full visibility into the sensitive payload itself.

Why this answer

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

93
MCQmedium

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

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

crictl ps queries the container runtime for containers in the running state, listing their IDs, images and status. It is the direct equivalent of docker ps, satisfying the need to enumerate active containers before inspecting or debugging the unresponsive one.

Why this answer

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

Exam trap

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

How to eliminate wrong answers

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

94
MCQmedium

A security team wants to detect any attempt to read the /etc/shadow file inside a container. Which Falco rule condition would detect this syscall?

A.evt.type in (open, openat) and fd.name=/etc/shadow
B.evt.type=read and fd.name=/etc/shadow
C.evt.type=open and fd.name contains /etc/shadow
D.proc.name=cat and fd.name=/etc/shadow
AnswerA

The correct approach is to monitor open and openat syscalls because these are the system calls that actually request access to a file by pathname; the fd.name field is populated from the path argument at this point. Using the 'in' operator with both syscall variants covers modern and legacy call patterns, while the exact match '=' on fd.name ensures we detect /etc/shadow specifically and not similar paths. This rule catches any process, regardless of the tool used, and is the standard Falco pattern for file-access detection.

Why this answer

The correct condition is 'evt.type in (open, openat) and fd.name=/etc/shadow' because reading a file in Linux involves the open or openat syscall to obtain a file descriptor. Falco's fd.name field captures the file path, and using 'in (open, openat)' covers both variants. This directly detects access to /etc/shadow.

Exam trap

CKS often tests the confusion between process execution (execve) and file access (open), and the difference between open and openat, leading candidates to pick incomplete conditions.

How to eliminate wrong answers

Option B is wrong because evt.type=read is not a valid syscall for file access; read is used after a file is opened, and fd.name may not be populated correctly. Option C is wrong because 'fd.name contains /etc/shadow' is less precise and could match other paths like /etc/shadow.bak, and it only checks evt.type=open, missing openat. Option D is wrong because it only detects the cat process, missing other tools or methods of reading the file.

95
MCQmedium

You need to configure Kubernetes audit logging to log all requests to the 'secrets' API. Which audit policy level captures the body of the request?

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

The Request audit level instructs the kube-apiserver to log the event's metadata and the raw request body, including any submitted objects, parameters, and headers. Because the requirement is only to capture request payloads, Request satisfies the condition without also recording the response. This level is ideal when you need to know exactly what the client sent, but you don't care about the server's reply.

Why this answer

The 'Request' audit level logs the request metadata and the request body, which includes the body of the request. This is exactly what the question asks for. 'RequestResponse' adds the response body, which is not required per the question. Therefore, the correct answer is A.

Exam trap

The trap is that candidates may overthink and choose RequestResponse because it captures more, but the question precisely asks for 'the body of the request', which is captured by the Request level.

How to eliminate wrong answers

Option A is wrong because the 'Request' level logs only the request metadata and the request body, but not the response body; however, the question asks for the level that captures the body of the request, and 'Request' does capture the request body, but the correct answer is 'RequestResponse' because it captures both request and response bodies, and the question's phrasing implies the need for full body capture including response. Option B is wrong because 'None' logs no events at all, so it cannot capture any request body. Option D is wrong because 'Metadata' logs only the request metadata (e.g., user, timestamp, resource) and does not include the request or response body, so it cannot capture the body of the request.

96
MCQmedium

A Falco rule has the following output: 'Sensitive file opened for reading (user=root command=cat /etc/shadow)'. Which macro is most likely used in the rule condition?

A.shell_procs
B.outbound
C.binaries
D.sensitive_file_names
AnswerD

The 'sensitive_file_names' macro is a standard Falco macro that defines a list of file names and paths considered sensitive, including /etc/passwd, /etc/shadow, /etc/sudoers, and various credential files. This macro is designed to be used in conditions for file-open rules, matching when the opened file's path is in that list. For a rule that outputs 'sensitive file opened', using this macro directly and correctly identifies the event type by filtering on the specific file path. It is the only option among the four that aligns with the rule's intent and is the correct choice.

Why this answer

Falco has a macro called 'sensitive_file_names' that includes files like /etc/shadow, /etc/passwd, etc. The rule likely uses that macro to match on open syscalls targeting those files.

97
MCQeasy

What is the purpose of setting a container's filesystem to read-only in a Pod spec?

A.To prevent an attacker from modifying the container's filesystem after compromise
B.To allow multiple pods to share the same filesystem
C.To prevent the container from being deleted
D.To improve disk I/O performance
AnswerA

Setting a container's filesystem to read-only enforces a runtime security boundary: even if an attacker gains code execution inside the container, they cannot write to the root filesystem, modify existing binaries, or plant persistent payloads. This aligns with immutable infrastructure principles and limits the blast radius of a compromise, though ephemeral writable locations like tmpfs volumes can still be used if needed.

Why this answer

Setting a container's filesystem to read-only in a Pod spec (via `securityContext.readOnlyRootFilesystem: true`) ensures that the container's root filesystem cannot be written to at runtime. This is a critical runtime security hardening measure because even if an attacker gains code execution inside the container (e.g., through a web application vulnerability), they cannot modify binaries, configuration files, or scripts on the filesystem, severely limiting their ability to persist, escalate privileges, or tamper with the application. This aligns with the principle of immutable infrastructure and is a key control in the CKS domain of Runtime Security.

Exam trap

Candidates often mistake the read-only filesystem as a performance or sharing feature, but it is strictly a security control to prevent post-compromise tampering. This is a key concept in the CKS domain of Runtime Security.

How to eliminate wrong answers

Option B is wrong because sharing a filesystem between multiple pods is achieved through PersistentVolumeClaims with `ReadWriteMany` access modes or hostPath volumes, not by setting the container's filesystem to read-only. Option C is wrong because preventing a container from being deleted is a matter of Pod lifecycle management (e.g., using `terminationGracePeriodSeconds` or PodDisruptionBudgets), not filesystem permissions. Option D is wrong because setting a filesystem to read-only does not improve disk I/O performance; in fact, it may have a negligible effect or even slightly degrade performance if the container attempts writes that are silently dropped or cause errors.

98
MCQhard

A Falco rule is written to detect when a shell is spawned inside a container. The rule condition is: `spawned_process and container and proc.name = bash`. The rule is not triggering. Which of the following is the most likely reason?

A.The rule is missing `proc.name in (bash, sh, zsh)` because only bash is checked
B.Falco is not running with the required syscall capabilities
C.The `spawned_process` macro may not match because the process was inherited (not spawned), e.g., from an entrypoint
D.The priority is set to `ERROR` but the output is being filtered
AnswerC

The `spawned_process` macro is defined to match processes whose parent is a shell, i.e., processes created via `fork` and `exec` from an interactive or scripted shell. When a container runs an entrypoint that directly exec's a shell as PID 1, the parent of that shell is the container runtime or init process, not another shell. As a result, the `proc.pname` check inside the macro fails, and the rule never matches even though the shell is present. In such cases, the shell is inherited rather than spawned, so a rule relying on `spawned_process` will not fire.

Why this answer

The `spawned_process` macro in Falco specifically matches processes that are created via `execve` or `fork` system calls. If a shell is inherited from the container's entrypoint (e.g., the container runs `bash` as PID 1 directly), it is not considered a spawned process but rather the initial process of the container. Falco's default `spawned_process` macro filters out such inherited processes, so the rule condition fails to match even though `proc.name = bash` is true.

Exam trap

The trap here is that candidates often focus on the `proc.name` condition and assume the rule is incomplete (option A), but the real issue is the `spawned_process` macro's definition, which excludes the initial container process, a nuance The CKS exam frequently tests in runtime security scenarios.

How to eliminate wrong answers

Option A is wrong because the rule condition `proc.name = bash` is syntactically correct and would match a process named exactly 'bash'; the issue is not about missing shell names but about the process not being detected as spawned. Option B is wrong because Falco requires specific syscall capabilities (e.g., `SYS_EXECVE`, `SYS_FORK`) to detect spawned processes, and if those capabilities were missing, Falco would not detect any spawned processes at all, not just this rule; the question states the rule is not triggering, implying other rules might work, so this is not the most likely reason. Option D is wrong because priority filtering (e.g., `ERROR` vs `WARNING`) affects whether an alert is output or logged, but does not prevent the rule from triggering; the rule condition itself must be satisfied first, and priority is irrelevant to the matching logic.

99
MCQmedium

A pod is stuck in 'Pending' state. You run 'kubectl describe pod mypod' and see the event: '0/1 nodes are available: 1 node(s) had taint {node-role.kubernetes.io/master: }, that the pod didn't tolerate'. What is the most likely solution?

A.Delete the pod and recreate it without any tolerations
B.Remove the taint from the node using 'kubectl taint nodes ...'
C.Add a toleration to the pod spec for the taint 'node-role.kubernetes.io/master'
D.Add a nodeSelector to the pod to match the node's labels
AnswerC

Adding a toleration to the pod spec that matches the taint 'node-role.kubernetes.io/master' with effect 'NoSchedule' tells the scheduler that this pod is willing to be placed on that tainted node. This is the correct, targeted fix because tolerations are the built-in mechanism to relax taint constraints for a specific workload. The toleration should include the exact key, operator (usually 'Exists' or 'Equal'), and effect to match the taint present on the node.

Why this answer

The pod is unschedulable because the node has a taint that the pod does not tolerate. To allow the pod to be scheduled on that node, you must add a toleration to the pod spec that matches the taint. This is the correct solution.

Exam trap

Candidates may think that removing the taint is the solution, but that would allow all pods to schedule on the master node, which is not desirable; the correct approach is to add a toleration to the specific pod.

How to eliminate wrong answers

Option A is wrong because deleting and recreating the pod without tolerations will not help; the pod still won't tolerate the taint. Option B is wrong because removing the taint from the node would allow the pod to schedule, but it is not the best practice for a master node; master nodes are tainted to prevent regular workloads. Option D is wrong because adding a nodeSelector to match the node's labels does not address the taint; the pod would still be rejected due to the taint.

100
MCQeasy

You want to ensure that a container's root filesystem is immutable. Which field in the Pod spec should you set?

A.spec.containers[].securityContext.privileged
B.spec.hostNetwork
C.spec.containers[].securityContext.readOnlyRootFilesystem
D.spec.containers[].volumeMounts[].readOnly
AnswerC

Setting spec.containers[].securityContext.readOnlyRootFilesystem to true instructs the container runtime to mount the container's root filesystem as read-only, meaning the image's root filesystem and any upper writable layer become immutable at the mount level. When this is set, any attempt to write to directories other than explicitly mounted volumes (such as emptyDir or persistent volumes) fails with an error, preventing tampering with binaries, libraries, or configuration files. This is the direct and intended securityContext field to enforce root filesystem immutability for a container, though you may need to mount writable volumes for runtime data like /tmp.

Why this answer

The correct field to make a container's root filesystem immutable is 'spec.containers[].securityContext.readOnlyRootFilesystem'. When set to true, this mounts the container's root filesystem as read-only, preventing any writes to the filesystem. This is a key security measure to prevent runtime modifications.

Exam trap

CKS often tests the distinction between read-only root filesystem and read-only volume mounts, and candidates may incorrectly choose volumeMounts readOnly thinking it applies to the entire container.

How to eliminate wrong answers

Option A is wrong because 'privileged' grants elevated permissions to the container, which is the opposite of restricting filesystem writes and can increase security risks. Option B is wrong because 'hostNetwork' determines whether the pod uses the host's network namespace, unrelated to filesystem immutability. Option D is wrong because 'volumeMounts[].readOnly' only makes a specific volume mount read-only, not the entire root filesystem; it does not affect the container's root filesystem.

101
MCQmedium

A CKS candidate is investigating a pod that appears to have been compromised. The incident response team wants to capture the exact system calls made by processes inside the container to understand the attacker's actions. Which Kubernetes-native feature or tool should be used to collect this syscall-level telemetry?

A.kubectl debug with a privileged profile attached to the pod
B.Container runtime logs collected by the kubelet and exposed via kubectl logs
C.Kubernetes audit logging configured with the RequestResponse level
D.Falco with the appropriate kernel module or eBPF probe loaded on the node
AnswerD

Falco is a runtime security tool that instruments the Linux kernel through a kernel module or eBPF probe to observe system calls made by containers. When configured with rules that capture syscall activity, it can generate alerts or events containing the exact syscalls executed, which is precisely the telemetry required to reconstruct an attacker's actions inside the compromised pod.

Why this answer

Collecting syscall-level telemetry requires a runtime security tool that hooks into the kernel. Falco, using either its kernel module or eBPF probe, observes system calls across all processes on the node, including those inside containers. This allows incident responders to see exactly which syscalls a compromised process invoked, providing the granular data needed for forensic analysis of the attack.

Exam trap

The trap here is assuming that Kubernetes-native tools like audit logs or kubectl debug can provide syscall-level visibility, when actually only node-level runtime security agents such as Falco can capture system calls.

102
MCQeasy

Which crictl command is used to list all running containers managed by the container runtime?

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

This is the correct command; it lists containers managed by the CRI-compatible runtime (e.g., containerd, CRI-O), showing container ID, name, image, and status. By default it shows running containers, and you can use -a to include stopped ones. This maps directly to the concept of 'listing all running containers' in a CRI environment.

Why this answer

The 'crictl ps' command is used to list all running containers managed by the container runtime. It provides a list of containers with their IDs, images, state, and other details. This is the standard command for viewing running containers when using CRI-compatible runtimes like containerd or CRI-O.

Exam trap

CKS often tests the difference between crictl subcommands, and candidates may confuse 'ps' with 'pods' or 'images', especially under time pressure.

How to eliminate wrong answers

Option A is wrong because 'crictl images' lists container images available on the node, not running containers. Option B is wrong because 'crictl stats' displays resource usage statistics for containers, such as CPU and memory, but does not list them. Option D is wrong because 'crictl pods' lists pods, not individual containers; while pods contain containers, the command specifically targets pod-level information.

103
MCQeasy

A security team wants to detect attempts to read /etc/shadow inside containers. Which Falco rule condition would trigger on a container reading that file?

A.evt.type=connect and fd.name=/etc/shadow
B.evt.type=execve and proc.name=cat
C.evt.type=open and container.id exists
D.evt.type=open and fd.name=/etc/shadow
AnswerD

This rule is accurate because Falco's open event exposes the target path in the fd.name field, so the condition matches only when a process attempts to open the /etc/shadow file, regardless of how it eventually reads it. The open() syscall is the necessary first step for reading a file's contents, making this a reliable, low-noise detector for attempts to access sensitive files like the shadow password database.

Why this answer

Falco uses system call events to monitor file access. The condition `evt.type=open` captures file open operations, and `fd.name=/etc/shadow` filters for the specific file path. This triggers when any process inside a container opens /etc/shadow for reading, which is a classic indicator of an attempt to access sensitive host data.

Exam trap

The trap here is that candidates often focus on the process name (like `cat`) instead of the file descriptor being accessed, leading them to choose option B, but Falco's strength is in monitoring system calls and file paths, not just process names.

How to eliminate wrong answers

Option A is wrong because `evt.type=connect` monitors network connection attempts, not file reads; `/etc/shadow` is a file, not a network socket, so this condition would never trigger on file access. Option B is wrong because `evt.type=execve` captures process execution events, not file reads; while `cat /etc/shadow` would generate an execve event, the condition does not check the file being read, so it would miss other methods like `less`, `head`, or direct open syscalls. Option C is wrong because `evt.type=open` is correct for file opens, but `container.id exists` only checks that the event occurred inside any container; it does not filter for the specific file `/etc/shadow`, so it would trigger on any file open in any container, causing excessive false positives.

104
MCQmedium

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

A.crictl ps
B.crictl exec
C.crictl logs
D.crictl inspect
AnswerC

crictl logs is the correct command because it directly fetches and prints the stdout/stderr output of a specified container, identified by its container ID or name. This command is the CRI equivalent of `docker logs` and is what you would use to inspect application or runtime output for debugging. It supports additional flags such as `-f` to follow logs in real time and `--previous` to view logs from a terminated container, making it the definitive tool for accessing container logs with crictl.

Why this answer

crictl logs <container-id> displays logs from a container. crictl ps lists containers, crictl exec runs a command in a container, and crictl inspect shows detailed container information.

105
MCQmedium

You need to detect when a container attempts to mount the host's Docker socket. Which Falco macro or condition would you use?

A.fd.name=/var/run/docker.sock
B.fd.name=/var/run/containerd.sock
C.fd.name=/var/run/docker
D.fd.name=/run/docker.sock
AnswerA

The Docker CLI and daemon communicate through a Unix socket bound at the host path /var/run/docker.sock. If a container mounts this socket, any process inside the container can issue Docker API calls to create privileged containers or mount the host filesystem, effectively escaping the container. Falco detects this by checking the fd.name field on connect/open operations, and this exact absolute path is the canonical socket location Docker uses by default, so it is the correct rule condition.

Why this answer

Falco rules reference file descriptors by their path in the fd.name field. The Docker daemon socket on a host is at /var/run/docker.sock, so a condition checking fd.name=/var/run/docker.sock detects a container opening that socket. This is the canonical path used in Falco rules for Docker socket access detection.

Exam trap

CKS often tests the exact socket path, tempting candidates with similar-looking paths like /run/docker.sock or the containerd socket, so precision on /var/run/docker.sock matters.

How to eliminate wrong answers

Option B is wrong because /var/run/containerd.sock is the containerd socket, not the Docker socket; it would detect containerd access, not Docker. Option C is wrong because /var/run/docker is a directory, not the socket file, so fd.name would not match the socket open event. Option D is wrong because /run/docker.sock is a different path; while /var/run is often a symlink to /run on many systems, Falco rules conventionally use /var/run/docker.sock, and the exam expects that exact path.

106
MCQhard

You have deployed a DaemonSet to run a logging agent on every node. After an update, the new pods are stuck in 'Pending' state. You run 'kubectl describe pod ds-pod-xxxxx' and see '0/3 nodes are available: 3 node(s) had taint {node-role.kubernetes.io/master: }, that the pod didn't tolerate'. What is the MOST likely cause?

A.The DaemonSet has a nodeSelector that doesn't match any nodes
B.The DaemonSet uses hostNetwork which conflicts with existing pods
C.The DaemonSet does not have tolerations for the node taints
D.The nodes are cordoned
AnswerC

This is correct: DaemonSet pods, like all pods, are subject to taints and tolerations. If a node has a taint, the DaemonSet pod template must include the matching toleration; otherwise, the scheduler will leave the pod Pending with an event like '0/N nodes are available: N node(s) had taint {key=value:NoSchedule}, that the pod didn't tolerate.' The DaemonSet controller can only create pods; it cannot bypass the scheduler's taint rules.

Why this answer

The error message indicates that the pod cannot be scheduled because all three nodes have a taint (specifically `node-role.kubernetes.io/master`), and the DaemonSet's pod template does not include a corresponding toleration. By default, control-plane nodes are tainted to prevent general workloads from running on them, so a DaemonSet intended to run on all nodes must include tolerations for these taints. Without tolerations, the scheduler will not place the pod on tainted nodes, leaving it in Pending state.

Exam trap

The trap here is that candidates often assume DaemonSets automatically run on all nodes regardless of taints, but in reality, DaemonSets respect taints and tolerations just like any other workload, and failing to add tolerations for control-plane taints is a common misconfiguration.

How to eliminate wrong answers

Option A is wrong because a nodeSelector mismatch would produce a different error (e.g., '0/3 nodes are available: 3 node(s) didn't match node selector'), not a taint-related message. Option B is wrong because hostNetwork conflicts would cause pod startup failures (e.g., port collisions) or CrashLoopBackOff, not a scheduling failure due to taints. Option D is wrong because cordoned nodes would show a specific condition like 'node(s) cordoned' in the describe output, not a taint-based message; cordoning prevents new pods from being scheduled but does not produce a taint-related error.

107
MCQmedium

A pod named 'busybox-pod' is compromised. You want to isolate it from all other pods using a NetworkPolicy. Which YAML snippet correctly denies all ingress and egress traffic to/from the pod?

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

This is the correct isolation policy because it selects only the compromised pod using its `app: busybox` label and declares both `Ingress` and `Egress` in `policyTypes` while omitting any allow rules. According to NetworkPolicy semantics, when a policy isolates a traffic direction and contains no rules for that direction, all traffic of that type is denied. Therefore this policy enforces a complete default-deny on both inbound and outbound traffic for the busybox pod, cutting off all network communication with it.

Why this answer

It uses the correct apiVersion (networking.k8s.io/v1) and explicitly specifies both Ingress and Egress in policyTypes with an empty rules array, which denies all ingress and egress traffic to/from the selected pod. Without any rules, the policy defaults to denying all traffic of the specified types, effectively isolating the pod.

Exam trap

A common mistake is omitting 'policyTypes' or only specifying one direction, thinking that an empty rules block alone denies all traffic. You must explicitly list both Ingress and Egress in policyTypes to block both directions.

How to eliminate wrong answers

Option A is wrong because it only defines an egress rule allowing traffic to all pods (empty podSelector matches all pods), which permits egress traffic instead of denying it, and it omits policyTypes, so ingress traffic is not restricted. Option B is wrong because it uses apiVersion v1 (which is incorrect for NetworkPolicy; the correct group is networking.k8s.io/v1), and it only specifies Ingress in policyTypes with no rules, so egress traffic is not denied. Option C is wrong because it only defines an ingress rule allowing traffic from all pods (empty podSelector matches all pods), which permits ingress traffic instead of denying it, and it omits policyTypes, so egress traffic is not restricted.

108
Multi-Selecteasy

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

Select 2 answers
A.ResponseFull
B.ResponseComplete
C.RequestReceived
D.RequestProcessing
E.RequestComplete
AnswersB, C

ResponseComplete is one of the four valid Kubernetes audit stages. It fires after the HTTP response has been fully transmitted to the client, meaning the audit event can include the complete response body, status code, and headers. This stage is essential for capturing full-response data for forensic analysis, though it may produce larger audit logs than earlier stages.

Why this answer

In Kubernetes auditing, the audit policy defines stages that determine at which points in the request lifecycle an audit event is recorded. Option B, ResponseComplete, is a valid stage that logs an event after the API server has finished sending the response to the client, capturing the final outcome. Option C, RequestReceived, is a valid stage that logs an event as soon as the API server receives the request, before any processing occurs.

The other options are not valid Kubernetes audit stages: ResponseFull, RequestProcessing, and RequestComplete do not exist in the audit.k8s.io API; the actual stages are RequestReceived, ResponseStarted, ResponseComplete, and Panic.

Exam trap

The trap is confusing the exact names of audit stages; candidates might recall 'RequestComplete' or 'ResponseFull' instead of the correct 'ResponseComplete' and 'RequestReceived'.

109
Multi-Selectmedium

A platform team is hardening a namespace that runs tenant workloads. They want runtime detection that flags container escapes and unexpected privilege changes. Which TWO Falco rule fields or conditions are most appropriate to detect these behaviors? (Choose two.)

Select 2 answers
A.evt.type in (mount, umount2) with proc.name = runc or a condition on the mount source
B.evt.type in (setuid, setgid) with a condition on the container image or user
C.evt.type = execve and proc.name = kubectl
D.proc.name = bash and container.id != host
E.evt.type = open and fd.name contains /etc/passwd
AnswersA, B

Unexpected mount or umount2 activity attributed to a runtime helper or a container process often accompanies container escape techniques that remount host paths or pivot into the host filesystem. Alerting on these syscalls with a source or process constraint highlights tampering that is rare in normal tenant workload operation.

Why this answer

Detecting container escapes and privilege changes calls for syscall-level signals tied to confinement boundaries. Watching setuid and setgid transitions catches attempts to gain effective privileges, while monitoring mount and umount2 activity with a runtime or source constraint surfaces tampering with the filesystem namespace. Both are low-noise, high-signal conditions for tenant workloads compared with generic shell or file-read detections.

Exam trap

The trap here is choosing familiar file-read or shell-spawn detections for escape scenarios, when escapes and privilege changes are better surfaced by setuid, setgid, mount, and umount2 syscall activity.

110
MCQmedium

You are responding to a security incident where a pod named `compromised-pod` in namespace `default` is suspected of being used for cryptocurrency mining. You need to immediately isolate the pod from the network while preserving evidence. Which command sequence should you use?

A.kubectl cordon <node-of-compromised-pod>
B.kubectl label pod compromised-pod isolated=true && kubectl apply -f networkpolicy.yaml
C.kubectl delete pod compromised-pod && kubectl describe pod compromised-pod
D.kubectl exec compromised-pod -- killall miner-process
AnswerB

Ly identifies the need to label the pod and apply a deny-all NetworkPolicy. The command sequence is impractical (busybox lacks kubectl), but the concept is what the exam tests. In a real scenario, you would label the pod directly and then apply the policy.

Why this answer

The correct approach is to label the pod and apply a deny-all NetworkPolicy that selects pods with that label. This immediately isolates the pod from all network traffic while preserving the pod for forensic analysis. The command sequence is: kubectl label pod compromised-pod isolated=true && kubectl apply -f networkpolicy.yaml where the networkpolicy.yaml defines an ingress/egress deny-all policy for pods with label isolated=true.

Exam trap

In the CKS exam, a common trap is confusing node-level controls (cordon, drain) with pod-level network isolation (NetworkPolicy). Candidates may think cordoning a node isolates the pod, or that deleting the pod is sufficient containment, but deleting destroys forensic evidence.

How to eliminate wrong answers

Option A is wrong because `kubectl cordon` marks a node as unschedulable, preventing new pods from being scheduled on it, but it does not affect network traffic to or from existing pods on that node; the compromised pod remains fully connected. Option C is wrong because deleting the pod destroys the running container and its ephemeral storage, losing volatile evidence (e.g., running processes, open file handles, memory dumps) that is critical for incident response. Option D is wrong because `kubectl exec` to kill a specific process assumes you know the exact process name and does not guarantee the mining process is stopped (it may respawn), and it does not isolate the pod from network egress, allowing continued communication with external mining infrastructure.

111
MCQeasy

Which flag is used when starting kube-apiserver to enable audit logging?

A.--audit-log-path
B.--audit-webhook-config-file
C.--feature-gates=Audit=true
D.--audit-policy-file
AnswerD

This is the correct flag that actually enables audit logging. It specifies the path to a YAML file containing a list of rules that define, in order, which requests (based on user, verb, resource, and phase) should be logged and at which level (None, Metadata, Request, RequestResponse). Only when this flag is present does the kube-apiserver generate audit events; simultaneously configured backends like --audit-log-path or --audit-webhook-config-file become active and receive those events.

Why this answer

The --audit-policy-file flag specifies the path to the audit policy file, which is required to enable audit logging.

112
MCQeasy

An administrator wants to monitor runtime security events in Kubernetes using Falco. Which component must be deployed as a DaemonSet to capture system calls from containers?

A.Falco driver
B.Kube-bench
C.Falcoctl
D.Falco
AnswerD

Falco is the CNCF-graduated runtime security tool that runs as a DaemonSet on every node, with each replica using a kernel driver (eBPF or kernel module) to capture syscalls. It continuously evaluates those syscalls against a comprehensive ruleset—detecting behaviors like shell access, privilege escalation, or suspicious file reads—and produces real-time security alerts. This combination of kernel instrumentation and rule evaluation is exactly what is required to monitor runtime security events in a Kubernetes cluster.

Why this answer

Falco is the core userspace component that processes system calls and enforces runtime security rules. It must be deployed as a DaemonSet on each Kubernetes node to capture system calls from all containers running on that node, as it relies on a kernel module or eBPF probe to intercept syscalls at the host level.

Exam trap

Candidates often confuse the Falco driver (kernel module) with the Falco userspace daemon. The driver captures syscalls, but the daemon processes them and must run on each node via a DaemonSet to monitor all containers.

How to eliminate wrong answers

Option A is wrong because the Falco driver (e.g., kernel module or eBPF probe) is a kernel-level component that is loaded into the kernel, not deployed as a DaemonSet; it is typically installed via a container init or as part of the Falco pod's setup. Option B is wrong because Kube-bench is a tool for checking Kubernetes clusters against CIS benchmarks, not for runtime security monitoring or capturing system calls. Option C is wrong because Falcoctl is a command-line utility for managing Falco configurations and rules, not a component that captures syscalls or runs as a DaemonSet.

113
Multi-Selectmedium

Which TWO of the following are valid methods to detect a container spawning a shell (e.g., /bin/bash) using Falco? (Select two.)

Select 2 answers
A.Use the rule 'Launch Sensitive Mount'
B.Check if proc.name is 'bash' and container is true
C.Use the macro 'spawned_process' combined with a container filter
D.Check if the process's parent is 'sshd'
E.Check if evt.type is 'execve' and fd.name contains 'bash'
AnswersB, C

Falco rules match process attributes from the kernel; checking proc.name equals bash while container is true detects an interactive shell spawned inside a container. This distinguishes container shell execution from host-level bash processes, which is the behaviour being hunted.

Why this answer

Option B is correct because Falco rules can directly match the process name field proc.name against 'bash' (or other shell binaries) while also requiring container=true, which scopes the detection to containerized workloads and reliably flags a shell being launched inside a container. Option C is correct because Falco ships a 'spawned_process' macro that encapsulates the execve/execveat event conditions for process creation, and combining it with a container filter (e.g., container.id != host or container=true) is the idiomatic way to detect any process, including a shell, spawned inside a container. Option A is not a shell-spawning detection method; 'Launch Sensitive Mount' targets mount-related activity such as sensitive host paths being mounted, not process execution.

Option D is wrong because checking for a parent of 'sshd' detects remote login sessions, not a container spawning a shell, and misses container-internal shell launches. Option E is incorrect because fd.name refers to file descriptor names (files, sockets), not the executable being run, so it would not properly identify a shell being executed via execve.

Exam trap

Falco often tests the distinction between process name fields (proc.name) and file descriptor fields (fd.name), leading candidates to incorrectly select option E, which uses fd.name instead of proc.name for process detection.

114
MCQeasy

Which command can be used to view the logs of a container using the container runtime interface (crictl)?

A.crictl status <container-id>
B.crictl logs <container-id>
C.crictl inspect <container-id>
D.crictl log <container-id>
AnswerB

crictl logs <container-id> correctly invokes the CRI's ContainerLogs method, which fetches the log stream generated by the container's primary process. It supports common flags like --follow, --tail, and --timestamps, making it the direct equivalent to 'docker logs' for node-level troubleshooting when you have a container ID rather than a pod.

Why this answer

crictl logs is the command to fetch logs of a container, similar to 'docker logs'.

115
MCQhard

Which of the following is NOT a valid priority level in a Falco rule?

A.NOTICE
B.HIGH
C.CRITICAL
D.WARNING
AnswerB

HIGH is not a valid priority level in this context. Falco's predefined priority levels are EMERGENCY, ALERT, CRITICAL, ERROR, WARNING, NOTICE, INFO, and DEBUG; there is no HIGH level. A rule that needs to indicate a serious threat above WARNING must use CRITICAL (or ALERT/EMERGENCY), not HIGH.

Why this answer

Falco rules support priority levels as defined in the syslog severity standard. The valid priorities are: EMERGENCY, ALERT, CRITICAL, ERROR, WARNING, NOTICE, INFORMATIONAL, and DEBUG. 'HIGH' is not a valid priority in Falco; the correct equivalent is 'ERROR' or 'CRITICAL' depending on severity. Therefore, option B is not a valid priority level.

Exam trap

The CNCF CKS exam often tests the exact set of Falco priority levels, and the trap here is that candidates confuse 'HIGH' with the valid 'ERROR' or 'CRITICAL' levels, as 'HIGH' is a common severity label in other security tools but is not part of Falco's syslog-based priority list.

How to eliminate wrong answers

Option A is wrong because NOTICE is a valid Falco priority, corresponding to syslog severity level 5. Option C is wrong because CRITICAL is a valid Falco priority, corresponding to syslog severity level 2. Option D is wrong because WARNING is a valid Falco priority, corresponding to syslog severity level 4.

116
MCQhard

A Falco rule is written to detect access to /etc/shadow inside a container. Which condition should be used?

A.evt.type=read and fd.name=/etc/shadow
B.spawned_process and proc.name in (cat, less) and container
C.evt.type=execve and proc.name=cat and fd.name=/etc/shadow
D.evt.type=open and fd.name=/etc/shadow
AnswerD

The open syscall is the correct hook because it is the first syscall where the target path is supplied by the caller and resolved by the kernel, making it ideal for path-based detection. With evt.type=open, fd.name matches the path exactly as passed, and the event is emitted on both successful opens and failed attempts like EACCES, so even permission-denied probing is captured. This rule does not depend on the process name, meaning it works for any utility or binary, and it also covers openat variants when Falco normalizes them appropriately. It is the most reliable and complete condition for detecting access to /etc/shadow among the given options.

Why this answer

The correct condition is 'evt.type=open and fd.name=/etc/shadow' because reading a file in Linux typically involves the open or openat syscall to obtain a file descriptor. Falco's fd.name field captures the file path, and evt.type=open detects the attempt to open the file. This directly detects access to /etc/shadow without relying on specific tools like cat or less.

Exam trap

CKS often tests the confusion between process execution (execve) and file access (open), leading candidates to pick options that monitor process names instead of syscalls.

How to eliminate wrong answers

Option A is wrong because evt.type=read is not a valid syscall for file access; read is used after a file is opened, and fd.name may not be populated correctly. Option B is wrong because it only detects specific processes (cat, less) and misses other tools or methods of reading the file. Option C is wrong because evt.type=execve detects process execution, not file access, and combining with proc.name=cat is too narrow.

117
Multi-Selectmedium

Which TWO of the following are valid steps to respond to a runtime security incident where a container is suspected to be compromised? (Select two.)

Select 2 answers
A.Apply a NetworkPolicy that denies all ingress and egress to the pod
B.Immediately delete the pod to stop the attack
C.Add a taint to the node to evict the pod
D.Use kubectl logs to capture container logs before taking action
E.Restart the kubelet on the node
AnswersA, D

Applying a NetworkPolicy that denies all ingress and egress to the pod is a correct first step because it achieves network-level containment without destroying the running container or its filesystem. This isolation prevents the attacker from communicating with the pod or using it as a pivot, while preserving the pod's memory, disk, and process state for forensic analysis. Unlike deletion or eviction, this action is reversible and does not trigger rescheduling, keeping the compromised pod in a known, quarantined state for further investigation.

Why this answer

Applying a NetworkPolicy that denies all ingress and egress to the compromised pod immediately isolates it, preventing lateral movement and data exfiltration while preserving the pod for forensic analysis. This aligns with the incident response principle of containment before eradication, and Kubernetes NetworkPolicy uses label selectors and pod selectors to enforce eBPF/iptables-based rules at the CNI layer.

Exam trap

The exam often tests the misconception that immediate deletion or node-level actions (like tainting or restarting kubelet) are appropriate first-response steps, when in fact the priority is containment and evidence preservation using network isolation and logging.

118
MCQmedium

A Falco rule detects unexpected outbound connections. Which condition would identify a connection to an external IP not in the allowed list?

A.evt.type=connect and fd.ip not in (allowed_ips)
B.evt.type=accept and fd.ip not in (allowed_ips)
C.evt.type=listen and fd.ip not in (allowed_ips)
D.evt.type=bind and fd.ip not in (allowed_ips)
AnswerA

The `connect` syscall is the kernel entry point for a client initiating an outbound TCP connection, setting the remote endpoint from the local socket. Filtering on `evt.type=connect` with `fd.ip not in (allowed_ips)` directly matches egress attempts to any destination IP that is not on the allowlist, making this the correct event type for detecting unexpected outbound connections. This rule captures the moment a process tries to reach an external IP, regardless of whether the connection ultimately succeeds or fails.

Why this answer

Falco's connect event (evt.type=connect) fires when a process initiates an outbound connection, and the fd.ip field holds the destination IP of the socket. Filtering with 'fd.ip not in (allowed_ips)' therefore flags outbound connections to any IP outside the approved list, which is exactly the unexpected-egress detection described.

Exam trap

The trap is mixing up syscall semantics: accept and listen are inbound-oriented, and bind is local, so only connect represents an outbound connection where fd.ip is the remote destination.

How to eliminate wrong answers

Option B is wrong because evt.type=accept corresponds to a process accepting an inbound connection, not initiating an outbound one, so it would detect inbound rather than egress traffic. Option C is wrong because evt.type=listen occurs when a socket begins listening for incoming connections and does not represent an outbound connection attempt. Option D is wrong because evt.type=bind associates a socket with a local address/port and does not involve a remote destination IP, so fd.ip would not reflect an external endpoint.

119
Multi-Selecthard

You need to preserve forensic evidence from a compromised pod. Which TWO actions should you take?

Select 2 answers
A.Delete the pod immediately
B.Take a snapshot of the container's filesystem
C.Apply a NetworkPolicy to allow all traffic
D.Capture the container logs using kubectl logs
E.Restart the container
AnswersB, D

Taking a snapshot of the container's filesystem captures the exact writable layer and all runtime changes, including planted malware, persistence mechanisms, and attacker-modified system files. Use `docker commit` or `crictl` to export the live container state into an immutable image that can be analyzed offline without altering the original evidence. This is forensically sound and should be the first priority before any containment or cleanup action.

Why this answer

Taking a snapshot of the container filesystem (e.g., using crictl export) and capturing the container logs are standard forensic steps.

120
Multi-Selectmedium

Which TWO are valid stages in a Kubernetes audit event? (Select 2)

Select 2 answers
A.RequestReceived
B.ResponseStarted
C.PreProcessing
D.None
E.PostProcessing
AnswersA, B

RequestReceived is the first stage of a Kubernetes audit event, emitted as soon as the kube-apiserver receives the request and before any admission or processing occurs. It captures the raw request metadata, making it useful for observing requests that may later be rejected or mutated by admission controllers. This stage is one of the four valid audit stages defined in the AuditConfiguration, along with ResponseStarted, ResponseComplete, and Panic.

Why this answer

'RequestReceived' is one of the defined stages in the Kubernetes audit event lifecycle. When an audit policy is configured, the kube-apiserver records an audit event at the 'RequestReceived' stage after it has received the request but before it has been processed by the admission controllers or the resource handler. This stage captures the raw request as it arrives.

Exam trap

Kubernetes often tests the exact naming of audit stages, and the trap here is that candidates confuse generic terms like 'PreProcessing' or 'PostProcessing' with the actual Kubernetes-defined stages, which are strictly 'RequestReceived', 'ResponseStarted', 'ResponseComplete', and 'Panic'.

121
MCQeasy

You are using crictl to debug a container. Which command lists all running containers on the node?

A.crictl containers
B.crictl ps
C.crictl get pods
D.crictl list
AnswerB

`crictl ps` is the correct command because it directly queries the Container Runtime Interface (CRI) to list containers on the node. It is analogous to `docker ps` and, with the `-a` flag, shows both running and exited containers, enabling debugging of container states, IDs, images, and resource usage.

Why this answer

`crictl ps` is the command used to list running containers on a node when using the CRI (Container Runtime Interface) compatible runtimes like containerd or CRI-O. It mirrors the Docker `docker ps` syntax and shows only running containers by default, which is exactly what the question asks for.

Exam trap

The trap here is that candidates familiar with Docker might expect `crictl containers` to work, but `crictl` deliberately uses `ps` to align with Docker's command syntax, and `crictl list` is not a valid command at all.

How to eliminate wrong answers

Option A is wrong because `crictl containers` is not a valid command; the correct command to list containers is `crictl ps`. Option C is wrong because `crictl get pods` is used to list pods, not individual containers, and it is a command from `kubectl`, not `crictl`. Option D is wrong because `crictl list` is not a valid command; the correct command is `crictl ps`.

122
MCQhard

You need to ensure a container's filesystem is immutable at runtime except for a temporary volume. Which Pod spec configuration achieves this?

A.containers: - name: app securityContext: runAsNonRoot: true volumeMounts: - mountPath: /tmp name: scratch volumes: - name: scratch emptyDir: {}
B.containers: - name: app securityContext: readOnlyRootFilesystem: true volumeMounts: - mountPath: /tmp name: scratch volumes: - name: scratch emptyDir: {}
C.containers: - name: app securityContext: readOnlyRootFilesystem: false
D.containers: - name: app securityContext: readOnlyRootFilesystem: true volumeMounts: - mountPath: /tmp name: scratch volumes: - name: scratch hostPath: path: /tmp
AnswerB

Setting readOnlyRootFilesystem: true mounts the container's root filesystem as read-only, blocking all writes to the overlay paths such as /, /etc, and /bin. The emptyDir volume mounted at /tmp is a tmpfs-based ephemeral storage that lives only as long as the pod, offering a writable scratch area without violating immutability. This configuration correctly achieves an immutable container filesystem while allowing the application to write temporary files.

Why this answer

Setting `readOnlyRootFilesystem: true` in the container's securityContext makes the container's filesystem immutable at runtime, preventing any writes to the root filesystem. By mounting an `emptyDir` volume at `/tmp`, the container gets a writable temporary volume for scratch data, satisfying the requirement of a temporary writable area while keeping the rest of the filesystem read-only.

Exam trap

The CKS exam often tests the distinction between `runAsNonRoot` and `readOnlyRootFilesystem`, where candidates mistakenly think `runAsNonRoot` provides filesystem immutability, or they overlook that `hostPath` volumes are not temporary and violate the requirement for a temporary volume.

How to eliminate wrong answers

Option A is wrong because `runAsNonRoot: true` only ensures the container runs as a non-root user, but does not make the filesystem immutable; it does not prevent writes to the root filesystem. Option C is wrong because `readOnlyRootFilesystem: false` explicitly allows writes to the root filesystem, which is the opposite of the required immutability. Option D is wrong because while it sets `readOnlyRootFilesystem: true`, it uses a `hostPath` volume mounted at `/tmp` instead of an `emptyDir`; `hostPath` volumes are not temporary and can persist data on the node, violating the 'temporary volume' requirement and introducing security risks by exposing the host filesystem.

123
Multi-Selectmedium

Which TWO of the following are valid audit stages in Kubernetes audit logging? (Choose two)

Select 2 answers
A.ResponseStarted
B.RequestReceived
C.ResponseFinished
D.RequestProcessing
E.AuthorizationChecked
AnswersA, B

ResponseStarted is a defined Kubernetes audit stage, triggered after the response headers are written but before the response body is sent. It is primarily relevant for long-running requests such as watches, enabling auditing of the initial response metadata without waiting for the entire stream to conclude.

Why this answer

`ResponseStarted` is a valid audit stage in Kubernetes audit logging. It occurs when the response headers are sent, but the response body is not yet complete. This stage is useful for auditing the start of a response, especially for streaming or large responses.

Exam trap

Kubernetes often tests the exact names of Kubernetes audit stages, and the trap here is that candidates confuse `ResponseFinished` with the correct `ResponseComplete` stage, or invent stages like `RequestProcessing` or `AuthorizationChecked` that sound plausible but do not exist in the Kubernetes audit logging specification.

124
MCQhard

An audit policy is configured with the following rule: - level: Metadata resources: - group: "" resources: ["secrets"] What does this rule log for requests to the Secrets API?

A.The full request and response body
B.Metadata about the request, excluding the body
C.Nothing, because secrets are excluded by default
D.The request body only
AnswerB

The Metadata audit level captures the request's metadata, such as the user, timestamp, resource, and verb, while explicitly excluding the request and response body. This gives a high-level audit trail without exposing sensitive payload data. In the rule, the level field set to Metadata makes this the exact outcome.

Why this answer

The Metadata audit level logs request metadata — such as the user, timestamp, verb, resource, and namespace — but deliberately excludes the request and response bodies. This is precisely why Metadata is commonly applied to Secrets: it records who accessed which secret and when, without writing the secret contents into audit logs. The rule shown therefore produces metadata-only entries for Secrets API requests.

Exam trap

The trap is assuming Metadata logs bodies or that secrets are automatically excluded — candidates must remember Metadata explicitly omits request and response bodies while still recording access metadata.

How to eliminate wrong answers

Option A is wrong because logging the full request and response body requires the RequestResponse level, not Metadata. Option C is wrong because secrets are not excluded by default — Kubernetes logs them according to whatever audit policy rule matches, and Metadata is a valid level for secrets. Option D is wrong because logging only the request body corresponds to the Request level, which is more verbose than Metadata and still omits the response body.

125
MCQeasy

You need to configure the Kubernetes API server to enable audit logging at the 'Metadata' level for all requests. Which flag should be used when starting the kube-apiserver?

A.--feature-gates=Auditing=true
B.--audit-log-path=/var/log/audit.log
C.--audit-policy-file=/etc/kubernetes/audit-policy.yaml
D.--audit-log-maxsize=100
AnswerC

Audit logging levels are defined inside an audit policy YAML, and the kube-apiserver only emits audit events when started with --audit-policy-file pointing at that file. The policy's rules set the Metadata level for the relevant request stages, so this flag is the mechanism that enables the required logging.

Why this answer

Audit logging is enabled by specifying --audit-policy-file pointing to a policy file. The policy file defines the level. The flag itself is --audit-policy-file.

126
MCQmedium

A pod has securityContext.readOnlyRootFilesystem: true. What happens if a process inside the container tries to write to the root filesystem?

A.The write will succeed because tmpfs is used
B.The write will fail with an error
C.The kernel will allow the write but log it
D.The pod will be restarted
AnswerB

readOnlyRootFilesystem mounts the container's root filesystem read-only at the kernel level, so any write syscall to a path on it returns EROFS. The process receives an error rather than the write silently succeeding or the pod restarting.

Why this answer

When `securityContext.readOnlyRootFilesystem: true` is set in a Pod spec, the container's root filesystem is mounted as read-only. Any attempt by a process inside the container to write to the root filesystem (e.g., creating a file in `/` or modifying `/etc/passwd`) will be denied by the kernel's VFS layer, and the write system call will return an error (typically `EROFS` or `EACCES`). This is enforced at the kernel level, not by Kubernetes itself.

Exam trap

Candidates often think that `readOnlyRootFilesystem: true` only applies to certain directories or that Kubernetes will automatically restart the pod on failure, but in reality it is a kernel-enforced read-only mount that denies writes with an error and does not affect the pod lifecycle.

How to eliminate wrong answers

Option A is wrong because tmpfs is not automatically used; `readOnlyRootFilesystem: true` makes the root filesystem read-only, and any writes fail regardless of whether tmpfs is mounted elsewhere. Option C is wrong because the kernel does not log the write; it immediately denies the operation with an error code, and no logging occurs unless a separate audit mechanism (e.g., `auditd`) is configured. Option D is wrong because the pod is not restarted; the write fails silently (from Kubernetes' perspective) and the container continues running unless the process crashes due to the error.

127
Multi-Selecteasy

Which TWO tools can be used to directly interact with a container runtime on a Kubernetes node without using kubectl?

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

ctr is the native CLI for containerd, speaking directly to containerd's gRPC API over its Unix socket (e.g., /run/containerd/containerd.sock). It can list, create, and exec into containers, manage images, snapshots, and tasks without going through Kubernetes or the kubelet. Because it bypasses the CRI layer, it is an invaluable debugging and forensics tool for containerd-based nodes, though it only works when the runtime is containerd and is not suitable for managing CRI-only abstractions like pods.

Why this answer

crictl and ctr are CLI tools for interacting with CRI-compatible container runtimes. kubectl and docker are not available on nodes by default; docker is not always the runtime.

128
MCQmedium

Which audit stage in Kubernetes audit logging captures the stage after a request is processed and before a response is sent?

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

This audit stage fires when the HTTP server begins writing the response headers to the client, making it the earliest point at which the response's status code and headers are available. For a question asking which stage captures the beginning of the response, this is the correct choice because it records the event before the body is fully streamed. It is particularly useful for tracking latency and status decisions without waiting for the entire payload.

Why this answer

The `ResponseStarted` audit stage in Kubernetes audit logging captures the stage after a request has been processed by the API server but before the response is sent to the client. This stage allows logging of the response headers and status code while the response body is still being streamed, providing visibility into the server-side processing outcome before the client receives the full payload.

Exam trap

The trap here is that candidates often confuse `ResponseStarted` with `ResponseComplete`, mistakenly thinking the stage after processing but before sending is the final stage, when in fact `ResponseStarted` occurs before the response body is fully transmitted.

How to eliminate wrong answers

Option A is wrong because `ResponseComplete` captures the stage after the entire response has been sent to the client, not before the response is sent. Option B is wrong because `Panic` is not a standard audit stage in Kubernetes; it refers to a Go runtime panic event, not an audit logging stage. Option C is wrong because `RequestReceived` captures the stage when the request is first received by the API server, before any processing occurs, not after processing and before the response.

129
MCQeasy

Which kubectl command can be used to view the live logs of a container in a pod named 'my-pod'?

A.kubectl attach my-pod
B.kubectl logs my-pod --tail 10
C.kubectl logs -f my-pod
D.kubectl exec my-pod -- journalctl
AnswerC

kubectl logs -f my-pod is the correct way to view live logs because the -f (or --follow) flag keeps the connection open and streams new log lines as they arrive, similar to tail -f. It first outputs the most recent logs (unless --tail is explicitly set) and then continues printing any subsequent output from the container's stdout/stderr until you interrupt it. This is the canonical command for real-time log monitoring in Kubernetes.

Why this answer

The command 'kubectl logs -f my-pod' streams the logs in real-time (follow mode), which is equivalent to viewing live logs. The -f flag stands for 'follow' and continuously outputs new log entries as they are generated.

Exam trap

The trap here is confusing 'attach' with 'logs'—attach is for interactive sessions, while logs is for retrieving output. Also, candidates might think --tail provides live streaming, but it only limits the number of lines shown.

How to eliminate wrong answers

Option A is wrong because 'kubectl attach' attaches to a running process's stdin/stdout/stderr, not specifically for viewing logs; it's used for interactive debugging. Option B is wrong because '--tail 10' only shows the last 10 lines and does not follow the logs live. Option D is wrong because 'kubectl exec' runs a command inside the container; journalctl may not be available and does not directly access the container's log stream.

130
MCQmedium

A pod named 'compromised-pod' is suspected of making unauthorized outbound connections. You want to isolate the pod using a NetworkPolicy. Which policy correctly denies all egress traffic from the pod?

A.NetworkPolicy with podSelector: {} and egress: [{to: [{ipBlock: {cidr: 0.0.0.0/0}}]}]
B.NetworkPolicy with podSelector: matchLabels: app: compromised and policyTypes: ["Ingress"]
C.NetworkPolicy with podSelector: matchLabels: app: compromised and egress: []
D.NetworkPolicy with podSelector: matchLabels: app: compromised and egress: [{to: [{podSelector: {}}]}]
AnswerC

This policy selects the compromised pod and specifies egress: [] as an empty list. An empty egress rule list is a deny-all: since no destinations are allowed, all outbound traffic from that pod is blocked. With an egress list present, policyTypes defaults to Egress, so this rule is enforced; any additional egress allowances must be added in separate policies, which are ORed. This provides immediate containment of the suspicious outbound activity.

Why this answer

A NetworkPolicy with podSelector matching 'compromised-pod' (via label app=compromised) and an empty egress list (egress: []) explicitly denies all egress traffic from the pod. This is the standard Kubernetes pattern to isolate a pod by default-deny egress. Option A allows egress to 0.0.0.0/0, which permits all outbound traffic.

Option B only restricts ingress, not egress. Option D allows egress to pods matching an empty podSelector (all pods), thus permitting traffic to other pods in the namespace. Therefore, only option C achieves complete egress isolation.

131
MCQmedium

Which Falco rule condition would detect an attempt to read the /etc/shadow file in a container?

A.evt.type=open and fd.name=/etc/shadow
B.evt.type=write and fd.name=/etc/shadow
C.evt.type=read and fd.name=/etc/shadow
D.evt.type=execve and proc.name=shadow
AnswerA

The open (or openat) syscall is the first system call issued when a process requests access to a file; Falco's evt.type=open matches both. fd.name=/etc/shadow filters for the exact pathname, so this condition triggers as soon as the file is opened, regardless of whether any read operation actually follows. This is the canonical Falco pattern (e.g., the 'Read sensitive file' rule) because it captures the clear intent to access the file at the syscall boundary.

Why this answer

The Falco rule condition `evt.type=open and fd.name=/etc/shadow` specifically detects the `open` system call targeting the `/etc/shadow` file. Reading a file in Linux typically involves the `open` syscall (with flags like O_RDONLY) followed by `read`, but Falco's `open` event captures the initial access attempt, making it the standard way to detect file reads. This matches the requirement to detect an attempt to read `/etc/shadow` in a container.

Exam trap

The exam often tests the misconception that `evt.type=read` directly detects file reads, but in Falco, the `read` syscall event is less reliable for initial detection because it occurs after the file is opened, and the `fd.name` field may not be populated in all cases; the correct approach is to use `evt.type=open` with the target file name.

How to eliminate wrong answers

Option B is wrong because `evt.type=write` detects write operations, not read attempts; writing to `/etc/shadow` would indicate modification, not reading. Option C is wrong because `evt.type=read` alone is insufficient—Falco's `read` event is triggered after a file is already opened, and without the `open` event, it may miss the initial access or generate false negatives; the standard approach is to use `open` with the file name. Option D is wrong because `evt.type=execve` detects process execution, not file reads, and `proc.name=shadow` would match a process named 'shadow' (e.g., the `shadow` utility), not the file `/etc/shadow`.

132
MCQmedium

An administrator runs `kubectl exec -it nginx-pod -- sh` and inside the container runs `curl http://example.com`. This succeeds. However, the administrator wants to detect such outbound connections using Falco. Which syscall should Falco monitor to detect this network connection?

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

The connect syscall establishes a connection between a socket and a remote address; for curl, this is the exact moment the TCP handshake begins with the destination web server. When tracing system calls, connect is the first syscall that carries the remote IP and port, so it directly identifies the outbound HTTP request. Thus, of the listed options, connect is the correct syscall to monitor for this network activity.

Why this answer

The `connect` syscall is invoked when a client initiates an outbound TCP connection, such as when `curl http://example.com` is run inside the container. Falco monitors syscalls at the kernel level, and detecting `connect` allows it to capture the destination IP and port of the outbound request. This is the correct syscall to monitor for outbound network connections.

Exam trap

The trap here is that candidates confuse `execve` (which starts the `curl` process) with the actual network syscall (`connect`), thinking that monitoring process execution is sufficient to detect outbound connections, but Falco needs the syscall that establishes the connection itself.

How to eliminate wrong answers

Option A is wrong because `open` is used to open files or devices, not to establish network connections; it would not detect the `curl` request. Option C is wrong because `execve` is used to execute a new program (like `curl` itself), but it does not capture the network connection details; monitoring `execve` would only show that `curl` was started, not the outbound connection. Option D is wrong because `bind` is used to associate a socket with a local address (typically for listening servers), not for initiating outbound connections; it would not detect the client-side `connect` call.

133
Multi-Selecthard

Which TWO of the following are true about Kubernetes audit logging?

Select 2 answers
A.Audit logging can be enabled without restarting the API server
B.Audit stages include 'RequestReceived', 'ResponseStarted', 'ResponseComplete', and 'Panic'
C.The audit policy file is passed to the API server via the --audit-policy-file flag
D.The 'Request' level logs both request and response bodies
E.The 'Metadata' level logs the request body
AnswersB, C

The Kubernetes audit system defines exactly four stages at which an event can be recorded: RequestReceived, ResponseStarted, ResponseComplete, and Panic. RequestReceived occurs immediately when the API server receives a request, ResponseStarted happens after response headers are sent but before the response body, ResponseComplete after the full response is sent, and Panic if a panic occurs while handling the request. Because these stages are captured in the audit policy rules, operators can choose to log only certain stages, such as logging RequestReceived for all requests and ResponseComplete for mutating requests.

Why this answer

Option B is correct because Kubernetes defines exactly four audit stages — RequestReceived, ResponseStarted, ResponseComplete, and Panic — which determine when an event is recorded during the request lifecycle. Option C is correct because the API server is configured with the --audit-policy-file flag to specify the audit policy file that defines what to log and at which level. Option A is not correct because enabling audit logging requires API server flags (such as --audit-policy-file and --audit-log-path), which means the kube-apiserver must be restarted.

Option D is not correct because the Request level logs only the request body, not the response body. Option E is not correct because the Metadata level logs request metadata (user, timestamp, resource, verb) but not the request body.

Exam trap

CKS often tests the exact audit stages and levels — candidates confuse 'Request' with 'RequestResponse' and mistakenly believe audit logging can be enabled without restarting the API server.

← PreviousPage 2 of 2 · 133 questions total

Ready to test yourself?

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