Linux Foundation CKS Practice Exam Questions & Answers
Linux Foundation CKS Exam Details
Key details for this exam, checked against the published exam outline
- Exam Code
- CKS
- Full Name
- Certified Kubernetes Security Specialist
- Issuing Body
- Linux Foundation and Cloud Native Computing Foundation (CNCF)
- Question Format (Our Bank)
- Multiple Choice
- Delivery
- Online proctored, remote with live proctor monitoring via webcam and screen sharing
- Eligibility
- Candidate must have taken and passed the Certified Kubernetes Administrator (CKA) exam prior to attempting the CKS exam
- Validity
- 2 years from the date the certification is awarded
- Full Question Set
- 64 questions Get All Questions
Free CKS Practice Questions
Answer each question, then see the correct answer and why it is right
Question 1 Domain 2 Cluster Hardening Written answer
Set up a new ServiceAccount called backend-sa within the existing default namespace, giving it permission to list the pods located in the default namespace.
Launch a new Pod named backend-pod in the default namespace, attach the newly made backend-sa service account to that Pod, and confirm that the Pod is able to list pods.
Make sure the Pod is in a running state.
Plan your answer as you would in the exam, then compare it with the model answer
A service account gives identity to processes that run inside a Pod.
When a human user connects to the cluster (for example, using kubectl), the apiserver authenticates that person as a particular User Account, which is usually admin unless your cluster administrator has customized the setup. Processes running in containers inside Pods can also contact the apiserver. When they do, they are authenticated as a particular Service Account (for example, default).
When you create a Pod and do not specify a service account, it is automatically assigned the default service account from the same namespace. If you retrieve the raw JSON or YAML for a Pod you created (for example, kubectl get pods/
You can reach the API from inside a Pod by using automatically mounted service account credentials, as described in Accessing the Cluster. The API permissions a service account has depend on the authorization plugin and policy being used.
In version 1.6+, you can opt out of automounting API credentials for a service account by setting automountServiceAccountToken: false on the service account:
apiVersion: v1
kind: ServiceAccount
metadata:
name: build-robot
automountServiceAccountToken: false
...
In version 1.6+, you can also opt out of automounting API credentials for a particular Pod:
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
serviceAccountName: build-robot
automountServiceAccountToken: false
...
If both the Pod spec and the service account specify an automountServiceAccountToken value, the Pod spec wins.
Question 2 Domain 4 Minimize Microservice Vulnerabilities Lab task
Documentation dockerd
You must log in to the correct host. Failing to do so may result in a score of zero.
[candidate@base] $ ssh cks000037
Task
Carry out the following steps to harden the cluster node cks000037:
Take user developer out of the docker group.
Keep the user in every other group they currently belong to.
Reconfigure and restart the Docker daemon so that the socket
at /var/run/docker.sock is owned by the group root.
Reconfigure and restart the Docker daemon so that it stops listening on every TCP port.
When you are finished, confirm that the Kubernetes cluster is healthy.
Work out the steps and commands you would run, then compare them with the solution
1) Log in to the correct host
ssh cks000037
sudo -i
2) Remove user developer from the docker group only
2.1 Check the current groups (optional, but quick)
id developer
2.2 Remove the user from the docker group alone
gpasswd -d developer docker
2.3 Confirm the removal
id developer
docker should no longer be listed, and all other groups must still be present.
3) Reconfigure Docker to secure the socket and turn off TCP
Docker config file:
vi /etc/docker/daemon.json
3.1 Set the socket group to root and disable TCP listeners
Make sure the file includes exactly these relevant settings (combine them with any existing JSON if it is present):
{
'group': 'root',
'hosts': ['unix:///var/run/docker.sock']
}
Important:
'group': 'root' docker.sock must be owned by group root
'hosts' must contain ONLY the unix socket (no tcp://)
If the file already exists with other keys, change only these keys and keep the JSON valid (watch the commas!).
Save and exit:
:wq
4) Restart the Docker daemon
systemctl daemon-reload
systemctl restart docker
systemctl status docker --no-pager
5) Verify the ownership and permissions of the Docker socket
ls -l /var/run/docker.sock
Expected:
srw-rw---- 1 root root ...
Owner: root
Group: root
6) Verify that Docker is NOT listening on TCP
ss -lntp | grep docker
Expected:
No output (or nothing bound to TCP by dockerd)
Optional double-check:
ps aux | grep dockerd | grep -v grep
Make sure there are no -H tcp://... flags.
7) Confirm the Kubernetes cluster is healthy
7.1 Check the nodes and pods
export KUBECONFIG=/etc/kubernetes/admin.conf
kubectl get nodes
kubectl get pods -A
Every node should show Ready, and the core pods should be Running.
Question 3 Domain 6 Monitoring, Logging and Runtime Security Written answer
Carry out this task on the cluster and nodes listed here: Cluster:immutable-cluster
Master node:master1
Worker node:worker1
To change the cluster/configuration context, run the following command:
[desk@cli] $kubectl config use-context immutable-cluster
Context: Designing containers to be stateless and immutable is considered a best practice.
Task
Review the Pods running in namespaceprod and remove any Pod that is either not stateless or not immutable.
Apply this strict definition of stateless and immutable:
1. Pods that are able to store data inside containers must be considered not stateless.
Note:It does not matter whether data is actually being stored inside containers at present.
2. Pods configured to be privilegedin any way must be considered potentially not stateless or not immutable.
Plan your answer as you would in the exam, then compare it with the model answer


