Certified Kubernetes Administrator Exam Practice Test

 Getting ready for the Certified Kubernetes Administrator (CKA) exam? This practice test is here to help! With 25 carefully designed multiple-choice questions, you can test your knowledge and skills in managing Kubernetes clusters. It’s the perfect way to check how prepared you are for the real exam.

The questions cover essential topics like Kubernetes architecture, cluster components, workloads, networking, storage, and troubleshooting. Each question includes a clear explanation to help you understand the correct answer and improve your problem-solving abilities.

Whether you’re starting your Kubernetes journey or finalizing your preparation, this practice test will give you the confidence and clarity needed to pass the CKA certification. Let’s begin and take a step closer to becoming a Certified Kubernetes Administrator!

1. Which component in the Kubernetes architecture is responsible for scheduling pods to nodes?

A) Kubelet
B) Kube-proxy
C) Scheduler
D) Controller Manager

Answer:

C) Scheduler

Explanation:

The Scheduler is responsible for scheduling pods to nodes based on resource availability and other constraints.

2. What command is used to get the logs of a specific pod in Kubernetes?

A) kubectl describe logs <pod-name>
B) kubectl get logs <pod-name>
C) kubectl logs <pod-name>
D) kubectl show logs <pod-name>

Answer:

C) kubectl logs <pod-name>

Explanation:

The kubectl logs <pod-name> command is used to fetch the logs of a specific pod.

3. What is the primary function of the Kube-Proxy component in a Kubernetes node?

A) Manage IP Tables for services
B) Run containers inside pods
C) Monitor node health
D) Connect to the Docker daemon

Answer:

A) Manage IP Tables for services

Explanation:

Kube-Proxy manages IP Tables for services and enables the communication to and from pods.

4. Which object in Kubernetes is used to manage a set of identical pods?

A) ReplicaSet
B) PodSet
C) Deployment
D) PodGroup

Answer:

A) ReplicaSet

Explanation:

A ReplicaSet ensures that a specified number of pod replicas are running at any given time.

5. How can you scale a deployment in Kubernetes?

A) kubectl scale deployment <deployment-name> --replicas=n
B) kubectl scale pod <pod-name> --replicas=n
C) kubectl set deployment <deployment-name> --replicas=n
D) kubectl configure deployment <deployment-name> --replicas=n

Answer:

A) kubectl scale deployment <deployment-name> --replicas=n

Explanation:

The kubectl scale deployment command is used to scale the number of pod replicas in a deployment.

6. What is the purpose of a Kubernetes DaemonSet?

A) Run a copy of a pod on every node
B) Schedule pods based on resource usage
C) Manage stateful applications
D) Ensure a group of pods can be scheduled together

Answer:

A) Run a copy of a pod on every node

Explanation:

A DaemonSet ensures that all (or some) nodes run a copy of a pod.

7. What type of Kubernetes object is used to manage ordered, graceful deployment and scaling of pods?

A) Deployment
B) StatefulSet
C) ReplicaSet
D) Pod

Answer:

B) StatefulSet

Explanation:

StatefulSet is used for managing stateful applications and provides guarantees about the ordering and uniqueness of pods.

8. Which field in a PodSpec is used to set the restart policy of a Pod?

A) restartPolicy
B) restartMode
C) restartConfiguration
D) restartSetting

Answer:

A) restartPolicy

Explanation:

The restartPolicy field in a PodSpec is used to set the restart policy of a Pod.

9. What command is used to view the resource usage of nodes in a Kubernetes cluster?

A) kubectl describe nodes
B) kubectl get nodes -o wide
C) kubectl top nodes
D) kubectl view nodes

Answer:

C) kubectl top nodes

Explanation:

The kubectl top nodes command is used to view the resource usage of nodes in a Kubernetes cluster.

10. Which of the following is a valid taint effect in Kubernetes?

A) PreferNoSchedule
B) NoSchedule
C) PrioritySchedule
D) AlwaysSchedule

Answer:

B) NoSchedule

Explanation:

NoSchedule is a valid taint effect which prevents scheduling of pods on the tainted node unless they tolerate the taint.

11. What is the default type of a Kubernetes Service?

A) NodePort
B) ClusterIP
C) LoadBalancer
D) ExternalName

Answer:

B) ClusterIP

Explanation:

The default type of a Kubernetes Service is ClusterIP.

12. Which network policy type allows ingress traffic to selected pods?

A) Ingress
B) Egress
C) NetworkPolicy
D) PodSelector

Answer:

C) NetworkPolicy

Explanation:

A NetworkPolicy can be configured to allow or deny ingress traffic to selected pods based on various criteria.

13. How can you expose a pod to external traffic in Kubernetes?

A) Using a NodePort Service
B) Using a ReplicaSet
C) Using a DaemonSet
D) Using a PodNetwork

Answer:

A) Using a NodePort Service

Explanation:

