Linux-Foundation Kubernetes Security Specialist

Linux-Foundation CKS Exam Dumps

Certified Kubernetes Security Specialist (CKS)

Exam code
CKS
Questions
64
Updated
25 Nov 2026
  • Instant access from My Account after payment
  • 90 days of free updates
  • Money-back guarantee – see conditions
  • Help by live chat or email
Choose a format
Try free sample questions

Prices in USD. Downloads appear in My Account once your order is complete.

  • Instant access from My Account after payment
  • 90 days of free updates
  • Money-back guarantee – see conditions
  • Help by live chat or email
Free demo

CKS sample questions

Check the style and quality of the material before you buy.

Question 1

Enable audit logs in the cluster, To Do so, enable the log backend, and ensure that? 1. logs are stored at /var/log/kubernetes/kubernetes-logs.txt.? 2. Log files are retained for 5 days.? 3. at maximum, a number of 10 old audit logs files are retained. Edit and extend the basic policy to log:? 1. Cronjobs changes at RequestResponse? 2. Log the request body of deployments changes in the namespace kube-system.? 3. Log all other resources in core and extensions at the Request level.? 4. Don't log watch requests by the "system:kube-proxy" on endpoints or

Answer: .

Answer: See explanation below.

Explanation

Step 1 – Audit policy (/etc/kubernetes/audit-policy.yaml) apiVersion: audit.k8s.io/v1 kind: Policy rules:

  • level: None users: ["system:kube-proxy"] verbs: ["watch"] resources:
  • group: "" resources: ["endpoints", "services"]
  • level: RequestResponse resources:
  • group: "batch" resources: ["cronjobs"]
  • level: Request resources:
  • group: "apps" resources: ["deployments"] namespaces: ["kube-system"]
  • level: Request resources:
  • group: ""
  • group: "extensions"
  • level: Metadata Step 2 – API server flags
  • --audit-policy-file=/etc/kubernetes/audit-policy.yaml
  • --audit-log-path=/var/log/kubernetes/kubernetes-logs.txt
  • --audit-log-maxage=5
  • --audit-log-maxbackup=10 Mount the policy file (readOnly) and /var/log/kubernetes with hostPath volumes. Step 3 – Verify watch crictl ps | grep kube-apiserver tail /var/log/kubernetes/kubernetes-logs.txt
Question 2

You can switch the cluster/configuration context using the following command:[desk@cli] $ kubectl config use-context qaContext:A pod fails to run because of an incorrectly specified ServiceAccountTask:Create a new service account named backend-qa in an existing namespace qa, which must not have access to any secret.Edit the frontend pod yaml to use backend-qa service accountNote: You can find the frontend pod yaml at /home/cert_masters/frontend-pod.yaml

Answer: .

Answer: See the explanation below

Explanation

Step 1 – ServiceAccount with no secret access kubectl config use-context qa cat <<EOF | kubectl apply -f - apiVersion: v1 kind: ServiceAccount metadata: name: backend-qa namespace: qa automountServiceAccountToken: false EOF No Role/RoleBinding is created, so it has no access to secrets. Step 2 – Use it in the frontend Pod vi /home/cert_masters/frontend-pod.yaml spec: serviceAccountName: backend-qa kubectl delete pod frontend -n qa --ignore-not-found kubectl apply -f /home/cert_masters/frontend-pod.yaml kubectl auth can-i get secrets -n qa --as=system:serviceaccount:qa:backend-qa # no

Question 3

Context:Cluster: prodMaster node: master1Worker node: worker1You can switch the cluster/configuration context using the following command:[desk@cli] $ kubectl config use-context prodTask:Analyse and edit the given Dockerfile (based on the ubuntu:18:04 image)/home/cert_masters/Dockerfile fixing two instructions present in the file being prominent security/best-practice issues.Analyse and edit the given manifest file/home/cert_masters/mydeployment.yaml fixing two fields present in the file being prominent security/best-practice issues.Note: Don't add or remove configuration settings; only modify the existing configuration settings, so that two configuration settings each are no longer security/best-practice concerns.Should you need an unprivileged user for any of the tasks, use user nobody with user id