https://cloud.google.com/architecture/best-practices-for-operating-containers
Get the complete CKS question set
$20$40
Question 4 Domain 5 Supply Chain Security Written answer
On the worker node of the cluster, activate the AppArmor profile that has already been prepared.
#include
profile nginx-deny flags=(attach_disconnected) {
#include
file,
# Deny all file writes.
deny /** w,
}
EOF'
Update the prepared manifest file so that it references the AppArmor profile.
apiVersion: v1
kind: Pod
metadata:
name: apparmor-pod
spec:
containers:
name: apparmor-pod
image: nginx
Once that is done, apply the manifest files and launch the Pod they define.
Verification: attempt to create a file within the restricted directory.
Plan your answer as you would in the exam, then compare it with the model answer
Question 5 Domain 1 Cluster Setup Written answer
The cluster and configuration context can be changed with the following command:
[desk@cli] $kubectl config use-context dev
Background
A CIS Benchmark scan was performed on the kubeadm-provisioned cluster and reported several issues that need correcting.
Objective
Resolve every issue through configuration changes, then restart the affected components so the new settings are applied.
Correct all of the following violations reported for the API server:
1.2.7 authorization-mode argument is not set to AlwaysAllow FAIL
1.2.8 authorization-mode argument includes Node FAIL
1.2.7 authorization-mode argument includes RBAC FAIL
Correct all of the following violations reported for the Kubelet:
4.2.1 Ensure that the anonymous-auth argument is set to false FAIL
4.2.2 authorization-mode argument is not set to AlwaysAllow FAIL (Use Webhook authz where possible)
Correct all of the following violations reported for etcd:
2.2 Ensure that the client-cert-auth argument is set to true
Plan your answer as you would in the exam, then compare it with the model answer
worker1 $ vim /var/lib/kubelet/config.yaml
anonymous:
enabled: true #Remove this
enabled: false #Use this instead
authorization:
mode: AlwaysAllow #Remove this
mode: Webhook #Use this instead
worker1 $ systemctl restart kubelet. # Reloads the kubelet configuration
Connect to master1 via ssh
master1 $ vim /etc/kubernetes/manifests/kube-apiserver.yaml
- -- authorization-mode=Node,RBAC
master1 $ vim /etc/kubernetes/manifests/etcd.yaml
- --client-cert-auth=true
Explanation
Connect to worker1 via ssh
worker1 $ vim /var/lib/kubelet/config.yaml
apiVersion: kubelet.config.k8s.io/v1beta1
authentication:
anonymous:
enabled: true #Remove this
enabled: false #Use this instead
webhook:
cacheTTL: 0s
enabled: true
x509:
clientCAFile: /etc/kubernetes/pki/ca.crt
authorization:
mode: AlwaysAllow #Remove this
mode: Webhook #Use this instead
webhook:
cacheAuthorizedTTL: 0s
cacheUnauthorizedTTL: 0s
cgroupDriver: systemd
clusterDNS:
- 10.96.0.10
clusterDomain: cluster.local
cpuManagerReconcilePeriod: 0s
evictionPressureTransitionPeriod: 0s
fileCheckFrequency: 0s
healthzBindAddress: 127.0.0.1
healthzPort: 10248
httpCheckFrequency: 0s
imageMinimumGCAge: 0s
kind: KubeletConfiguration
logging: {}
nodeStatusReportFrequency: 0s
nodeStatusUpdateFrequency: 0s
resolvConf: /run/systemd/resolve/resolv.conf
rotateCertificates: true
runtimeRequestTimeout: 0s
staticPodPath: /etc/kubernetes/manifests
streamingConnectionIdleTimeout: 0s
syncFrequency: 0s
volumeStatsAggPeriod: 0s
worker1 $ systemctl restart kubelet. # Reloads the kubelet configuration
Connect to master1 via ssh
master1 $ vim /etc/kubernetes/manifests/kube-apiserver.yaml

master1 $ vim /etc/kubernetes/manifests/etcd.yaml

Question 6 Domain 2 Cluster Hardening Written answer

Background
For testing purposes, the kubeadm-created cluster's Kubernetes API server was temporarily set up to let unauthenticated and unauthorized requests through, giving the anonymous user duster-admin rights.
Objective
Change the configuration of the cluster's Kubernetes API server so that only requests that are both authenticated and authorized REST calls are accepted.
Set the authorization mode to Node,RBAC and enable the NodeRestriction admission controller.
As a cleanup step, delete the ClusterRoleBinding belonging to the user system:anonymous.


Plan your answer as you would in the exam, then compare it with the model answer
Question 7 Domain 3 System Hardening Written answer
Cluster: dev
Master node:master1
Worker node:worker1
To change to the cluster or configuration context, run the command below:
[desk@cli] $kubectl config use-context dev
Task
Obtain the data held in the current secret namedadamin inside the thesafenamespace.
Write the username value to the file names/home/cert-masters/username.txt and the password value to the file named/home/cert-masters/password.txt.
1. Both files must be created from scratch, since neither one exists yet.
2. Leave the files you created untouched in later steps, and use new temporary files whenever you need them.
Build a new secret called newsecret in the safe namespace, holding the following values:
Username:dbadmin
Password:moresecurepas
Lastly, set up a new Pod that reads the newsecret secret through a volume:
Namespace:\tsafe
Pod name:\tmysecret-pod
Container name:\tdb-container
Image:\t\tredis
Volume name:\tsecret-vol
Mount path:\t/etc/mysecret
Plan your answer as you would in the exam, then compare it with the model answer




Question 8 Domain 3 System Hardening Lab task
Make sure you connect to the right host. Connecting to any other host may
lead to a score of zero.
[candidato@base] $ ssh cks000023
Task
Review and modify the Dockerfile at /home/candidate/subtle-bee/build/Dockerfile, correcting one instruction in the file that presents a clear security or best-practice concern.
Do not add or delete any instructions; change only the single existing instruction that has the security or best-practice problem.
Do not build the Dockerfile, as doing so may exhaust storage and result in a score of zero.
Review and modify the manifest file /home/candidate/subtle-bee/deployment.yaml, correcting one field in the file that presents a clear security or best-practice concern.
Do not add or remove any fields; change only the single existing field that has the security or best-practice problem.
If you need an unprivileged user for any of these tasks, use the user nobody with user ID 65535.
Work out the steps and commands you would run, then compare them with the solution
0) Log in to the correct host
ssh cks000023
sudo -i
PART A: Correct one prominent Dockerfile security or best-practice issue
1) Open the Dockerfile
vi /home/candidate/subtle-bee/build/Dockerfile
2) Locate the most obvious security or best-practice problem and change ONLY that one instruction
Use / search in vi to quickly locate candidates:
Candidate 1 (very common): USER root (or a USER 0 instruction)
Search:
/USER
If you see:
USER root
Change that single instruction to:
USER 65535
(or USER nobody if that exact word is already used in the file; however, the task explicitly allows UID 65535, so USER 65535 is the safest choice.)
This is a one-instruction change and a top-tier best practice.
Candidate 2 (very common): FROM <image>:latest
Search:
/FROM
If you see something like:
FROM nginx:latest
Change ONLY that line to a pinned tag (for example):
FROM nginx:1.25.5
(Any pinned version other than latest will do. Do not add a digest line; only modify the existing FROM line.)
Candidate 3: ADD http://... (remote URL download)
Search:
/ADD
If you see remote URL usage like:
ADD https://example.com/app.tar.gz /app/
Change that single instruction to COPY only if it is copying local files.
If it is a remote URL, the more correct fix would normally be using curl with verification, but that would require adding instructions (not allowed).
So under this exam constraint, do NOT pick this unless it is actually a local add like:
ADD . /app
Then change just the word:
COPY . /app
3) Save and exit
:wq
Do not run docker build (the task forbids building).
PART B: Correct one prominent security or best-practice issue in the Deployment manifest
4) Open the manifest
vi /home/candidate/subtle-bee/deployment.yaml
5) Change ONLY ONE existing field that is a clear security issue
Use / search in vi to find the usual problematic fields:
Option 1 (most common): running as root
Search:
/runAsUser
If you see:
runAsUser: 0
Change that one field value to:
runAsUser: 65535
This is a single-field change and matches the task hint.
Option 2: privileged container
Search:
/privileged
If you see:
privileged: true
Change only that value to:
privileged: false
Option 3: allow privilege escalation
Search:
/allowPrivilegeEscalation
If you see:
allowPrivilegeEscalation: true
Change only that value to:
allowPrivilegeEscalation: false
Option 4: writable root filesystem
Search:
/readOnlyRootFilesystem
If you see:
readOnlyRootFilesystem: false
Change only that value to:
readOnlyRootFilesystem: true
Option 5: image uses :latest
Search:
/image:
If you see:
image: something:latest
Change only that value to a pinned tag, for example:
image: something:1.2.3
6) Save and exit
:wq
Selection guide (quick decision rule)
If you see running as root in either file, that is usually the highest scoring and most prominent security issue.
Dockerfile: USER root changed to USER 65535
Deployment: runAsUser: 0 changed to runAsUser: 65535
These are ideal because you only modify one line or field and it matches the hint.
Practice every CKS question in the full set, each one with its verified answer and a detailed explanation
Get Full AccessWhat the Linux Foundation CKS Exam Covers
Exam domains verified against the Official Linux Foundation CKS exam guide, last checked November 2026.
Domain 1 Cluster Setup
15%Use network security policies to restrict cluster level access. Review security configurations of Kubernetes components like etcd and kubelet against CIS benchmarks to identify and remediate misconfigurations.
Above Practice Question from this Domain: Q5
Domain 2 Cluster Hardening
15%Restrict access to the Kubernetes API through RBAC and minimize exposure of service accounts by disabling defaults and enforcing least privilege permissions. Keep Kubernetes updated to patch security vulnerabilities.
Domain 3 System Hardening
10%Reduce the attack surface of host operating systems by minimizing IAM roles and external network access. Apply kernel hardening tools like AppArmor and seccomp to enforce additional security boundaries.
Domain 4 Minimize Microservice Vulnerabilities
20%Set up OS level security domains using Pod Security Policies and OPA to isolate workloads. Implement pod to pod encryption through mutual TLS and manage secrets securely.
Above Practice Question from this Domain: Q2
Domain 5 Supply Chain Security
20%Minimize base image footprint and establish registry whitelist policies. Sign and validate container images, scan for known vulnerabilities, and perform static analysis of Kubernetes manifests and Dockerfiles.
Above Practice Question from this Domain: Q4
Domain 6 Monitoring, Logging and Runtime Security
20%Perform behavioral analysis of syscalls and file activities at container and host level to detect threats. Use audit logs to monitor API access and maintain container immutability at runtime.
Above Practice Question from this Domain: Q3
CKS Exam FAQ
Common questions about the exam itself
Do I need a current CKA certification to take CKS, or is a past certification enough?
What makes CKS significantly harder than CKA?
Which CKS domain do most candidates struggle with most?
How long should I realistically prepare for CKS if I already hold CKA?
What exactly happens on CKS exam day and how is it different from taking it at a test center?
If I fail CKS, how quickly can I retake it and what is the cost?
How long does my CKS certification stay valid and what do I need to do to renew it?
Which job roles does CKS certification prepare me for?
How does CKS relate to the other Kubernetes certifications like KCNA and KCSA?
What should I do differently when preparing for CKS versus CKA?
Other Linux Foundation Exams
Free practice questions for more Linux Foundation certification exams
