Linux-Foundation Linux Foundation Certified SYSADMIN

Linux-Foundation CKA Practice Test & Study Guide

Certified Kubernetes Administrator (CKA) Program

Exam code
CKA
Questions
83
Updated
25 Nov 2026

What's in the CKA study guide

  • 83practice questions with answers
  • PDFread and print on any device
  • Test enginepractice and exam modes online
  • 90 daysof free updates
  • Instant access from My Account after payment
  • 90 days of free updates
  • Money-back guarantee – see conditions
  • Help by live chat or email

Price$45

Choose a format

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

CKA sample questions

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

Question 1

List the nginx pod with custom columns POD_NAME and POD_STATUS  

Answer: See the solution below.

Explanation

kubectl get po -o=custom-columns="POD_NAME:.metadata.name, POD_STATUS:.status.containerStatuses[].state"

Question 2

You must connect to the correct host.Failure to do so may result in a zero score.[candidate@base] $ ssh Cka000049TaskPerform the following tasks:Create a new PriorityClass named high-priority for user-workloads with a value that is onelessthan the highest existing user-defined priority class value.Patch the existing Deployment busybox-logger running in the priority namespace to use thehigh-priority priority class.

Answer: See the solution below.

Explanation

Task Summary SSH into the correct node: cka000049 Find the highest existing user-defined PriorityClass Create a new PriorityClass high-priority with a value one less Patch Deployment busybox-logger (in namespace priority) to use this new PriorityClass Step-by-Step Solution 1 SSH into the correct node bash CopyEdit ssh cka000049 Skipping this = zero score 2 Find the highest existing user-defined PriorityClass Run: bash CopyEdit kubectl get priorityclasses.scheduling.k8s.io Example output: vbnet CopyEdit NAME VALUE GLOBALDEFAULT AGE default-low 1000 false 10d mid-tier 2000 false 7d critical-pods 1000000 true 30d Exclude system-defined classes like system-* and the default global one (e.g., criticalpods). Let's assume the highest user-defined value is 2000. So your new class should be: Value = 1999 3 Create the high-priority PriorityClass Create a file called high-priority.yaml: Linux Foundation CKA : Practice Test cat <<EOF > high-priority.yaml apiVersion: scheduling.k8s.io/v1 kind: PriorityClass metadata: name: high-priority value: 1999 globalDefault: false description: "High priority class for user workloads" EOF Apply it: kubectl apply -f high-priority.yaml 4 Patch the busybox-logger deployment Now patch the existing Deployment in the priority namespace: kubectl patch deployment busybox-logger -n priority \ --type='merge' \ -p '{"spec": {"template": {"spec": {"priorityClassName": "high-priority"}}}}' 5 Verify your work Confirm the patch was applied: kubectl get deployment busybox-logger -n priority -o jsonpath='{.spec.template.spec.priorityClassName}' You should see: high-priority Also, confirm the class exists: kubectl get priorityclass high-priority Final Command Summary ssh cka000049 kubectl get priorityclass # Create the new PriorityClass cat <<EOF > high-priority.yaml apiVersion: scheduling.k8s.io/v1 kind: PriorityClass metadata: name: high-priority value: 1999 globalDefault: false description: "High priority class for user workloads" EOF Linux Foundation CKA : Practice Test kubectl apply -f high-priority.yaml # Patch the deployment kubectl patch deployment busybox-logger -n priority \ --type='merge' \ -p '{"spec": {"template": {"spec": {"priorityClassName": "high-priority"}}}}' # Verify kubectl get deployment busybox-logger -n priority -o jsonpath='{.spec.template.spec.priorityClassName}' kubectl get priorityclass high-priority

Question 3

List all the pods sorted by name 

Answer: See the solution below.

Explanation

kubectl get pods --sort-by=.metadata.name

Question 4

List all the pods sorted by created timestamp 

Answer: See the solution below.

Explanation

kubect1 get pods--sort-by=.metadata.creationTimestamp

Question 5

Create 2 nginx image pods in which one of them is labelled with env=prod and another onelabelled with env=dev and verify the same

Answer: See the solution below.

Explanation

kubectl run --generator=run-pod/v1 --image=nginx -- labels=env=prod nginx-prod --dry-run -o yaml > nginx-prodpod.yaml Now, edit nginx-prod-pod.yaml file and remove entries like “creationTimestamp: null” “dnsPolicy: ClusterFirst” vim nginx-prod-pod.yaml apiVersion: v1 kind: Pod metadata: labels: env: prod name: nginx-prod spec: containers:

  • image: nginx name: nginx-prod restartPolicy: Always # kubectl create -f nginx-prod-pod.yaml kubectl run --generator=run-pod/v1 --image=nginx --labels=env=dev nginx-dev --dry-run -o yaml > nginx-dev-pod.yaml apiVersion: v1 kind: Pod metadata: labels: env: dev name: nginx-dev spec: containers:
  • image: nginx name: nginx-dev restartPolicy: Always # kubectl create -f nginx-prod-dev.yaml Verify : kubectl get po --show-labels kubectl get po -l env=prod kubectl get po -l env=dev
