CNCF · Free Practice Questions · Last reviewed May 2026
36real exam-style questions organised by domain, each with the correct answer highlighted and a plain-English explanation of why it's right — and why the others are wrong.
20% of exam · 6 sample questions below
A microservice running as a Deployment in a Kubernetes cluster needs to authenticate to a third-party API using a static API key. Which is the most secure way to store and inject this secret into the container?
Store the API key in a ConfigMap and expose it as an environment variable
Hardcode the API key in the container image
Store the API key in a Kubernetes Secret and mount it as a volume inside the container
Mounting the Secret as a volume avoids exposing the API key in environment variables, which can leak via process listings or crash dumps. It satisfies the requirement for secure injection into the container without baking credentials into the image or manifest.
Store the API key in a Kubernetes Secret and expose it as an environment variable
During a security audit, a team discovers that their microservice application, deployed on Kubernetes, is vulnerable to container breakout attacks. The containers run as root and have many Linux capabilities. Which set of Pod Security Standards (PSS) enforcement modes and policies would best mitigate this risk?
Use 'privileged' PSS with Warn mode
Use 'baseline' PSS with Audit mode
Use 'restricted' PSS with Enforce mode
Restricted profile in Enforce mode is the only combination among the choices that both selects the strongest pod-hardening policy and actually enforces it at admission time. Restricted requires runAsNonRoot=true, sets seccompProfile to RuntimeDefault, drops all capabilities except NET_BIND_SERVICE, and mandates a read-only root filesystem, which together deprive an attacker of the most common kernel exploits. Because Enforce mode rejects non-compliant pods before they are created, there is no opportunity for a restricted-violating pod to run and escape.
Use 'baseline' PSS with Enforce mode
A DevOps engineer wants to ensure that all microservice containers run with a read-only root filesystem to prevent unauthorized writes. What is the simplest way to enforce this at the Pod level?
Set `securityContext.runAsNonRoot: true` in the Pod spec
Mount an emptyDir volume to the container's writable directories
Set `securityContext.readOnlyRootFilesystem: true` in the Pod spec
Setting readOnlyRootFilesystem: true instructs the container runtime to mount the container's root filesystem as read-only, so no process can create, delete, or modify files in the root layer. This is the precise securityContext field that the requirement asks for, and it works regardless of the UID the container runs as. Any process that needs to write temporary data must have explicit writable volumes, such as emptyDir, mounted over required paths.
Set `securityContext.privileged: false` in the Pod spec
A security scanner reports that a microservice container image contains a critical vulnerability (CVE-2024-1234) in a system library. The team cannot immediately rebuild the image. What is the most effective temporary mitigation at the Kubernetes level?
Apply a NetworkPolicy to block egress traffic from the Pod
Apply a custom seccomp profile that blocks the vulnerable syscall
A custom seccomp profile restricts the set of syscalls a process may make, and if the scanner mapped the library CVE to a specific syscall, denying that syscall creates a direct mitigation at the kernel boundary. Even when the vulnerable library remains in the image, the exploit cannot complete because the necessary syscall is rejected with EPERM. This is the only option that acts directly on syscall invocation.
Apply an AppArmor profile to the Pod
Use a PodSecurityPolicy to drop all capabilities
A microservice container needs to perform DNS lookups using TCP rather than UDP. Which Kubernetes security context setting should be configured to allow this?
Add `DAC_OVERRIDE` capability
Add `NET_RAW` capability
NET_RAW allows raw sockets; TCP DNS uses standard sockets, so this is unnecessary.
Add `NET_ADMIN` capability
Add `NET_BIND_SERVICE` capability
Which THREE of the following practices help protect microservice applications against supply chain attacks? (Choose three.)
Use images from any public registry for flexibility
Use minimal base images (e.g., distroless or scratch) to reduce attack surface
Minimal images like distroless or scratch contain only the essential runtime dependencies, excluding shells, package managers, and superfluous utilities. This dramatically shrinks the attack surface available to an attacker who gains code execution, limiting exploitation capabilities and reducing the number of CVEs that can affect the image. Fewer components also mean fewer packages to monitor and patch in the base layer.
Always use the latest tag to get the most recent patches
Scan images for vulnerabilities using tools like Trivy or Clair
Vulnerability scanning queries known CVE databases to enumerate flaws in the image's OS packages and application dependencies before deployment. Automating these scans in the CI pipeline and admission control allows you to block images that exceed the risk threshold and alert on newly disclosed vulnerabilities in running workloads. This gives continuous visibility into your image security posture.
Enable image verification using digital signatures (e.g., Notary or Cosign)
Digital signatures provide cryptographic assurance that an image was produced and signed by a trusted identity and that its contents have not been altered after signing. By integrating verification with admission controllers like OPA or Kyverno, you can enforce that only signed images from approved signers are deployed. This prevents tampering in the registry and supply-chain attacks that modify image content.
Want more Minimize Microservice Vulnerabilities practice?
Practice this domain20% of exam · 6 sample questions below
Which TWO of the following are best practices for securing the container supply chain?
Scan images for vulnerabilities in a CI pipeline before deploying.
Scanning images for known vulnerabilities in CI, using tools like Trivy or Grype, catches flaws in OS packages and language dependencies before they reach production. Integrate these scans with policy checks that fail the build on critical or high severity CVEs, and also rescan base images on a schedule, since new vulnerabilities are disclosed after the image is built. This is a reactive measure against known issues, distinct from verifying who built the image or that it hasn't been altered.
Use image signing and verification (e.g., with cosign) to ensure image integrity.
Image signing with cosign cryptographically binds the image manifest to a key held by the publisher, proving identity and origin. Verify the signature in the Kubernetes cluster using an admission controller, such as Kyverno or OPA Gatekeeper, to reject unsigned or tampered images; consider holding keys in a KMS like Vault or AWS KMS. Signing addresses integrity and provenance, whereas vulnerability scanning only identifies known flaws, not whether the artifact is authentic.
Embed API keys directly in container images for authentication.
Allow all images from any registry without verification to speed up development.
Use mutable tags like 'latest' for easier updates.
A DevOps team wants to ensure that only signed images from a trusted registry are deployed in the cluster. They plan to use a webhook to intercept pod creation. Which tool is best suited for this task?
kubectl with --validate flag
Helm with signed charts
etcd with encryption at rest
Kyverno with a verifyImages rule
Kyverno with a verifyImages rule is correct because Kyverno runs as a dynamic admission controller inside the cluster and intercepts Pod creation requests before they are persisted. The verifyImages rule leverages cosign to check each container image's digital signature against the specified public keys, failing admission if the signature is missing or invalid. This enforces a policy that only signed images from trusted registries can run, at the exact point Kubernetes decides to allow the workload.
Prometheus with alerting rules
A security audit reveals that a container image running in production contains a critical vulnerability (CVE-2024-1234). The image was built from a base image that had the vulnerability. What is the MOST effective long-term solution to prevent such issues?
Use a runtime security tool like Falco to detect exploitation attempts.
Patch the vulnerability by installing a security update inside the running container.
Add an admission controller that rejects images with vulnerabilities.
Rebuild the image using a patched base image and integrate vulnerability scanning into the CI pipeline.
Rebuilding the image from a patched base image directly eliminates the vulnerable package from the image filesystem, ensuring that the vulnerability is no longer present in the artifact itself. Integrating vulnerability scanning into the CI pipeline shifts security left, allowing teams to detect and block vulnerable images before they are pushed to a registry or deployed. This approach is sustainable and reproducible, as every build is validated and known vulnerabilities trigger a pipeline failure, forcing developers to update dependencies promptly. It addresses the source of the issue rather than applying after-the-fact controls.
Switch to a different container runtime that is immune to the vulnerability.
An organization uses a private container registry and wants to ensure that only images built from a specific CI/CD pipeline are deployed. Which combination of measures provides the strongest guarantee?
Implement network policies to restrict egress from pods to the registry.
Grant registry write access only to the CI system's service account.
Use a static analysis tool to check the Dockerfile before building.
Use a unique registry path and restrict access via firewall rules.
Generate signed attestations with in-toto during the CI pipeline and verify them using an admission webhook like Kyverno.
In-toto attestations are cryptographically signed metadata generated during the CI pipeline that describe the build steps, materials, and results, providing non-repudiation for the image's origin. An admission webhook such as Kyverno can be configured to verify these signatures and attestations at admission time, ensuring that only images produced by the trusted pipeline and with valid provenance are allowed to run. This combination enables robust supply-chain security by tying the runtime state to an auditable, tamper-evident build process.
You are the lead security engineer for a large financial institution. The organization runs a Kubernetes cluster with 500+ microservices. The supply chain security team has implemented the following measures: (1) All images are built from a minimal base image (distroless) and scanned with Trivy before being pushed to a private registry. (2) Images are signed using cosign with a key stored in a hardware security module (HSM). (3) Kyverno policies enforce that only signed images from the private registry can run, and also enforce that containers run as non-root. (4) A binary authorization (binauthz) style admission controller verifies attestations. Recently, a critical vulnerability (CVE-2024-0001) was discovered in a popular open-source library used by several microservices. The library is included as a dependency in the base image. The vulnerability is remotely exploitable and has a CVSS score of 9.8. The security team needs to remediate this quickly. They have already patched the library and updated the base image. What is the BEST course of action to ensure all running pods use the new image?
Update the image tag in each Deployment's spec to point to the new patched image, then perform a rolling update. The admission controller will verify signatures and attestations for the new image.
Updating the image tag in each Deployment's PodTemplateSpec is the correct declarative approach: it triggers a rolling replacement of the underlying ReplicaSets, so old pods are terminated only after new ones become Ready. During pod creation, the cluster's validating/mutating admission controller (e.g., Kyverno or OPA via cosign) checks the image's cryptographic signature and attestations; if the patched image is signed and passes policy, the update proceeds. This ensures every pod runs a verified, patched image with zero downtime.
SSH into each node, pull the new image, and use kubectl exec to update the library inside running containers.
Temporarily disable the admission controller that verifies signatures and then update the image tags.
Delete all running pods and let the ReplicaSets recreate them from the existing image.
A development team uses a custom container image for their application, built from a base image that includes multiple CVEs. The security team requires that no container runs with known critical vulnerabilities. Which approach best ensures that only images with no critical vulnerabilities are deployed in production?
Configure a Kubernetes admission controller (e.g., Kyverno) to reject pods using images with critical vulnerabilities.
Scan the base image before building the application image.
Integrate an image scanner (e.g., Trivy) into the CI/CD pipeline to block builds with critical vulnerabilities.
Integrating a scanner like Trivy into the CI/CD pipeline creates a build-time quality gate: it scans the final image after all layers are assembled and fails the pipeline if critical vulnerabilities are found, so vulnerable images are never pushed to the container registry. This shift-left approach automates prevention at the earliest practical stage and provides a clear signal to developers before the image reaches deployment. This is the recommended primary control for supply chain security.
Manually review vulnerability reports after the image is deployed.
Want more Supply Chain Security practice?
Practice this domain20% of exam · 6 sample questions below
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?
The rule is missing `proc.name in (bash, sh, zsh)` because only bash is checked
Falco is not running with the required syscall capabilities
The `spawned_process` macro may not match because the process was inherited (not spawned), e.g., from an entrypoint
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.
The priority is set to `ERROR` but the output is being filtered
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?
rules: [- level: RequestResponse, resources: [group: '', resources: [*]], - level: Metadata]
rules: [- level: RequestResponse, resources: [group: '', resources: [secrets]], namespaces: [kube-system], - level: Metadata]
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.
rules: [- level: Metadata, resources: [group: '', resources: [secrets]], namespaces: [kube-system], - level: RequestResponse]
rules: [- level: Metadata, resources: [group: '', resources: [secrets]], namespaces: [kube-system], omitStages: [RequestReceived], - level: RequestResponse]
You have deployed a pod and set `securityContext.readOnlyRootFilesystem: true`. The pod is failing to start with an error about writing to `/tmp`. What is the most likely cause?
The `securityContext` is misspelled
The pod is missing an emptyDir volume mounted at `/tmp`
The correct fix is to create a dedicated emptyDir volume and mount it at /tmp. When readOnlyRootFilesystem is true, the container's root filesystem is mounted with the MS_RDONLY flag, so every write attempt to any path on that filesystem returns EROFS — regardless of permissions. An emptyDir volume provides a separate, writable filesystem (initially empty, typically backed by the node's disk or tmpfs) that can be mounted exactly where the application expects to write temporary data, allowing the container to work while preserving the immutability of the root filesystem.
The container image does not have `/tmp` directory
The container is running as a non-root user
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?
open
connect
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.
execve
bind
You are writing a Falco rule to detect when a container tries to read the file `/etc/shadow`. Which condition in the Falco rule correctly matches this event?
container.name=shadow and evt.type=open
evt.type=read and fd.name=/etc/shadow
proc.name=cat and fd.name=/etc/shadow
evt.type=open and fd.name=/etc/shadow
The `open` syscall is the initial operation that must occur before any file content can be read or modified; when a process calls `open` on `/etc/shadow`, Falco's `fd.name` is populated directly from the path argument, making this condition both reliable and comprehensive. This rule detects any attempt to open the shadow file, regardless of the intended operation (read, write, or execute) and regardless of the process name or container name. It is the precise, minimal condition that catches unauthorized access to sensitive credential files, and it is the standard cornerstone for such Falco rules.
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?
kubectl cordon <node-of-compromised-pod>
kubectl label pod compromised-pod isolated=true && kubectl apply -f networkpolicy.yaml
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.
kubectl delete pod compromised-pod && kubectl describe pod compromised-pod
kubectl exec compromised-pod -- killall miner-process
Want more Monitoring, Logging and Runtime Security practice?
Practice this domainA security team is hardening a Kubernetes cluster. They need to ensure that all control plane components run with the least privilege. Which approach should they take?
Use seccomp profiles to block privilege escalation syscalls
Apply AppArmor profiles to all control plane pods
Configure control plane containers to run as non-root user and with read-only root filesystem
Setting runAsNonRoot: true and an explicit runAsUser (for example, 1000) in the pod security context, along with readOnlyRootFilesystem: true, directly removes root privileges and makes the container's immutable root filesystem fail-closed on any write attempt. This is the most effective hardening for control plane components because it attacks both privilege escalation and tampering of the container's filesystem at the source, rather than filtering specific kernel or program actions.
Enable PodSecurityPolicy with 'MustRunAsNonRoot' for control plane namespaces
An administrator wants to restrict pods from running as root. Which admission controller should be enabled?
NodeRestriction
AlwaysPullImages
ServiceAccount
PodSecurity
PodSecurity is the correct answer because it is a built-in admission controller that enforces the Pod Security Standards, specifically the 'restricted' profile, which mandates that containers run as a non-root user (e.g., runAsNonRoot: true and runAsUser set to a non-zero ID). It validates the Pod's securityContext during creation and rejects any Pod that attempts to run as root. This directly implements the administrator's policy to restrict root execution.
A cluster has been compromised due to a container running with privileged escalation. The team wants to prevent any container from gaining new privileges. Which configuration should be applied?
Set securityContext.runAsUser: 1000
Set securityContext.readOnlyRootFilesystem: true
Drop all capabilities with securityContext.capabilities.drop: ["ALL"]
Set securityContext.allowPrivilegeEscalation: false
Setting allowPrivilegeEscalation: false directly applies the Linux 'no_new_privs' flag to the container process, which prevents the process and its children from ever gaining more privileges than their original execution context, even if a later exec of a setuid-root or capability-enabled binary occurs. This is a kernel-level mechanism that blocks the common privilege-escalation vectors such as SUID binaries, file capabilities, and certain ioctl-based operations. It is the most direct security control among the options because it explicitly targets the privilege-escalation mechanism itself, rather than only constraining the user ID, filesystem, or capabilities. For this compromised container, this setting is necessary to contain the breach and prevent further elevation.
During a security audit, it was found that some pods have access to the host network. How can an administrator restrict host network access for all pods in the cluster?
Set --allow-privileged=false in kubelet configuration
Enable PodSecurity admission controller with baseline or restricted profile
Pod Security Admission (PSA) is the built-in admission controller that enforces the Pod Security Standards, and both the `baseline` and `restricted` policies require `hostNetwork` to be set to `false` (with `restricted` also forbidding other host namespaces). By applying a PSA level of `baseline` or `restricted` at the cluster, namespace, or label-based level, the API server will reject any new pod that tries to use host networking. This is the recommended, current replacement for the removed PodSecurityPolicy, and it directly blocks the offending capability. Note that PSA only applies to newly created pods, so existing pods must be recreated or patched to bring them into compliance.
Enable PodSecurityPolicy with 'hostNetwork: false'
Create NetworkPolicies that deny traffic to host network
A DevOps team wants to ensure that all container images are pulled from a trusted registry only. Which cluster-level configuration should be applied?
Configure kubelet with --pod-manifest-path pointing to a whitelist
Enable PodSecurity with restricted profile
Use NetworkPolicy to block traffic to untrusted registries
Enable ImagePolicyWebhook admission controller
ImagePolicyWebhook is an admission controller that intercepts Pod create and update operations and sends an ImageReview payload containing each container's image name to an external HTTP/HTTPS service. The webhook responds with an admission decision, allowing an administrator to reject any image that doesn't come from a trusted registry, tag, or digest. This is the standard built-in mechanism for applying a centralized, registry-aware image policy to every Pod submitted through the API server.
An attacker exploited a container escape vulnerability. The team wants to mitigate such attacks by restricting containers from accessing the host's kernel capabilities. Which set of capabilities should be dropped from all containers?
SYS_ADMIN, SYS_MODULE, SYS_PTRACE
These capabilities permit privileged kernel operations: SYS_ADMIN enables mount and namespace manipulation, SYS_MODULE loads kernel modules, and SYS_PTRACE inspects other processes. Dropping them removes the primitives container escapes rely on, satisfying the stem's requirement to restrict host kernel access.
CHOWN, DAC_OVERRIDE, FOWNER
KILL, SETPCAP, SYS_CHROOT
NET_RAW, NET_ADMIN, NET_BIND_SERVICE
Want more System Hardening practice?
Practice this domainA team needs to set up a highly available Kubernetes control plane across three availability zones. What is the minimum number of etcd members required to achieve fault tolerance against one zone failure?
5
1
3
Three control plane nodes are the minimum required for high availability because etcd quorum for a 3-node cluster is two, meaning the cluster can survive the loss of one node. With only two nodes, a single failure would leave one node and no majority, so three is the smallest odd number that provides fault tolerance. This is the standard recommendation for production Kubernetes control planes.
7
A security audit reveals that the kube-apiserver is using the default insecure port 8080 on a production cluster. Which is the most secure and recommended remediation?
Change the --insecure-port flag to 0
Set --insecure-port=0 and ensure --secure-port=6443 is configured
Setting --insecure-port=0 disables the plaintext HTTP endpoint on the kube-apiserver, eliminating unauthenticated access. Simultaneously ensuring --secure-port=6443 is configured guarantees that all API communication is served over TLS on the standard secure port, using client certificate and token authentication. This combination is the recommended hardening measure per Kubernetes documentation.
Set --insecure-port=6443
Set --secure-port=8080
A cluster is using kubeadm and the control plane components are running as static pods. Where are the static pod manifests for the API server located by default?
/var/lib/kubelet/
/etc/kubernetes/manifests/
/etc/kubernetes/manifests/ is the default static pod manifest directory in a kubeadm cluster. The kubelet watches this directory for YAML/JSON files and automatically creates and manages the pods they define, which is how the control plane components (kube-apiserver, kube-controller-manager, kube-scheduler, and etcd) are launched. This directory is the correct place for these manifests because the kubelet's staticPodPath is set to this location during kubeadm initialization, making it the source of truth for the control plane pods.
/etc/kubernetes/admin.conf
/etc/kubernetes/
A security team wants to ensure that all communication between the kubelet and the API server is encrypted. Which flag must be set on the kubelet to enforce this?
--tls-cert-file
--node-status-update-frequency
--kubeconfig
The --kubeconfig flag is the correct mechanism because the kubeconfig file defines the API server endpoint (typically an HTTPS URL), the CA certificate used to verify the server, and the kubelet's client credentials for authentication. When the kubelet starts with --kubeconfig, it uses this file to establish a mutually authenticated, TLS-encrypted connection to the API server. Requiring a kubeconfig that points to the API server over HTTPS ensures all control-plane traffic from the kubelet is encrypted in transit.
--require-kubeconfig
Order the steps to rotate a Kubernetes API server certificate.
1. Generate a new certificate and key pair for the API server. 2. Replace the existing certificate files on the control plane node. 3. Restart the kube-apiserver process or container. 4. Verify the new certificate is serving correctly using curl or openssl.
This is the correct order because the new certificate must be generated first, then its files must replace the old ones, the API server must be restarted to load the new certificate, and finally verification ensures the process succeeded.
1. Restart the kube-apiserver process. 2. Generate a new certificate. 3. Replace the old certificates. 4. Verify.
1. Replace the existing certificate files. 2. Generate a new certificate. 3. Restart the API server. 4. Verify.
1. Generate new certificate. 2. Replace old files. 3. Verify using curl. 4. Restart API server.
Match each Kubernetes admission controller to its role in security.
NodeRestriction: Limits the permissions of kubelet nodes to prevent unauthorized operations.
NodeRestriction admission controller is specifically designed to limit the kubelet's permissions on Node and Pod API objects. It ensures that a kubelet can only modify its own Node object and pods bound to it, and cannot add or edit labels, taints, or status fields that could be used to escalate privileges or disrupt the cluster. This prevents a compromised kubelet from impersonating another node or altering critical metadata.
PodSecurity: Enforces Pod Security Standards (privileged, baseline, restricted).
PodSecurity is a built-in admission controller that enforces the Pod Security Standards defined by Kubernetes. It applies the privileged, baseline, or restricted profiles based on the namespace's pod-security labels, and it can either enforce, audit, or warn on policy violations. This controller replaces the deprecated PodSecurityPolicy and validates pod specifications at creation time, refusing or logging workloads that exceed the configured security constraints.
ServiceAccount: Controls automounting of service account tokens to pods.
The ServiceAccount admission controller governs how service account tokens are mounted into pods. It checks the automountServiceAccountToken field on both the pod and the service account, and by default sets a token volume even if no explicit mount is requested. This controller can deny or modify the automount behavior, which is critical for limiting the exposure of the cluster's API credentials to containers that do not need them.
AlwaysPullImages: Forces pods to always pull container images, ensuring no local cached images are used without verification.
AlwaysPullImages is an admission controller that overwrites every pod's imagePullPolicy to Always, regardless of what the user specified. This forces the kubelet to contact the image registry on each container start, preventing the use of potentially stale or tampered images already cached on the node. It is commonly used in multi-tenant clusters to ensure that only registry-defined images run, and that image credentials are always validated for each pull.
NodeRestriction: Controls automounting of service account tokens to pods.
PodSecurity: Limits the permissions of kubelet nodes.
Want more Cluster Setup practice?
Practice this domainA security team wants to ensure that all pods in a namespace run with a restricted seccomp profile. Which Pod Security Standard admission controller mode should be used to enforce this without blocking necessary pods?
Enable the PodSecurity admission plugin with the 'restricted' policy and 'enforce' mode
PodSecurity admission with the 'restricted' policy in 'enforce' mode acts as an admission controller that rejects any pod that fails the restricted profile, including the requirement that seccomp be set to RuntimeDefault or Localhost. This directly blocks non-compliant pods at creation time, ensuring only pods meeting the strict security requirements run in the namespace. Enforce mode is the only mode that provides hard enforcement, making this the correct choice.
Use a mutating admission webhook to automatically add seccomp profiles
Enable the PodSecurity admission plugin with the 'baseline' policy and 'enforce' mode
Enable the PodSecurity admission plugin with the 'restricted' policy and 'warn' mode
A cluster uses RBAC and a ServiceAccount 'monitor' in namespace 'observability'. The account needs to list pods in all namespaces. Which ClusterRole and binding should be created?
Role with 'list' on pods, RoleBinding in observability
ClusterRole with 'get' on pods, ClusterRoleBinding
ClusterRole with 'list' on pods, RoleBinding in observability
ClusterRole with 'list' on pods, ClusterRoleBinding
A ClusterRole is not bound to any namespace, and a ClusterRoleBinding grants its permissions cluster-wide or across all namespaces. By combining the 'list' verb on pods with these two cluster-scoped resources, the monitor ServiceAccount can list pods in every namespace. This is the standard and correct way to grant cross-namespace pod enumeration in RBAC.
An administrator wants to prevent pods from running as root. Which SecurityContext field should be set at the pod level?
fsGroup: 2000
runAsGroup: 3000
runAsUser: 1000
runAsNonRoot: true
When set to true, this securityContext field enforces at admission and runtime that the container's UID is non-zero. If the image's configured user or an explicit runAsUser is 0, Kubernetes will refuse to start the pod, producing a CreateContainerConfigError or validation failure. This directly meets the requirement to prevent pods from running as root, making it the correct choice.
A company uses kube-bench to scan their cluster. The report shows a warning: 'Ensure that the --authorization-mode argument is set to Node,RBAC'. What is the best way to fix this?
Add --authorization-mode=AlwaysDeny to the API server
Restart the API server with --authorization-webhook-config-file
Set --authorization-mode=RBAC only
Edit the kube-apiserver manifest to add --authorization-mode=Node,RBAC
Editing the kube-apiserver static manifest under /etc/kubernetes/manifests to add --authorization-mode=Node,RBAC is exactly what the CIS benchmark expects. This enables the Node authorizer for kubelet requests and the RBAC authorizer for all other identities, covering the two essential authorization paths. The kubelet will detect the manifest change and restart the API server as a static pod. This is the recommended configuration identified by kube-bench.
A pod is failing to start with: 'Error: container has runAsNonRoot and image will run as root'. The pod spec sets securityContext.runAsNonRoot: true. The container image is 'nginx:latest' which runs as root. Which change allows the pod to run while maintaining security?
Remove runAsNonRoot: true
Add a PodSecurityPolicy that allows root
Set runAsUser: 1000 in the container securityContext
Setting runAsUser: 1000 in the container's securityContext explicitly forces the container process to run with a non-zero UID, which satisfies the runAsNonRoot: true validation. The kubelet checks that the effective UID of the container is not 0; by fixing the UID to 1000, the check passes while maintaining a secure, non-root execution model. This is the minimal, direct, and security-preserving fix.
Use a mutating webhook to change the image
Which Kubernetes resource should be used to restrict egress traffic from pods?
NetworkPolicy with egress rules
NetworkPolicy with egress rules is the Kubernetes-native resource for restricting outbound traffic. An egress rule can select target pods via podSelector, namespaceSelector, or CIDR blocks, and also specify allowed ports. This provides API-declarative, label-based access control at L3/L4, enforced by the CNI plugin (e.g., Calico, Cilium). Since NetworkPolicy is a namespaced resource scoped to pods, it is the correct and supported mechanism to directly limit egress within a cluster.
PodSecurityPolicy
iptables rules on nodes
NetworkPolicy with ingress rules
Want more Cluster Hardening practice?
Practice this domainThe CKS exam is performance-based — there are no multiple-choice questions. It is a hands-on lab exam completed within 120 minutes. You complete practical tasks in a live or simulated environment. Courseiva practice questions cover the underlying concepts.
Hands-on Kubernetes security tasks in a live cluster environment.
The exam covers 6 domains: Minimize Microservice Vulnerabilities, Supply Chain Security, Monitoring, Logging and Runtime Security, System Hardening, Cluster Setup, Cluster Hardening. Questions are weighted by domain — higher-weight domains appear more on your actual exam.
No. These are original exam-style practice questions written against the official CNCF CKS exam objectives. They are not copied from the real exam. Courseiva focuses on genuine understanding, not memorisation of braindumps.
Courseiva tracks your accuracy per domain and routes you toward weak areas automatically. Free, no account required.