Authentic Linux Foundation CKS Exam Dumps PDF - Jun-2026 Updated
CKS Dumps Special Discount for limited time Try FOR FREE
The CKS certification exam is an industry-recognized certification that is highly valued by employers. It is a way for professionals to demonstrate their expertise in securing Kubernetes deployments and their commitment to staying up-to-date with the latest security best practices. Certified Kubernetes Security Specialist (CKS) certification is also a way for organizations to identify qualified professionals who can help them secure their Kubernetes clusters and protect their sensitive data.
NEW QUESTION # 25
Create a PSP that will only allow the persistentvolumeclaim as the volume type in the namespace restricted.
Create a new PodSecurityPolicy named prevent-volume-policy which prevents the pods which is having different volumes mount apart from persistentvolumeclaim.
Create a new ServiceAccount named psp-sa in the namespace restricted.
Create a new ClusterRole named psp-role, which uses the newly created Pod Security Policy prevent-volume-policy Create a new ClusterRoleBinding named psp-role-binding, which binds the created ClusterRole psp-role to the created SA psp-sa.
Hint:
Also, Check the Configuration is working or not by trying to Mount a Secret in the pod maifest, it should get failed.
POD Manifest:
apiVersion: v1
kind: Pod
metadata:
name:
spec:
containers:
- name:
image:
volumeMounts:
- name:
mountPath:
volumes:
- name:
secret:
secretname:
Answer:
Explanation:
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: restricted
annotations:
seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'docker/default,runtime/default' apparmor.security.beta.kubernetes.io/allowedProfileNames: 'runtime/default' seccomp.security.alpha.kubernetes.io/defaultProfileName: 'runtime/default' apparmor.security.beta.kubernetes.io/defaultProfileName: 'runtime/default' spec:
privileged: false
# Required to prevent escalations to root.
allowPrivilegeEscalation: false
# This is redundant with non-root + disallow privilege escalation,
# but we can provide it for defense in depth.
requiredDropCapabilities:
- ALL
# Allow core volume types.
volumes:
- 'configMap'
- 'emptyDir'
- 'projected'
- 'secret'
- 'downwardAPI'
# Assume that persistentVolumes set up by the cluster admin are safe to use.
- 'persistentVolumeClaim'
hostNetwork: false
hostIPC: false
hostPID: false
runAsUser:
# Require the container to run without root privileges.
rule: 'MustRunAsNonRoot'
seLinux:
# This policy assumes the nodes are using AppArmor rather than SELinux.
rule: 'RunAsAny'
supplementalGroups:
rule: 'MustRunAs'
ranges:
# Forbid adding the root group.
- min: 1
max: 65535
fsGroup:
rule: 'MustRunAs'
ranges:
# Forbid adding the root group.
- min: 1
max: 65535
readOnlyRootFilesystem: false
NEW QUESTION # 26
Context: Cluster: gvisor Master node: master1 Worker node: worker1
You can switch the cluster/configuration context using the following command:
[desk@cli] $ kubectl config use-context gvisor
Context: This cluster has been prepared to support runtime handler, runsc as well as traditional one.
Task: Create a RuntimeClass named not-trusted using the prepared runtime handler names runsc. Update all Pods in the namespace server to run on newruntime.
Answer:
Explanation:
Explanation
[desk@cli] $vim runtime.yaml
apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
name: not-trusted
handler: runsc
[desk@cli] $ k apply -f runtime.yaml [desk@cli] $ k get pods
NAME READY STATUS RESTARTS AGE
nginx-6798fc88e8-chp6r 1/1 Running 0 11m
nginx-6798fc88e8-fs53n 1/1 Running 0 11m
nginx-6798fc88e8-ndved 1/1 Running 0 11m
[desk@cli] $ k get deploy
NAME READY UP-TO-DATE AVAILABLE AGE
nginx 3/3 11 3 5m
[desk@cli] $ k edit deploy nginx
NEW QUESTION # 27
Create a new ServiceAccount named backend-sa in the existing namespace default, which has the capability to list the pods inside the namespace default.
Create a new Pod named backend-pod in the namespace default, mount the newly created sa backend-sa to the pod, and Verify that the pod is able to list pods.
Ensure that the Pod is running.
Answer:
Explanation:
A service account provides an identity for processes that run in a Pod.
When you (a human) access the cluster (for example, using kubectl), you are authenticated by the apiserver as a particular User Account (currently this is usually admin, unless your cluster administrator has customized your cluster). Processes 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, if you do not specify a service account, it is automatically assigned the default service account in the same namespace. If you get the raw json or yaml for a pod you have created (for example, kubectl get pods/<podname> -o yaml), you can see the spec.serviceAccountName field has been automatically set.
You can access the API from inside a pod using automatically mounted service account credentials, as described in Accessing the Cluster. The API permissions of the service account depend on the authorization plugin and policy in use.
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
...
The pod spec takes precedence over the service account if both specify a automountServiceAccountToken value.
NEW QUESTION # 28
You are configuring a Kubernetes cluster with a deployment named 'secure-app' that uses a secret named 'my-secret to access sensitive information You need to implement an Admission Controller webhook to enforce a policy that prevents the deployment from starting if the 'my-secret secret is not present in the cluster.
Answer:
Explanation:
Solution (Step by Step) :
1. Create a Deployment with a Secret Dependency:
- Create a Deployment YAML file named 'secure-app-deployment.yaml that depends on the 'my-secret secret.
2. Create the Admission Controller Webhook Server: - You will need to create a server that will implement the Admission Controller webhook logic This can be a simple web server written in any language that can receive and process AdmissionReview requests. - Here's an example in Node.js using the 'express' framework:
3. Configure the Admission Controller Webhook in Kubernetes: - Create a ValidatingWebhookConfiguration YAML file named 'secure-app-webhook.yaml that specifies the webhook configuration:
- Create the Webhook Service: - Create a Service YAML file named 'secure-app-webhook-service.yamr to expose the webhook server:k
4. Apply the Webhook Configuration and Service: - Apply the YAML files using kubectl apply -f secure-app-webhook.yaml secure-app-webhook-service.yaml 5. Test the Admission Controller: - Try creating the 'secure-app' deployment without the 'my-secret' secret. The deployment creation should fail, and you should see the message from the webhook server - Create the 'my-secret' secret and then try creating the 'secure-app' deployment again. The deployment should now be created successfully.
NEW QUESTION # 29
SIMULATION
Service is running on port 389 inside the system, find the process-id of the process, and stores the names of all the open-files inside the /candidate/KH77539/files.txt, and also delete the binary.
- A. Send us your feedback on it.
Answer: A
NEW QUESTION # 30
You are tasked with securing a Kubernetes cluster running a critical application. One of the security best practices you need to implement is to enforce the use of signed container images. You have access to a private container registry and a PKI system for generating and managing certificates. Explain in detail now you would implement this policy, covering steps like image signing, verification, and integration with Kubernetes.
Answer:
Explanation:
Solution (Step by Step) :
1. Generate Certificate and Key:
- Use your PKI system to generate a certificate and private key for signing container images. This will be used to authenticate and verify the image's origin and integrity
- Choose appropriate key lengths and algorithms for security.
2. Sign Container Image:
-After building your container image, use the generated private key to sign it.
- Tools like 'cosign' or 'docker-content-trust' can be used for image signing.
- 'cosigns example:
bash
cosign sign --key my-private-key-pem nginx:latest
3. Push Signed Image to Registry:
- Push the signed image to your private container registry The signed image should include the signature and certificate.
4. Configure Kubernetes Image Policy:
- Implement an image policy in your Kubernetes cluster that enforces the verification of signatures for images pulled from your private registry
- You can use 'PodSecurityPolicy' or 'P0dSecurityAdmissioru for this purpose.
- Example 'PodSecurityPolicy' with image signature validation (this is a simplified example):
5. Configure Image Pull Secrets: - Create a Kubernetes Secret containing the public certificate used for verification. - You can then use 'imagePullSecrets' in your deployment resources to reference this secret. - Example:
6. Deploy Your Application - Once your image policy is configured, you can deploy your application using the signed images. - Kubernetes Will verify the signature before starting any pods.
NEW QUESTION # 31
You are using a third-party Helm chart to deploy an application to your Kubernetes cluster. You need to ensure that the Helm chart adheres to security best practices and does not introduce any vulnerabilities into your cluster. Implement a solution that uses KubeLinter to statically analyze the Helm chart before deployment.
Answer:
Explanation:
Solution (Step by Step):
1. Install KubeLinter: Download and install the 'kubevar binary from the official GitHub repository.
2. Render the Helm chart: use the 'helm template' command to render the Helm chart into Kubernetes YAML manifests.
bash
helm template my-chart -f values.yaml > rendered-templates.yaml
3. Validate the rendered YAML manifests using KubeLinter Use the 'kubevar command to validate the rendered YAML manifests against the
Kubernetes schema and your custom rules.
bash
kubeval rendered-templates.yaml
4. Integrate KubeLinter into your CI/CD pipeline: Add a step to your pipeline that renders the Helm chart and runs KubeLinter against the rendered
YAML manifests. This step should be executed before the chart is deployed.
NEW QUESTION # 32
You have a Kubernetes cluster that runs a critical application This application uses sensitive data stored in a persistent volume that is accessible only by the pods running the application. You want to ensure that if any pod is compromised, the attacker cannot gain access to this sensitive data What security best practices would you implement?
Answer:
Explanation:
Solution (Step by Step) :
1. Volume Encryption:
- Encrypt the persistent volume at rest using tools like BitLocker or LUKS-
- Ensure that encryption keys are stored securely, ideally outside the Kubernetes cluster-
- use a key management system to manage encryption keys securely.
- Use a separate encryption key for each volume.
2. Access Control:
- Restrict access to the persistent volume to only the pods running the critical application.
- Utilize Kubernetes RBAC to grant minimal permissions to the service accounts responsible for running the application pods.
- Avoid granting broad permissions to service accounts, limiting their access to only the necessary resources.
3. Pod security Policies (PSP):
- Implement PSPs to limit the capabilities and resources available to pods.
- Restrict pods from accessing sensitive volumes or having privileged permissions.
- Enforce policies that prevent pods from mounting volumes that are not explicitly authorized.
- Define strict PSP rules to limit the potential impact of compromised pods.
4. Network Segmentation:
- Isolate the Kubernetes cluster from other networks and restrict inbound and outbound traffic to only authorized sources and destinations.
- Implement firewall rules to prevent unauthorized access to the cluster.
- Utilize network segmentation to prevent attackers from gaining access to the persistent volume via network connections.
5. Runtime Security:
- Use runtime security tools like Falco or Kubernetes Admission Controllers to monitor and prevent malicious activity within pods.
- Configure runtime security tools to detect and block attempts to access sensitive data within the persistent volume.
- Implement intrusion detection and prevention systems (IDS/IPS) within the Kubernetes environment
6. Regular Security Audits:
- Conduct regular security audits to ensure that security controls are effective.
- Evaluate the effectiveness of encryption, access control, and runtime security measures.
- Identify and remediate any security vulnerabilities promptly.
7. Immutable Infrastructure:
- Use immutable infrastructure principles to minimize the attack surface and prevent attackers from modifying persistent volumes.
- Deploy application code and configurations as immutable containers-
- Avoid making changes to persistent volumes directly.
NEW QUESTION # 33
You have a Kubernetes cluster that runs a sensitive application called "banking-app" in a Deployment The application needs access to a private registry to pull container images. You want to ensure that the "banking-app" container only communicates with the private registry and no other external networks. How can you use NetworkPolicy to enforce this network security restriction?
Answer:
Explanation:
Solution (Step by Step) :
1. Create a NetworkPolicy tor the Private Registry: You'll create a NetworkPolicy that allows the "banking-app" container to communicate with the private registry but blocks access to all other external networks.
'podSelectors: This defines which pods are affected by the policy. - 'policyTypeS: This specifies the type of traffic that the policy governs (Ingress in this case). - 'ingress': Defines the allowed incoming traffic. - 'trom': Specifies the source of allowed traffic. - spodSeIector': Allows traffic from other pods with the "banking-app" label. - 'ipBlock': Allows traffic from a specific CIDR range. - 'cidr': Replace '172.17.0.0/16' with the actual CIDR of your private registry. - 'except': Optional for excluding specific IP addresses or ranges. 2 Apply the NetworkPolicy: Apply the YAML file to your cluster: bash kubectl apply -f banking-app-registry-access.yaml 3. Verify NetworkPolicy: After applying the policy, run: bash kubectl get networkpolicy -n default # Replace 'default' with your namespace You should see your new "banking-app-registry-access" NetworkPolicy listed. 4. Test the Policy: - Try to access external networks from within the "banking-app" container. - You should observe that the container is unable to connect to any external services except the private registry. - Make sure your application can still pull images from the private registry. 5. Additional Considerations: - Egress Traffic: You might need to define a separate NetworkPolicy for 'Egress' traffic if you want to allow the "banking-app" to communicate with specific internal services. - Detailed Controls: You can add more specific rules to the 'ingress' section to allow specific ports or protocols from the private registry.
NEW QUESTION # 34
SIMULATION
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 true
Hint: Take the use of Tool Kube-Bench
Answer:
Explanation:
See the Explanation belowExplanation:
Fix all of the following violations that were found against the API server:- a. Ensure that the RotateKubeletServerCertificate argument is set to true.
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
component: kubelet
tier: control-plane
name: kubelet
namespace: kube-system
spec:
containers:
- command:
- kube-controller-manager
+ - --feature-gates=RotateKubeletServerCertificate=true
image: gcr.io/google_containers/kubelet-amd64:v1.6.0
livenessProbe:
failureThreshold: 8
httpGet:
host: 127.0.0.1
path: /healthz
port: 6443
scheme: HTTPS
initialDelaySeconds: 15
timeoutSeconds: 15
name: kubelet
resources:
requests:
cpu: 250m
volumeMounts:
- mountPath: /etc/kubernetes/
name: k8s
readOnly: true
- mountPath: /etc/ssl/certs
name: certs
- mountPath: /etc/pki
name: pki
hostNetwork: true
volumes:
- hostPath:
path: /etc/kubernetes
name: k8s
- hostPath:
path: /etc/ssl/certs
name: certs
- hostPath:
path: /etc/pki
name: pki
b. Ensure that the admission control plugin PodSecurityPolicy is set.
audit: "/bin/ps -ef | grep $apiserverbin | grep -v grep"
tests:
test_items:
- flag: "--enable-admission-plugins"
compare:
op: has
value: "PodSecurityPolicy"
set: true
remediation: |
Follow the documentation and create Pod Security Policy objects as per your environment.
Then, edit the API server pod specification file $apiserverconf
on the master node and set the --enable-admission-plugins parameter to a value that includes PodSecurityPolicy :
--enable-admission-plugins=...,PodSecurityPolicy,...
Then restart the API Server.
scored: true
c. Ensure that the --kubelet-certificate-authority argument is set as appropriate.
audit: "/bin/ps -ef | grep $apiserverbin | grep -v grep"
tests:
test_items:
- flag: "--kubelet-certificate-authority"
set: true
remediation: |
Follow the Kubernetes documentation and setup the TLS connection between the apiserver and kubelets. Then, edit the API server pod specification file
$apiserverconf on the master node and set the --kubelet-certificate-authority parameter to the path to the cert file for the certificate authority.
--kubelet-certificate-authority=<ca-string>
scored: true
Fix all of the following violations that were found against the ETCD:-
a. Ensure that the --auto-tls argument is not set to true
Edit the etcd pod specification file $etcdconf on the master
node and either remove the --auto-tls parameter or set it to false.
--auto-tls=false
b. Ensure that the --peer-auto-tls argument is not set to true
Edit the etcd pod specification file $etcdconf on the master
node and either remove the --peer-auto-tls parameter or set it to false.
--peer-auto-tls=false
NEW QUESTION # 35
You are managing a Kubernetes cluster where workloads are spread across multiple nodes- You want to configure Pod Security Policies PSPS to restrict the use of privileged containers and limit the ca abilities of containers running within your cluster.
Answer:
Explanation:
Solution (Step by Step) :
1. Create a Pod Security Policy:
- Create a PSP YAML file named restricted-psp.ya'r:
2. Apply the Pod Security Policy: - Apply the PSP using 'kubectl apply -f restricted-psp.yaml' 3. Create a Deployment using the PSP: - Create a new deployment YAML file named 'test-deployment.yamr that specifies the 'restricted-psp' for the pod's security context:
4. Apply the Deployment: - Apply the deployment using 'kubectl apply -f test-deployment.yaml 5. Test the Restrictions: - Try creating a pod that violates the PSP, for example, using a privileged container. The pod should fail to be created due to the PSP enforcement - Try running a command within a using the deployment that uses the PSP. You should be able to run commands but may have limitations based on the capabilities allowed by the PSP.
NEW QUESTION # 36
SIMULATION
Context:
Cluster: gvisor
Master node: master1
Worker node: worker1
You can switch the cluster/configuration context using the following command:
[desk@cli] $ kubectl config use-context gvisor
Context: This cluster has been prepared to support runtime handler, runsc as well as traditional one.
Task:
Create a RuntimeClass named not-trusted using the prepared runtime handler names runsc.
Update all Pods in the namespace server to run on newruntime.
Answer:
Explanation:
See the Explanation below
Explanation:
Explanation:
[desk@cli] $vim runtime.yaml
apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
name: not-trusted
handler: runsc
[desk@cli] $ k apply -f runtime.yaml
[desk@cli] $ k get pods
NAME READY STATUS RESTARTS AGE
nginx-6798fc88e8-chp6r 1/1 Running 0 11m
nginx-6798fc88e8-fs53n 1/1 Running 0 11m
nginx-6798fc88e8-ndved 1/1 Running 0 11m
[desk@cli] $ k get deploy
NAME READY UP-TO-DATE AVAILABLE AGE
nginx 3/3 11 3 5m
[desk@cli] $ k edit deploy nginx
NEW QUESTION # 37
Context
A Role bound to a Pod's ServiceAccount grants overly permissive permissions. Complete the following tasks to reduce the set of permissions.
Task
Given an existing Pod named web-pod running in the namespace security.
Edit the existing Role bound to the Pod's ServiceAccount sa-dev-1 to only allow performing watch operations, only on resources of type services.
Create a new Role named role-2 in the namespace security, which only allows performing update operations, only on resources of type namespaces.
Create a new RoleBinding named role-2-binding binding the newly created Role to the Pod's ServiceAccount.
Answer:
Explanation:


