# Free KCSA practice questions

> 10 free KCSA practice questions with the correct answer and an explanation.

Page: https://devopscodelab.com/exams/kcsa-kubernetes-security/free-practice-questions/
Practice exams: https://devopscodelab.com/exams/kcsa-kubernetes-security/

### Question 1 of 10

A company processes sensitive workloads from two business units that must not be able to affect each other even if a container escape occurs. Which isolation approach gives the STRONGEST separation?

- A. Apply the restricted Pod Security Standard to both namespaces and require read-only root filesystems
- B. Run each business unit in its own cluster, or at least on dedicated node pools with sandboxed runtimes
- C. Assign each business unit a separate ResourceQuota and a PriorityClass so that they cannot starve each other
- D. Give each business unit its own namespace with a default-deny NetworkPolicy and separate RBAC roles

**Answer:** B

**Explanation:** A container escape gives access to the node, so separating units by cluster (or at least by dedicated nodes, ideally with sandboxed runtimes such as gVisor or Kata) is what keeps one unit from reaching the other. Namespaces, network policy and RBAC are logical controls that share nodes and the kernel. Pod Security Standards reduce escape likelihood but do not contain one, and quotas address resource fairness only.

### Question 2 of 10 (choose 2)

Which TWO controller manager settings are recommended hardening steps by the CIS Kubernetes Benchmark? (Choose two.)

- A. Set --bind-address=0.0.0.0 so that health checks from any network can reach the controller manager
- B. Set --profiling=false to disable the profiling endpoint that is not needed in production
- C. Set --use-service-account-credentials=true so that each controller uses its own service account
- D. Set --service-account-private-key-file to the cluster CA certificate instead of a dedicated key
- E. Set --authorization-always-allow-paths to every path so that metrics scraping never fails

**Answer:** B, C

**Explanation:** Using per-controller service account credentials gives each controller only the RBAC permissions it needs, and disabling profiling removes an unnecessary endpoint that could leak information. Binding to all interfaces widens exposure; the benchmark recommends 127.0.0.1. The service account signing key must be a private key, not the CA certificate, and always-allowing every path bypasses authorization.

### Question 3 of 10 (choose 2)

Which TWO statements about static pods are correct from a security perspective? (Choose two.)

- A. They are created by the kubelet from files on the node and are not admitted through the API server's admission chain
- B. They are always restricted by Pod Security Admission because the mirror pod is validated on creation
- C. They can only reference ConfigMaps and Secrets from the kube-system namespace in the cluster
- D. Write access to the static pod directory on a node lets an attacker run arbitrary pods on that node
- E. They are scheduled by kube-scheduler, which applies node affinity before the kubelet starts them

**Answer:** A, D

**Explanation:** The kubelet runs static pods directly from its manifest directory, so they do not depend on the API server and its admission controls for execution; whoever can write that directory can run pods on the node. Mirror pods may be rejected but the kubelet still runs the static pod. Static pods are not scheduled by the scheduler and cannot reference API objects such as ConfigMaps or Secrets at all.

### Question 4 of 10

During an incident review, an engineer filters audit events for a kubectl port-forward session that was still open when the logs were exported. Besides RequestReceived, which stage value would those events show?

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

**Answer:** C

**Explanation:** Long-running requests such as port-forward, exec, watch or followed logs emit a ResponseStarted event once headers are sent, and ResponseComplete only when the stream ends, so an open session shows RequestReceived and ResponseStarted. ResponseComplete would appear only after the session closed, and Panic is generated only when the API server panics while handling the request.

### Question 5 of 10

A namespace is labeled pod-security.kubernetes.io/enforce=restricted. A developer applies a Deployment whose pod template runs as root. What happens?

- A. The Deployment object is created, but its ReplicaSet cannot create the pods because they are rejected
- B. The pods are created and a warning is written to the audit log because enforce only records violations
- C. The pods are created but the kubelet silently changes them to run as a non-root user with UID 1000
- D. The Deployment object is rejected immediately by the API server with a pod security violation error

**Answer:** A

**Explanation:** The enforce mode of Pod Security Admission checks Pod objects, so a Deployment is accepted and the failure appears when its ReplicaSet tries to create pods. The warn and audit modes also evaluate workload templates, which is why combining them with enforce gives earlier feedback. Enforce does not merely log, and the kubelet never rewrites the user a container runs as.

