Explore / Exam Prep for the Certified Kubernetes Security Specialist (CKS) / Practice questions
Certified Kubernetes Security Specialist (CKS) practice questions
10 questions from the bank behind this course's timed mock. Free to read and to answer, no account needed, and each has its answer and an explanation. They belong to Exam Prep for the Certified Kubernetes Security Specialist (CKS).
Answer them one at a time →Read lesson 1 free
Question 1
You are a platform engineer preparing for the CKS. Your next practice task is to add audit logging flags to the kube-apiserver and then load an AppArmor profile on a node. You have two labs: a three-node kind cluster running Cilium, and a two-VM kubeadm cluster. Which lab should you use, and why?
- The kind cluster, because its nodes are containers and can be recreated quickly if you break the API server
- The kubeadm VM cluster, because these tasks need a real host where you can edit kube-apiserver flags and load AppArmor profiles
- Either lab, because kind and kubeadm give you the same access to node files and control-plane flags
- The kind cluster, because Cilium has to be running before audit logging or AppArmor will work
Show the answer
Answer: B. The kubeadm VM cluster, because these tasks need a real host where you can edit kube-apiserver flags and load AppArmor profiles
The lesson uses the kubeadm VMs for host-level work such as audit logging, AppArmor and kube-bench, because kind nodes are containers rather than real hosts. Fast recreation is a real advantage of kind, but it does not give you the host access these tasks need.
Question 2
You are a security engineer auditing a kubeadm worker node. From the node itself you run `curl -sk https://localhost:10250/pods` with no credentials, and the kubelet returns a full JSON list of the pods running on the node. Which kubelet configuration explains this result?
- `authentication.anonymous.enabled` is true and `authorization.mode` is `AlwaysAllow`
- `authentication.x509.clientCAFile` is missing and `authorization.mode` is `Webhook`
- `authentication.anonymous.enabled` is false and `readOnlyPort` is 10255
- `authentication.anonymous.enabled` is true and `authorization.mode` is `Webhook`
Show the answer
Answer: A. `authentication.anonymous.enabled` is true and `authorization.mode` is `AlwaysAllow`
Data comes back without credentials only when anonymous requests are accepted and authorization approves them unchecked, which is the worst case. With anonymous auth on but Webhook authorization, the API server would refuse `system:anonymous` and you would see `Forbidden`, not pod data.
Question 3
A platform engineer is setting up access for a new monitoring agent user named prom-agent. The agent must list nodes and call the non-resource URL /healthz. It needs nothing else. Which approach meets this requirement?
- Bind the built-in view ClusterRole to prom-agent with a RoleBinding in the default namespace.
- Create a Role that grants list on nodes in each namespace, then bind it with a RoleBinding in each namespace.
- Create a ClusterRole that grants list on nodes and get on /healthz, then bind it to prom-agent with a ClusterRoleBinding.
- Create a ClusterRole that grants list on nodes and get on /healthz, then bind it to prom-agent with a RoleBinding in kube-system.
Show the answer
Answer: C. Create a ClusterRole that grants list on nodes and get on /healthz, then bind it to prom-agent with a ClusterRoleBinding.
Nodes are cluster-scoped resources and /healthz is a non-resource URL, so only a ClusterRoleBinding can grant them. A RoleBinding in kube-system limits the ClusterRole to that one namespace, so it cannot grant nodes or /healthz.
Question 4
You are the cluster administrator. You have just upgraded controlplane to v1.37.1 using kubeadm. node01 still runs kubelet v1.36.5, and the change window closes before you can upgrade it. Your security lead asks whether the cluster is in a supported state until the next window. What is the best answer?
- No. The kubelet may be at most one minor version older than kube-apiserver, but the patch versions must also match.
- Yes, but only if node01's kubelet is upgraded first next time, because the kubelet should always lead the API server.
- Yes. A kubelet may be up to three minor versions older than kube-apiserver, so a v1.36 kubelet with a v1.37 API server is within the supported skew.
- No. The kubelet must run exactly the same minor version as kube-apiserver, so node01 must be upgraded before the window closes.
Show the answer
Answer: C. Yes. A kubelet may be up to three minor versions older than kube-apiserver, so a v1.36 kubelet with a v1.37 API server is within the supported skew.
The skew policy allows a kubelet to be up to three minor versions older than the API server, but never newer, so v1.36 with v1.37 is supported. The one-minor-version limit is the rule for kubectl, not for the kubelet, and the kubelet must never lead the API server.
Question 5
You are the security engineer for a cluster. A Pod manifest sets `spec.securityContext.seccompProfile.type: RuntimeDefault`, and its only container sets `securityContext.privileged: true`. After deployment, `kubectl exec <pod> -- grep Seccomp /proc/1/status` prints `Seccomp: 0`. What is the most likely explanation?
- The kubelet on that node was not started with `--seccomp-default`, so the RuntimeDefault setting is ignored
- RuntimeDefault takes effect only when it is set per container, so the Pod-level setting is ignored
- The container is privileged, and privileged containers always run Unconfined whatever seccomp profile is set
- The container runtime's default profile is missing from `/var/lib/kubelet/seccomp`, so the runtime fell back to Unconfined
Show the answer
Answer: C. The container is privileged, and privileged containers always run Unconfined whatever seccomp profile is set
`Seccomp: 0` means Unconfined, and a container with `privileged: true` always runs Unconfined, so the profile cannot protect it. `--seccomp-default` only sets a default for Pods that specify no profile. It is not needed when a Pod sets RuntimeDefault explicitly.
Question 6
As the platform security lead, you are reviewing a cluster that encrypts Secrets with a local aescbc provider. An auditor asks why the upstream Kubernetes documentation does not recommend the local AES providers for production, and recommends a KMS provider instead. Which two statements match the upstream guidance? (Select TWO.)
More than one answer is right.
- aescbc is vulnerable to padding-oracle attacks
- aesgcm keys must be rotated every 200,000 writes
- aesgcm only works when a KMS plugin is also running on the control plane
- Local AES providers encrypt data when it is read from etcd, not when it is written
- aescbc cannot read Secrets that were previously stored with the identity provider
Show the answer
Answers: A. aescbc is vulnerable to padding-oracle attacks; B. aesgcm keys must be rotated every 200,000 writes
The upstream docs list padding-oracle exposure for aescbc and a rotation requirement every 200,000 writes for aesgcm, which is why KMS is recommended for production. Reading old plain-text data is handled by listing identity last in the providers list, not by aescbc, so the statement that aescbc cannot read identity data misplaces that job.
Question 7
You are a platform security engineer. In namespace 'prod', Deployment 'web' (label app=web) is fronted by a Service that maps port 8080 to targetPort 9090, and the container also serves metrics on container port 15090. The namespace must stay STRICT, but a legacy scraper outside the mesh needs plain-text access to the metrics port only. You write a workload PeerAuthentication with selector app=web and mtls mode STRICT. Which portLevelMtls entry meets the goal?
- portLevelMtls: { 9090: { mode: PERMISSIVE } }
- portLevelMtls: { 15090: { mode: UNSET } }
- portLevelMtls: { 8080: { mode: PERMISSIVE } }
- portLevelMtls: { 15090: { mode: PERMISSIVE } }
Show the answer
Answer: D. portLevelMtls: { 15090: { mode: PERMISSIVE } }
portLevelMtls is keyed by the container port, and PERMISSIVE lets plain-text callers in, so 15090 with PERMISSIVE opens only the metrics port. UNSET on 15090 just inherits STRICT from the policy, and 8080 is a Service port, not a container port. 9090 is the app port, so that entry would expose the wrong traffic.
Question 8
You are a platform engineer adding a Trivy step to a CI pipeline. The rule is that the build must fail only when the image has at least one CRITICAL vulnerability. HIGH and lower findings must not block the build. Which command meets this rule?
- trivy image --exit-code 1 --severity CRITICAL registry.local/app:2.3
- trivy image --severity CRITICAL registry.local/app:2.3
- trivy image --exit-code 1 registry.local/app:2.3
- trivy image -q --ignore-unfixed --severity CRITICAL registry.local/app:2.3
Show the answer
Answer: A. trivy image --exit-code 1 --severity CRITICAL registry.local/app:2.3
`--exit-code 1` makes Trivy return a non-zero code when it finds something, and that check only counts the severities passed to `--severity`, so only CRITICAL findings fail the build. Without `--exit-code 1`, `--severity CRITICAL` only filters the report and the command still exits 0, so the pipeline never fails.
Question 9
You are a platform engineer hardening a namespace. The task says: "Harden /opt/app/web.yaml until the scanner reports a passing result with a score of at least 5." It does not name a tool. Which tool's output can show you directly that you have met this requirement?
- kubesec scan /opt/app/web.yaml, because it reports a numeric score and a Passed or Failed message for each object
- trivy image on the container image, because it rates the severity of each finding
- kube-linter lint /opt/app/web.yaml, because it exits 0 once the manifest reaches the required score
- kube-linter checks list, because it shows how many points each check is worth
Show the answer
Answer: A. kubesec scan /opt/app/web.yaml, because it reports a numeric score and a Passed or Failed message for each object
Kubesec is the tool that gives a points score ("Passed with a score of ..."), so it is the one that can confirm a score requirement. KubeLinter gives only pass or fail for each check and an exit code. It has no score, so exit code 0 cannot prove a score of 5.
Question 10
You are the on-call security engineer. While mapping Falco container IDs on worker1 with crictl inspect, you find a second container running in Pod shop/sync-29011206-abcde. Nobody on your team deployed anything called 'sync'. Before you choose a response, you need to know what kind of workload created this Pod and which attack phase it represents. Which conclusion is best?
- The name ends in a random suffix, so it is a static Pod. Remove its manifest from /etc/kubernetes/manifests and treat it as Privilege Escalation.
- The name follows the <deployment>-<replicaset-hash>-<suffix> pattern, so it is a Deployment replica. Scale the Deployment to 0 and treat it as Initial Access.
- The name contains a numeric ID, so someone created it with kubectl exec -it. Treat it as Execution by a holder of valid credentials.
- The name follows the <cronjob>-<schedule-id>-<suffix> pattern, so it is probably a Job started by a CronJob. Confirm with kubectl -n shop get cronjob,job,pod --sort-by=.metadata.creationTimestamp and treat it as Persistence.
Show the answer
Answer: D. The name follows the <cronjob>-<schedule-id>-<suffix> pattern, so it is probably a Job started by a CronJob. Confirm with kubectl -n shop get cronjob,job,pod --sort-by=.metadata.creationTimestamp and treat it as Persistence.
Pods created by a CronJob are named <cronjob>-<schedule-id>-<suffix>, and a CronJob the attacker created is the Persistence technique 'Kubernetes CronJob'. Deployment Pods have a ReplicaSet hash, not a numeric schedule ID, so treating it as a Deployment replica would point you to the wrong owner to remove.
The full timed mock
50 questions in 75 minutes, with a pass mark of 67%. Each paper is drawn from a bank of questions written for the mock alone, and these 10 are left out of it. Full access opens it, with every level of the course.
LevelUpWith is independent of the organisation that sets this exam. These questions were written for this course; they are not taken from the exam.