NEW QUESTION # 38
SIMULATION
Documentation Upgrading kubeadm clusters
You must connect to the correct host . Failure to do so may result in a zero score.
[candidate@base] $ ssh cks000034
Context
The kubeadm provisioned cluster was recently upgraded, leaving one node on a slightly older version due to workload compatibility concerns.
Task
Upgrade the cluster node compute-0 to match the version of the control plane node.
Use a command like the following to connect to the compute node:
[candidate@cks000034] $ ssh compute-0
Do not modify any running workloads in the cluster.
Do not forget to exit from the compute node once you have completed your tasks:
[candidate@icompute-e] $ exit
Answer:
Explanation:
See the Explanation below for complete solution
Explanation:
Below is the CKS / CKA exam-style, exact step-by-step solution for Upgrading a kubeadm worker node.
Follow in order, type exact commands, no extra actions.
QUESTION - Upgrade node compute-0 (EXAM MODE)
1) Connect to the correct host (control plane)
ssh cks000034
sudo -i
export KUBECONFIG=/etc/kubernetes/admin.conf
2) Identify the control plane Kubernetes version
This is the target version for compute-0.
kubectl get nodes
Example output:
NAME STATUS ROLES VERSION
control-plane Ready control-plane v1.27.4
compute-0 Ready <none> v1.26.6
Note the control-plane version
Example: v1.27.4
3) Drain the compute node (do NOT modify workloads manually)
kubectl drain compute-0 --ignore-daemonsets --delete-emptydir-data
Wait until drain completes successfully.
4) SSH into the compute node
ssh compute-0
sudo -i
5) Check current kubeadm version on compute node
kubeadm version
6) Upgrade kubeadm to match control plane version
Replace 1.27.4 with the exact control-plane version you observed.
apt-get update
apt-get install -y kubeadm=1.27.4-00
Verify:
kubeadm version
7) Run kubeadm upgrade for the node
kubeadm upgrade node
✅ This updates node-specific configs (NO workloads touched).
8) Upgrade kubelet and kubectl to the same version
apt-get install -y kubelet=1.27.4-00 kubectl=1.27.4-00
9) Restart kubelet
systemctl daemon-reload
systemctl restart kubelet
systemctl status kubelet --no-pager
10) Exit the compute node (IMPORTANT)
exit
11) Uncordon the compute node (back on control plane)
kubectl uncordon compute-0
12) Final verification
kubectl get nodes
Expected:
NAME STATUS VERSION
compute-0 Ready v1.27.4
NEW QUESTION # 39
You are running a Kubernetes cluster with a deployment named "my-app" that uses a container image from a public registry. You suspect that a recent deployment update may have introduced a vulnerability in one of the containers. You want to apply a security patch to the container image Without rebuilding it. Explain now you would implement this using a container patching tool like 'kpatch' and update the deployment.
Answer:
Explanation:
Solution (Step by Step) :
1. Install 'kpatch'
- Install the 'kpatch' tool on your system or within your Kubernetes cluster. 'kpatch' is a utility for patching running Linux kernels and user-space programs without rebuilding them.
2. Identify the Vulnerable Library:
- Use a vulnerability scanner like Trivy to identify the specific vulnerable library within the container image.
3. Patch the Vulnerable Library:
- Use 'kpatch' to apply the security patch to the vulnerable library within the running container.
- You can use the 'kpatch apply' command with the patch file and the containers process ID to apply the patch.
4. Update the Deployment
- While 'kpatch' allows for patching running containers, it's important to note that the patch will be lost when the container restarts. To ensure persistence, you need to update the deployment to use a patched container image:
- Obtain a patched version of the container image from a trusted source or build your own patched image.
- Update the "my-app" deployment configuration to pull the patched image from your registry.
5. Validate the Patch:
- After updating the deployment, verify that the patch has been successfully applied by running a vulnerability scan on the running container.
NEW QUESTION # 40
......
CKS Dumps for success in Actual Exam: https://actualtests.dumpsquestion.com/CKS-exam-dumps-collection.html