### Question 6 of 10

In 2018, attackers found an unprotected Kubernetes Dashboard in a cloud account and used it to run cryptomining pods. Which control would have MOST directly prevented this initial access?

- A. Running the dashboard with a read-only root filesystem so that miners could not be installed
- B. Keeping the dashboard private and requiring authentication with a least-privilege account
- C. Applying a ResourceQuota so that cryptomining pods could not exceed their CPU limit allowance
- D. Encrypting Secrets at rest so that the cloud keys stored in the cluster could not be decrypted

**Answer:** B

**Explanation:** The root cause was a dashboard exposed without authentication and running with broad privileges; keeping it private and requiring authenticated least-privilege access closes that entry point. Quotas only limit consumption after access is gained, encryption at rest does not protect values readable through the API, and a read-only dashboard filesystem does not stop it from creating new pods.

### Question 7 of 10

An attacker who compromised a node deletes the Kubernetes Events and stops the logging agent to hide their activity. Which control MOST helps the investigation still succeed?

- A. Ship audit and node logs off-cluster in near real time to write-once storage
- B. Give the logging agent cluster-admin so that the attacker cannot stop it
- C. Run the logging agent with a higher PriorityClass so that it is evicted last
- D. Increase the API server's event TTL so that Events remain stored in etcd for several additional days

**Answer:** A

**Explanation:** Streaming logs off the cluster to tamper-resistant storage preserves evidence even if the attacker deletes local data or stops agents. A longer event TTL keeps Events in etcd where the attacker can still delete them, priority affects eviction rather than tampering, and broad permissions for the agent increase risk without preventing it from being stopped on a compromised node.

### Question 8 of 10

A cluster's CA certificate created by kubeadm will expire in two months. Which statement is correct about planning its renewal?

- A. The CA never needs renewal because kubeadm creates it without an expiry date by default
- B. The CA can be renewed by restarting the API server, which regenerates it with the same private key
- C. CA rotation needs the new CA distributed to all components and clients, so plan a phased rollover
- D. kubeadm certs renew renews the CA together with all leaf certificates automatically during each cluster upgrade

**Answer:** C

**Explanation:** Replacing the cluster CA affects every component and kubeconfig that trusts it, so it must be rolled out in phases with both CAs trusted during the transition. kubeadm certs renew renews leaf certificates, not the CA, during upgrades. Restarting the API server does not regenerate the CA, and kubeadm's CA does have an expiry (ten years by default).

### Question 9 of 10

A platform uses the certificates.k8s.io API to issue client certificates for new administrators. Which signer name should their CertificateSigningRequests use?

- A. kubernetes.io/kubelet-serving
- B. kubernetes.io/legacy-unknown
- C. kubernetes.io/kube-apiserver-client-kubelet
- D. kubernetes.io/kube-apiserver-client

**Answer:** D

**Explanation:** The kubernetes.io/kube-apiserver-client signer issues client certificates that the API server honors for user authentication. kubelet-serving is for kubelet serving certificates, kube-apiserver-client-kubelet is for kubelet client certificates, and legacy-unknown has no guaranteed trust and is not signed by the built-in controller.

### Question 10 of 10

What does policy as code mean in the context of Kubernetes compliance?

- A. Security rules are written only in PDF documents that the compliance team reviews once a year
- B. Auditors write the cluster's application code to embed compliance
- C. Security rules are written as versioned, machine-enforceable definitions
- D. Developers memorize security rules and apply them during code review

**Answer:** C

**Explanation:** Policy as code expresses security and compliance rules in machine-readable form, such as Kyverno, Gatekeeper or ValidatingAdmissionPolicy definitions, stored in version control and enforced automatically. Static documents, memorized rules and auditors writing application code do not provide automated, testable enforcement.

Ready for a timed run? Take the free 15-question KCSA mini exam: https://devopscodelab.com/app/exams/kcsa-kubernetes-security/mini/

DevOpsCode Lab is not affiliated with CNCF. KCSA and related names are trademarks of their owners. We write every question ourselves; these are not real exam questions.