A NodePort Service exposes a pod to external traffic by allocating a static port on each node’s IP address.

14. What is the primary purpose of a Kubernetes Ingress object?

A) To manage internal pod networking
B) To control outbound traffic from a cluster
C) To manage ingress network policies
D) To manage external access to services

Answer:

D) To manage external access to services

Explanation:

An Ingress object is used in Kubernetes to manage external access to services in a cluster, typically HTTP.

15. Which command is used to attach a network policy to a specific pod in Kubernetes?

A) kubectl attach networkpolicy <policy-name> <pod-name>
B) kubectl apply -f <networkpolicy-yaml>
C) kubectl set networkpolicy <policy-name> <pod-name>
D) kubectl bind networkpolicy <policy-name> <pod-name>

Answer:

B) kubectl apply -f <networkpolicy-yaml>

Explanation:

Network Policies are attached to pods by applying a YAML definition file using kubectl apply -f <networkpolicy-yaml>.

16. What type of Kubernetes object is used to provision persistent storage for a pod?

A) PersistentVolume
B) StorageClass
C) PersistentVolumeClaim
D) StorageProvisioner

Answer:

C) PersistentVolumeClaim

Explanation:

A PersistentVolumeClaim (PVC) is used to provision persistent storage for a pod.

17. Which field in a PersistentVolume configuration is used to define how the volume should be reclaimed when released by a claim?

A) reclaimPolicy
B) persistentReclaimPolicy
C) storageReclaimPolicy
D) volumeReclaimPolicy

Answer:

A) reclaimPolicy

Explanation:

The reclaimPolicy field in a PersistentVolume configuration defines how the volume should be reclaimed when released by a claim.

18. What command is used to create a ConfigMap in Kubernetes from a file?

A) kubectl create configmap <configmap-name> --from-file=<file-name>
B) kubectl apply configmap <configmap-name> --from-file=<file-name>
C) kubectl set configmap <configmap-name> --from-file=<file-name>
D) kubectl configure configmap <configmap-name> --from-file=<file-name>

Answer:

A) kubectl create configmap <configmap-name> --from-file=<file-name>

Explanation:

The kubectl create configmap command with the --from-file option is used to create a ConfigMap from a file.

19. Which volume type would be suitable for sharing storage between pods on different nodes in a Kubernetes cluster?

A) emptyDir
B) hostPath
C) nfs
D) local

Answer:

C) nfs

Explanation:

The nfs volume type allows sharing storage between pods running on different nodes in a Kubernetes cluster.

20. Which command is used to get information about the storage capacity of a Kubernetes cluster?

A) kubectl describe storage
B) kubectl get storage
C) kubectl top storage
D) kubectl get capacity

Answer:

B) kubectl get storage

Explanation:

The kubectl get storage command can provide information about the storage resources in a Kubernetes cluster.

21. What command is used to check the events in a specific namespace in Kubernetes?

A) kubectl describe events --namespace=<namespace-name>
B) kubectl get events --namespace=<namespace-name>
C) kubectl show events --namespace=<namespace-name>
D) kubectl list events --namespace=<namespace-name>

Answer:

B) kubectl get events --namespace=<namespace-name>

Explanation:

The kubectl get events --namespace=<namespace-name> command is used to list events in a specific namespace.

22. What is the default namespace in Kubernetes where system components are installed?

A) kube-system
B) kubernetes-system
C) system-components
D) kubernetes-core

Answer:

A) kube-system

Explanation:

The kube-system namespace is the default namespace for system components in Kubernetes.

23. Which command can be used to check the resource limits of a pod in Kubernetes?

A) kubectl describe pod <pod-name>
B) kubectl get pod <pod-name> -o yaml
C) kubectl inspect pod <pod-name>
D) kubectl show pod <pod-name>

Answer:

A) kubectl describe pod <pod-name>

Explanation:

The kubectl describe pod <pod-name> command provides detailed information about a pod, including its resource limits.

24. How can you drain a node in Kubernetes for maintenance?

A) kubectl drain <node-name>
B) kubectl cordon <node-name>
C) kubectl maintain <node-name>
D) kubectl offline <node-name>

Answer:

A) kubectl drain <node-name>

Explanation:

The kubectl drain <node-name> command is used to drain a node in preparation for maintenance.

25. What command is used to check the connectivity between nodes in a Kubernetes cluster?

A) kubectl check connectivity
B) kubectl get nodes --connectivity
C) kubectl describe network
D) kubectl get cs

Answer:

D) kubectl get cs

Explanation:

The kubectl get cs (component status) command can be used to check the health and connectivity of the components in a Kubernetes cluster.


Comments

Spring Boot 3 Paid Course Published for Free
on my Java Guides YouTube Channel

Subscribe to my YouTube Channel (165K+ subscribers):
Java Guides Channel

Top 10 My Udemy Courses with Huge Discount:
Udemy Courses - Ramesh Fadatare