Question 6

Create an nginx pod and list the pod with different levels of verbosity

Answer: See the solution below.

Explanation

// create a pod kubectl run nginx --image=nginx --restart=Never --port=80 // List the pod with different verbosity kubectl get po nginx --v=7 kubectl get po nginx --v=8 kubectl get po nginx --v=9

Question 7

Get IP address of the pod – “nginx-dev”

Answer: See the solution below.

Explanation

Kubect1 get po -o wide Question No : 65 SIMULATION Linux Foundation CKA : Practice Test Using JsonPath kubect1 get pods -o=jsonpath='{range items[*]}{.metadata.name}{"\t"}{.status.podIP}{"\n"}{end}'

Question 8

ou must connect to the correct host.Failure to do so may result in a zero score.[candidate@base] $ ssh Cka000056TaskReview and apply the appropriate NetworkPolicy from the provided YAML samples.Ensure that the chosen NetworkPolicy is not overly permissive, but allows communicationbetween the frontend and backend Deployments, which run in the frontend and backendnamespaces respectively.First, analyze the frontend and backend Deployments to determine the specificrequirements for the NetworkPolicy that needs to be applied.Next, examine the NetworkPolicy YAML samples located in the ~/netpol folder.Failure to comply may result in a reduced score.Do not delete or modify the provided samples. Only apply one of them.Finally, apply the NetworkPolicy that enables communication between the frontend andbackend Deployments, without being overly permissive.

Answer: See the solution below.

Explanation

