[Full-Version] 2025 New Preparation Guide of Linux Foundation CKA Exam [Q25-Q50]

Share

[Full-Version] 2025 New Preparation Guide of Linux Foundation CKA Exam

CKA Practice Exam - 68 Unique Questions


For more info read reference:

CNCF Website


The Certified Kubernetes Administrator (CKA) Program Certification Exam is an industry-recognized certification that validates an individual's expertise in deploying, managing, and troubleshooting Kubernetes clusters. CKA exam is designed to test the candidate's practical skills and knowledge in various aspects of Kubernetes administration, such as pod scheduling, network configuration, storage management, and security. Certified Kubernetes Administrator (CKA) Program Exam certification is offered by the Linux Foundation, a non-profit organization that promotes the adoption of open-source software and technologies.

 

NEW QUESTION # 25
Score:7%

Context
An existing Pod needs to be integrated into the Kubernetes built-in logging architecture (e. g. kubectl logs). Adding a streaming sidecar container is a good and common way to accomplish this requirement.
Task
Add a sidecar container named sidecar, using the busybox Image, to the existing Pod big-corp-app. The new sidecar container has to run the following command:
/bin/sh -c tail -n+1 -f /va r/log/big-corp-app.log
Use a Volume, mounted at /var/log, to make the log file big-corp-app.log available to the sidecar container.

Answer:

Explanation:
Solution:
#
kubectl get pod big-corp-app -o yaml
#
apiVersion: v1
kind: Pod
metadata:
name: big-corp-app
spec:
containers:
- name: big-corp-app
image: busybox
args:
- /bin/sh
- -c
- >
i=0;
while true;
do
echo "$(date) INFO $i" >> /var/log/big-corp-app.log;
i=$((i+1));
sleep 1;
done
volumeMounts:
- name: logs
mountPath: /var/log
- name: count-log-1
image: busybox
args: [/bin/sh, -c, 'tail -n+1 -f /var/log/big-corp-app.log']
volumeMounts:
- name: logs
mountPath: /var/log
volumes:
- name: logs
emptyDir: {
}
#
kubectl logs big-corp-app -c count-log-1


NEW QUESTION # 26
Schedule a pod as follows:
* Name: nginx-kusc00101
* Image: nginx
* Node selector: disk=ssd

Answer:

Explanation:
See the solution below.
Explanation
solution



NEW QUESTION # 27
Delete persistent volume and persistent volume claim

Answer:

Explanation:
kubectl delete pvc task-pv-claim kubectl delete pv task-pv-volume // Verify Kubectl get pv,pvc


NEW QUESTION # 28
Allow traffic from all the pods in "web" namespace and from pods
with label "type=monitoring" to the pods matching label "app: db"

  • A. kubectl create namespace web
    kubectl label namespace/web app=web
    vim web-allow-all-ns-monitoring.yaml
    apiVersion: networking.k8s.io/v1
    kind: NetworkPolicy
    metadata:
    name: web-allow-all-ns-monitoring
    namespace: default
    spec:
    podSelector:
    matchLabels:
    app: db
    ingress:
    - from:
    - namespaceSelector:
    matchLabels:
    app: web
    podSelector:
    matchLabels:
    type: monitoring
    k kubectl apply -f web-allow-all-ns-monitoring.yaml
  • B. kubectl create namespace web
    kubectl label namespace/web app=web
    vim web-allow-all-ns-monitoring.yaml
    apiVersion: networking.k8s.io/v1
    kind: NetworkPolicy
    metadata:
    name: web-allow-all-ns-monitoring
    namespace: default
    spec:
    podSelector:
    podSelector:
    matchLabels:
    type: monitoring
    k kubectl apply -f web-allow-all-ns-monitoring.yaml

Answer: A


NEW QUESTION # 29
Install a kubernetes cluster with one master and one worker using kubeadm

  • A. This is a straightforward question, you need to install kubernetes cluster using kubeadm with one master and one worker.
    Installation is considered success once both master and worker
    nodes become available.
    Refer : https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/
  • B. This is a straightforward question, you need to install kubernetes cluster using kubeadm with one master and one worker.
    Refer : https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/

Answer: A


NEW QUESTION # 30
Watch the job that runs 10 times one by one and verify 10 pods are created and delete those after it's completed

Answer:

Explanation:
kubectl get job -w kubectl get po kubectl delete job hello-job


NEW QUESTION # 31
Pause the rollout of the deployment

Answer:

Explanation:
kubectl rollout pause deploy webapp


NEW QUESTION # 32
List all persistent volumes sorted by capacity, saving the full kubectl output to
/opt/KUCC00102/volume_list. Use kubectl 's own functionality for sorting the output, and do not manipulate it any further.

Answer:

Explanation:
See the solution below.
Explanation
solution