Answer: .

Answer: See the explanation below

Explanation

Step 1 – Dockerfile (two instructions) kubectl config use-context prod vi /home/cert_masters/Dockerfile FROM ubuntu:latest -> FROM ubuntu:18.04 USER root -> USER nobody Step 2 – Manifest (two fields) vi /home/cert_masters/mydeployment.yaml securityContext: privileged: true -> privileged: false readOnlyRootFilesystem: false -> readOnlyRootFilesystem: true (Alternative typical fix: runAsUser: 0 -> 65535.) Only existing settings are modified.

Question 4

Analyze and edit the given Dockerfile? FROM ubuntu:latest?? RUN apt-get update -y?? RUN apt-install nginx -y?? COPY entrypoint.sh /?? ENTRYPOINT ["/entrypoint.sh"]?? USER ROOT Fixing two instructions present in the file being prominent security best practice issuesAnalyze and edit the deployment manifest file? apiVersion: v1? kind: Pod? metadata:? name: security-context-demo-2? spec:? securityContext:? runAsUser: 1000? containers:? - name: sec-ctx-demo-2? image: gcr.io/google-samples/node-hello:1.0? securityContext:? runAsUser: 0? privileged: True? allowPrivilegeEscalation: falseFixing two fields present in the file being prominent security best practice issuesDon't add or remove configuration settings; only modify the existing configuration settingsWhenever you need an unprivileged user for any of the tasks, use user test-user with the user id 5487

Answer: .

Answer: See the explanation below:

Explanation

Dockerfile – fix two instructions FROM ubuntu:latest -> FROM ubuntu:22.04 USER ROOT -> USER test-user Pin the base image instead of latest, and run as the unprivileged user (UID 5487). Manifest – fix two fields securityContext: runAsUser: 5487 # was 0 privileged: false # was True allowPrivilegeEscalation: false No settings are added or removed; only the existing values are changed.

Question 5

Documentation Ingress, Service, NGINX Ingress ControllerYou must connect to the correct host . Failure to do so may result in a zero score.[candidate@base] $ ssh cks000032ContextYou must expose a web application using HTTPS routes.Task Create an Ingress resource named web in the prod namespace and configure it as follows:. Route traffic for host web.k8s.local and all paths to the existing Service web. Enable TLS termination using the existing Secret web-cert.. Redirect HTTP requests to HTTPS .You can test your Ingress configuration with the following command:[candidate@cks000032]$ curl -L http://web.k8s.local

Answer: .

Answer: See the Explanation below for complete solution.

Explanation

Step 1 – Check Service port and IngressClass ssh cks000032 kubectl get svc web -n prod kubectl get ingressclass Step 2 – Create the Ingress apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: web namespace: prod annotations: nginx.ingress.kubernetes.io/ssl-redirect: "true" nginx.ingress.kubernetes.io/force-ssl-redirect: "true" spec: ingressClassName: nginx tls:

  • hosts:
  • web.k8s.local secretName: web-cert rules:
  • host: web.k8s.local http: paths:
  • path: / pathType: Prefix backend: service: name: web port: number: 80 Step 3 – Apply and test kubectl apply -f web-ingress.yaml curl -L http://web.k8s.local # 308 redirect to https, page served
Question 6

Cluster: scannerMaster node: controlplaneWorker node: worker1You can switch the cluster/configuration context using the following command:[desk@cli] $ kubectl config use-context scannerGiven:You may use Trivy's documentation.Task:Use the Trivy open-source container scanner to detect images with severe vulnerabilities used by Pods in the namespace nato.Look for images with High or Critical severity vulnerabilities and delete the Pods that use those images.Trivy is pre-installed on the cluster's master node. Use cluster's master node to use Trivy.