Task Summary Connect to host cka000056 Review existing frontend and backend Deployments Question No : 64 SIMULATION Linux Foundation CKA : Practice Test Choose one correct NetworkPolicy from the ~/netpol directory The policy must: Apply the correct NetworkPolicy without modifying any sample files Step-by-Step Instructions Step 1: SSH into the correct node ssh cka000056 Step 2: Inspect the frontend Deployment Check the labels used in the frontend Deployment: kubectl get deployment -n frontend -o yaml Look under metadata.labels or spec.template.metadata.labels. Note the app or similar label (e.g., app: frontend). Step 3: Inspect the backend Deployment kubectl get deployment -n backend -o yaml Again, find the labels assigned to the pods (e.g., app: backend). Step 4: List and review the provided NetworkPolicies List the available files: ls ~/netpol Check the contents of each policy file: cat ~/netpol/<file-name>.yaml Look for a policy that: Has kind: NetworkPolicy Applies to the backend namespace Uses a podSelector that matches the backend pods Includes an ingress.from rule that references the frontend namespace using a namespaceSelector (and optionally a podSelector) Does not allow traffic from all namespaces or all pods Here’s what to look for in a good match: apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-frontend-to-backend namespace: backend spec: podSelector: matchLabels: app: backend ingress:

  • from:
  • namespaceSelector: matchLabels: name: frontend Even better if the policy includes: Linux Foundation CKA : Practice Test
  • namespaceSelector: matchLabels: name: frontend podSelector: matchLabels: app: frontend This limits access to pods in the frontend namespace with a specific label. Step 5: Apply the correct NetworkPolicy Once you’ve identified the best match, apply it: kubectl apply -f ~/netpol/<chosen-file>.yaml Apply only one file. Do not alter or delete any existing sample. ssh cka000056 kubectl get deployment -n frontend -o yaml kubectl get deployment -n backend -o yaml ls ~/netpol cat ~/netpol/*.yaml # Review carefully kubectl apply -f ~/netpol/<chosen-file>.yaml Command Summary ssh cka000056 kubectl get deployment -n frontend -o yaml kubectl get deployment -n backend -o yaml ls ~/netpol cat ~/netpol/*.yaml # Review carefully kubectl apply -f ~/netpol/<chosen-file>.yaml
Question 9

You must connect to the correct host.Failure to do so may result in a zero score.[candidate@base] $ ssh Cka000059ContextA kubeadm provisioned cluster was migrated to a new machine. It needs configurationchanges torun successfully.TaskFix a single-node cluster that got broken during machine migration.First, identify the broken cluster components and investigate what breaks them.The decommissioned cluster used an external etcd server.Next, fix the configuration of all broken cluster 

Answer: See the solution below.

Explanation

Question No : 63 SIMULATION Linux Foundation CKA : Practice Test Task Summary SSH into node: cka000059 Cluster was migrated to a new machine It uses an external etcd server Identify and fix misconfigured components Bring the cluster back to a healthy state Step-by-Step Solution Step 1: SSH into the correct host ssh cka000059 Step 2: Check the cluster status Run: kubectl get nodes If it fails, the kubelet or kube-apiserver is likely broken. Check kubelet status: sudo systemctl status kubelet Also, check pod statuses in the control plane: sudo crictl ps -a | grep kube or: docker ps -a | grep kube Look especially for failures in kube-apiserver or kube-controller-manager. Step 3: Inspect the kube-apiserver manifest Since this is a kubeadm-based cluster, manifests are in: ls /etc/kubernetes/manifests Open kube-apiserver.yaml: bash CopyEdit sudo nano /etc/kubernetes/manifests/kube-apiserver.yaml Look for the --etcd-servers= flag. If the external etcd endpoint has changed (likely, due to migration), this needs to be fixed. Example of incorrect configuration: --etcd-servers= https://192.168.1.100:2379

If the IP has changed, update it to the correct IP or hostname of the external etcd server. Linux Foundation CKA : Practice Test Also ensure the correct client certificate and key paths are still valid: --etcd-cafile=/etc/kubernetes/pki/etcd/ca.crt --etcd-certfile=/etc/kubernetes/pki/apiserver-etcd-client.crt --etcd-keyfile=/etc/kubernetes/pki/apiserver-etcd-client.key If the files are missing or the path is wrong due to migration, correct those as well. Step 4: Save and exit, and let static pod restart Static pod changes will be picked up automatically by the kubelet (watch for /etc/kubernetes/manifests changes). Check again: docker ps | grep kube-apiserver # or crictl ps | grep kube-apiserver Step 5: Confirm API is healthy Once kube-apiserver is up, try: kubectl get componentstatuses kubectl get nodes If these commands work and return valid statuses, the control plane is functional again. Step 6: Check controller-manager and scheduler (optional) If still broken, check the other static pods in /etc/kubernetes/manifests/ and correct paths if necessary. Also verify that /etc/kubernetes/kubelet.conf and /etc/kubernetes/admin.conf are present and valid. Command Summary ssh cka000059 # Check system and kubelet sudo systemctl status kubelet docker ps -a | grep kube # or crictl ps -a | grep kube # Check manifests ls /etc/kubernetes/manifests sudo nano /etc/kubernetes/manifests/kube-apiserver.yaml # Fix --etcd-servers and certificate paths if needed # Watch pods restart and confirm: kubectl get nodes Linux Foundation CKA : Practice Test kubectl get componentstatuses

Question 10

You must connect to the correct host.Failure to do so may result in a zero score.[candidate@base] $ ssh Cka000046TaskFirst, create a new StorageClass named local-path for an existing provisioner namedrancher.io/local-path .Set the volume binding mode to WaitForFirstConsumer .Not setting the volume binding mode or setting it to anything other thanWaitForFirstConsumer may result in a reduced score.Next, configure the StorageClass local-path as the default StorageClass .

Answer: See the solution below.

Explanation

Task Summary You need to: SSH into cka000046 Create a StorageClass named local-path using the provisioner rancher.io/localpath Set the volume binding mode to WaitForFirstConsumer Make this StorageClass the default Step-by-Step Solution Question No : 62 SIMULATION Linux Foundation CKA : Practice Test 1 SSH into the correct host ssh cka000046 Required. Skipping this = zero score 2 Create a StorageClass YAML file Create a file named local-path-sc.yaml: cat <<EOF > local-path-sc.yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: local-path annotations: storageclass.kubernetes.io/is-default-class: "true" provisioner: rancher.io/local-path volumeBindingMode: WaitForFirstConsumer EOF This: Sets WaitForFirstConsumer (as required) Marks the class as default using the correct annotation 3 Apply the StorageClass kubectl apply -f local-path-sc.yaml 4 Verify it’s the default StorageClass kubectl get storageclass You should see local-path with a (default) marker: NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE local-path rancher.io/local-path Delete WaitForFirstConsumer false 10s Final Command Summary ssh cka000046 cat <<EOF > local-path-sc.yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: local-path annotations: storageclass.kubernetes.io/is-default-class: "true" provisioner: rancher.io/local-path volumeBindingMode: WaitForFirstConsumer Linux Foundation CKA : Practice Test EOF kubectl apply -f local-path-sc.yaml kubectl get storageclass

Why RealExamCollection is the best choice for Linux-Foundation CKA exam preparation

Secure your position in a competitive IT industry

The Linux-Foundation CKA certification is a strong way to demonstrate your understanding and ability. Our CKA 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 CKA practice questions up to date, with explanations. The questions and answers on RealExamCollection are reviewed by people with professional experience of Linux-Foundation technologies.

One place to prepare

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

Updated CKA 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 CKA demo before you buy

You can view sample CKA 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 CKA exam. If the file is updated in that time, you can download the latest version from your account.

Ready to prepare?

Linux-Foundation CKA · 83 questions

Choose a format