NEW QUESTION # 33
For this item, you will havetosshto the nodesik8s-master-0andik8s-node-0and complete all tasks on thesenodes. Ensure that you return tothe base node (hostname:node-1) when you havecompleted this item.
Context
As an administrator of a smalldevelopment team, you have beenasked to set up a Kubernetes clusterto test the viability of a newapplication.
Task
You must usekubeadmto performthis task. Anykubeadminvocationswill require the use of the
--ignore-preflight-errors=alloption.
* Configure thenodeik8s-master-Oas a masternode. .
* Join the nodeik8s-node-otothe cluster.

Answer:

Explanation:
See the solution below.
Explanation
solution
You must use thekubeadmconfiguration file located at when initializingyour cluster.
You may use any CNI pluginto complete this task, but ifyou don't have your favouriteCNI plugin's manifest URL athand, Calico is one popularoption:https://docs.projectcalico.org/v3.14/manifests/calico.yaml Docker is already installedon both nodes and hasbeen configured so that you caninstall the required tools.


NEW QUESTION # 34
Get the memory and CPU usage of all the pods and find out top 3 pods which have the highest usage and put them into the cpuusage.txt file

  • A. // Get the top 3 pods
    kubectl top pod --all-namespaces | sort --reverse --key 3 --
    numeric | head -3
    // putting into file
    kubectl top pod --all-namespaces | sort --reverse --key 3 --
    numeric | head -3 > cpu-usage.txt
    // verify
    cat cpu-usage.txt
  • B. // Get the top 3 pods
    kubectl top pod --all-namespaces | sort --reverse --key 3 --
    numeric | head -8
    // putting into file
    kubectl top pod --all-namespaces | sort --reverse --key 6 --
    numeric | head -6 > cpu-usage.txt
    // verify
    cat cpu-usage.txt

Answer: A


NEW QUESTION # 35
Create a Pod with three busy box containers with commands "ls; sleep 3600;", "echo Hello World; sleep 3600;" and "echo this is the third container; sleep 3600" respectively and check the status

  • A. // first create single container pod with dry run flag
    kubectl run busybox --image=busybox --restart=Always --dry-run
    -o yaml -- bin/sh -c "sleep 3600; ls" > multi-container.yaml
    // edit the pod to following yaml and create it
    apiVersion: v1
    kind: Pod
    metadata:
    labels:
    run: busybox
    name: busybox
    spec:
    containers:
    - args:
    - bin/sh
    - -c
    - ls; sleep 3600
    image: busybox
    name: busybox-container-1
    - args:
    - bin/sh
    - -c
    - echo Hello world; sleep 3600
    image: busybox
    name: busybox-container-2
    - args:
    - bin/sh
    - -c
    - echo this is third container; sleep 3600
    image: busybox
    name: busybox-container-3
    restartPolicy: Always
    // Verify
    Kubectl get pods
  • B. // first create single container pod with dry run flag
    kubectl run busybox --image=busybox --restart=Always --dry-run
    -o yaml -- bin/sh -c "sleep 3600; ls" > multi-container.yaml
    // edit the pod to following yaml and create it
    apiVersion: v1
    kind: Pod
    metadata:
    labels:
    run: busybox
    name: busybox
    spec:
    containers:
    - args:
    - bin/sh
    - -c
    - ls; sleep 3600
    - echo Hello world; sleep 3600
    image: busybox
    name: busybox-container-2
    - args:
    - bin/sh
    - -c
    - echo this is third container; sleep 3600
    image: busybox
    name: busybox-container-3
    restartPolicy: Always
    // Verify
    Kubectl get pods

Answer: A


NEW QUESTION # 36
Score: 7%

Task
First, create a snapshot of the existing etcd instance running at https://127.0.0.1:2379, saving the snapshot to
/srv/data/etcd-snapshot.db.

Next, restore an existing, previous snapshot located at /var/lib/backup/etcd-snapshot-previo us.db

Answer:

Explanation:
See the solution below.
Explanation
Solution:
#backup
ETCDCTL_API=3 etcdctl --endpoints="https://127.0.0.1:2379" --cacert=/opt/KUIN000601/ca.crt
--cert=/opt/KUIN000601/etcd-client.crt --key=/opt/KUIN000601/etcd-client.key snapshot save
/etc/data/etcd-snapshot.db
#restore
ETCDCTL_API=3 etcdctl --endpoints="https://127.0.0.1:2379" --cacert=/opt/KUIN000601/ca.crt
--cert=/opt/KUIN000601/etcd-client.crt --key=/opt/KUIN000601/etcd-client.key snapshot restore
/var/lib/backup/etcd-snapshot-previoys.db


NEW QUESTION # 37
Set the node named ek8s-node-1 as unavailable and reschedule all the pods running on it.

Answer:

Explanation:
solution


NEW QUESTION # 38
Create and configure the service front-end-service so it's accessible through NodePort and routes to the existing pod named front-end.

Answer:

Explanation:
See the solution below.
Explanation
solution


NEW QUESTION # 39
Create a pod as follows:
* Name: mongo
* Using Image: mongo
* In a new Kubernetes namespace named

Answer:

Explanation:
See the solution below.
Explanation
solution


NEW QUESTION # 40
Create an nginx pod which reads username as the environment variable

  • A. // create a yml file
    kubectl run nginx --image=nginx --restart=Never --dry-run -o
    yaml > nginx.yml
    // add env section below and create
    apiVersion: v1
    kind: Pod
    metadata:
    labels:
    run: nginx
    name: nginx
    spec:
    containers:
    - image: nginx
    name: nginx
    env:
    - name: USER_NAME
    restartPolicy: Never
    kubectl create -f nginx.yml
    //Verify
    kubectl exec -it nginx - env
  • B. // create a yml file
    kubectl run nginx --image=nginx --restart=Never --dry-run -o
    yaml > nginx.yml
    // add env section below and create
    apiVersion: v1
    kind: Pod
    metadata:
    labels:
    run: nginx
    name: nginx
    spec:
    containers:
    - image: nginx
    name: nginx
    env:
    - name: USER_NAME
    valueFrom:
    secretKeyRef:
    name: my-secret
    key: username
    restartPolicy: Never
    kubectl create -f nginx.yml
    //Verify
    kubectl exec -it nginx - env

Answer: B


NEW QUESTION # 41
Get list of PVs and order by size and write to file "/opt/pvstorage.txt"

Answer:

Explanation:
kubectl get pv --sort-by=.spec.capacity.storage > /opt/pv storage.txt


NEW QUESTION # 42
List "nginx-dev" and "nginx-prod" pod and delete those pods

  • A. kubect1 get pods -o wide
    kubectl delete po "nginx-dev" kubectl delete po "nginx-prod"
  • B. kubect1 get pods -o wide
    kubectl delete po "nginx-dev" kubectl delete po "nginx-prod"

Answer: B


NEW QUESTION # 43
List the nginx pod with custom columns POD_NAME and POD_STATUS

Answer:

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


NEW QUESTION # 44
Score: 4%

Task
Check to see how many nodes are ready (not including nodes tainted NoSchedule ) and write the number to
/opt/KUSC00402/kusc00402.txt

Answer:

Explanation:
See the solution below.
Explanation
Solution:
kubectl describe nodes | grep ready|wc -l
kubectl describe nodes | grep -i taint | grep -i noschedule |wc -l
echo 3 > /opt/KUSC00402/kusc00402.txt
#
kubectl get node | grep -i ready |wc -l
# taintsnoSchedule
kubectl describe nodes | grep -i taints | grep -i noschedule |wc -l
#
echo 2 > /opt/KUSC00402/kusc00402.txt


NEW QUESTION # 45
Get list of all the pods showing name and namespace with a jsonpath expression.

Answer:

Explanation:
kubectl get pods -o=jsonpath="{.items[*]['metadata.name' , 'metadata.namespace']}"


NEW QUESTION # 46
Get the pods with labels env=dev and env=prod and output the labels as well

Answer:

Explanation:
kubectl get pods -l 'env in (dev,prod)' --show-labels


NEW QUESTION # 47
Create a pod with environment variables as var1=value1.Check the environment variable in pod

Answer:

Explanation:
kubectl run nginx --image=nginx --restart=Never --env=var1=value1
# then
kubectl exec -it nginx -- env
# or
kubectl exec -it nginx -- sh -c 'echo $var1'
# or
kubectl describe po nginx | grep value1


NEW QUESTION # 48
Ensure a single instance of pod nginx is running on each node of the Kubernetes cluster where nginx also represents the Image name which has to be used. Do not override any taints currently in place.
Use DaemonSet to complete this task and use ds-kusc00201 as DaemonSet name.

Answer:

Explanation:
solution




NEW QUESTION # 49
Score: 4%

Task
Schedule a pod as follows:
* Name: nginx-kusc00401
* Image: nginx
* Node selector: disk=ssd

Answer:

Explanation:
See the solution below.
Explanation
Solution:
#yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx-kusc00401
spec:
containers:
- name: nginx
image: nginx
imagePullPolicy: IfNotPresent
nodeSelector:
disk: spinning
#
kubectl create -f node-select.yaml


NEW QUESTION # 50
......


The CKA certification is valid for three years, and candidates can renew their certification by retaking the exam or by earning a higher-level certification. Certified Kubernetes Administrator (CKA) Program Exam certification is recognized by industry leaders, including AWS, Google Cloud, and Red Hat. Certified Kubernetes Administrator (CKA) Program Exam certification also provides access to a network of certified professionals and resources, including training, events, and community support. Overall, the CKA certification is an excellent way to demonstrate your expertise in Kubernetes and advance your career in the cloud-native ecosystem.

 

Latest Questions CKA Guide to Prepare Free Practice Tests: https://www.exam4pdf.com/CKA-dumps-torrent.html

Reliable CKA Dumps Questions Available as Web-Based Practice Test Engine: https://drive.google.com/open?id=1_Cb1-72UADIEtqtdMvemrVxRrda_fqmf