Answer: .

Answer: See the explanation below

Explanation

Step 1 – List the images used in namespace nato kubectl config use-context scanner kubectl get pods -n nato -o custom-columns=POD:.metadata.name,IMAGE:.spec.containers[*].image Step 2 – Scan each image on the master node ssh controlplane trivy image -q --severity HIGH,CRITICAL <image> Repeat for every image; note the ones reporting HIGH or CRITICAL vulnerabilities. Step 3 – Delete the Pods using those images kubectl delete pod <pod-1> <pod-2> -n nato kubectl get pods -n nato

Question 7

On the Cluster worker node, enforce the prepared AppArmor profile? #include <tunables/global>?? profile nginx-deny flags=(attach_disconnected) {? #include <abstractions/base>?? file,?? # Deny all file writes.? deny /** w,? }? EOF'Edit the prepared manifest file to include the AppArmor profile.? apiVersion: v1? kind: Pod? metadata:? name: apparmor-pod? spec:? containers:? - name: apparmor-pod? image: nginxFinally, apply the manifests files and create the Pod specified on it.Verify: Try to make a file inside the directory which is restricted.

Answer: .

Answer: See explanation below.

Explanation

Step 1 – Load the profile on the worker node ssh worker1 ; sudo -i vi /etc/apparmor.d/nginx-deny # paste the given profile apparmor_parser -q /etc/apparmor.d/nginx-deny aa-status | grep nginx-deny Step 2 – Add the profile to the Pod apiVersion: v1 kind: Pod metadata: name: apparmor-pod spec: nodeName: worker1 containers:

  • name: apparmor-pod image: nginx securityContext: appArmorProfile: type: Localhost localhostProfile: nginx-deny For clusters older than v1.30 use the annotation instead: metadata: annotations: container.apparmor.security.beta.kubernetes.io/apparmor-pod: localhost/nginx-deny Step 3 – Apply and verify kubectl apply -f apparmor-pod.yaml kubectl exec apparmor-pod -- touch /tmp/test # touch: cannot touch '/tmp/test': Permission denied
Question 8

Documentation dockerdYou must connect to the correct host . Failure to do so may result in a zero score.[candidate@base] $ ssh cks000037TaskPerform the following tasks to secure the cluster node cks000037 :Remove user developer from the docker group.Do not remove the user from any other group.Reconfigure and restart the Docker daemon to ensure that the socketfile located at /var/run/docker.sock is owned by the group root.Re-configure and restart the Docker daemon to ensure it does not listen on any TCP port.After completing your work, ensure the Kubernetes cluster is healthy.

Answer: .

Answer: See the Explanation below for complete solution.

Explanation

Step 1 – Remove developer from the docker group only ssh cks000037 sudo -i gpasswd -d developer docker id developer Step 2 – Socket owned by group root vi /lib/systemd/system/docker.socket [Socket] SocketGroup=root Also make sure /etc/docker/daemon.json does not set "group": "docker". Step 3 – Stop listening on TCP Remove any -H tcp://0.0.0.0:2375 option from ExecStart in /lib/systemd/system/ docker.service, and any tcp:// entry under "hosts" in /etc/docker/daemon.json: ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock Step 4 – Restart and verify systemctl daemon-reload systemctl restart docker.socket docker ls -l /var/run/docker.sock # srw-rw---- root root ss -tlnp | grep dockerd # no output kubectl get nodes # all Ready

Question 9

Fix all issues via configuration and restart the affected components to ensure the new setting takes effect. Fix all of the following violations that were found against the API server:-? a. Ensure that the RotateKubeletServerCertificate argument is set to true.? b. Ensure that the admission control plugin PodSecurityPolicy is set.? c. Ensure that the --kubelet-certificate-authority argument is set as appropriate. Fix all of the following violations that were found against the Kubelet:-? a. Ensure the --anonymous-auth argument is set to false.? b. Ensure that the --authorization-mode argument is set to Webhook. Fix all of the following violations that were found against the ETCD:-? a. Ensure that the --auto-tls argument is not set to true? b. Ensure that the --peer-auto-tls argument is not set to trueHint: Take the use of Tool Kube-Bench

Answer: .

Answer: See the Explanation below.

Explanation

Step 1 – API server / controller manager

  • --kubelet-certificate-authority=/etc/kubernetes/pki/ca.crt
  • --enable-admission-plugins=NodeRestriction,PodSecurityPolicy # clusters <= v1.24 In /etc/kubernetes/manifests/kube-controller-manager.yaml:
  • --feature-gates=RotateKubeletServerCertificate=true Step 2 – Kubelet (/var/lib/kubelet/config.yaml) authentication: anonymous: enabled: false authorization: mode: Webhook systemctl daemon-reload && systemctl restart kubelet Step 3 – etcd
  • --auto-tls=false
  • --peer-auto-tls=false Step 4 – Verify kube-bench run --targets master,node,etcd | grep FAIL
Question 10

Documentation Deployments, Pods, FalcoYou must connect to the correct host . Failure to do so may result in a zero score.[candidate@base] $ ssh cks000026ContextA Pod is misbehaving and poses a security threat to the system.Task One of the Pods belonging to the application ollama is misbehaving. It is directly accessing the system's memory reading from the sensitive file /dev/mem.First, identify the misbehaving Pod accessing /dev/mem.The cluster uses the Docker Engine as its container runtime . If needed, use the docker command to troubleshoot running containers.Next, identify the Deployment managing the misbehaving Pod and scale it to zero replicas.Do not modify the Deployment except for scaling it down.Do not modify any other Deployments .Do not delete any Deployments.

Answer: .

Answer: See the Explanation below for complete solution.

Explanation

Step 1 – Find the process reading /dev/mem ssh cks000026 sudo -i lsof /dev/mem # or: fuser -v /dev/mem cat /proc/<PID>/cgroup | grep -o -E '[0-9a-f]{64}' | head -1 Step 2 – Map the container to its Pod docker ps --no-trunc | grep <container-id> docker inspect <container-id> | grep -E 'io.kubernetes.pod.(name|namespace)' (Alternatively run Falco and look for alerts mentioning /dev/mem.) Step 3 – Find the Deployment and scale it to zero kubectl get pod <pod> -n <ns> -o jsonpath='{.metadata.ownerReferences[0].name}' # ReplicaSet kubectl get rs <replicaset> -n <ns> -o jsonpath='{.metadata.ownerReferences[0].name}' # Deploy kubectl scale deployment <deployment> -n <ns> --replicas=0 kubectl get deploy -n <ns>

Why Dumpsforsure is the best choice for Linux-Foundation CKS exam preparation

Secure your position in a competitive IT industry

The Linux-Foundation CKS certification is a strong way to demonstrate your understanding and ability. Our CKS questions & answers help you prepare for it, so you can secure your current position and move your career forward.

Reviewed by IT professionals

We keep our CKS exam dumps up to date, with explanations. The questions and answers on Dumpsforsure are reviewed by people with professional experience of Linux-Foundation technologies.

One place to prepare

Dumpsforsure brings together the material you need for the Linux-Foundation CKS exam. Explanations are added to the questions to help you understand the logic behind them and prepare for other Linux-Foundation exams.

Updated CKS questions & answers

We update the exam files regularly to add new questions. The date of the latest update is shown at the top of this page.

Free CKS demo before you buy

You can view sample CKS questions on this page before buying, to see the format and pattern of the material.

90 days of free updates

You are eligible for 90 days of free updates after buying the CKS exam. If the file is updated in that time, you can download the latest version from your account.

Ready to prepare?

Linux-Foundation CKS · 64 questions

Choose a format