CNCF · Free Practice Questions · Last reviewed May 2026
47real exam-style questions organised by domain, each with the correct answer highlighted and a plain-English explanation of why it's right — and why the others are wrong.
13% of exam · 6 sample questions below
Which control plane component is responsible for storing the cluster state and configuration?
etcd
etcd is a distributed, consistent, and highly available key-value store that serves as Kubernetes' backing store for all cluster data. It persistently stores the entire cluster state, including configuration data, metadata for all Kubernetes objects like Pods, Deployments, and Services, and the desired state of the system. Its robust consistency model is critical for ensuring that all control plane components operate on a single, unified source of truth.
kube-controller-manager
kube-apiserver
kube-scheduler
A cluster was upgraded from v1.28 to v1.29 using kubeadm. After upgrading the control plane, nodes remain at v1.28. What is the correct next step to upgrade a worker node?
Drain the node, then run 'kubeadm upgrade node' on the worker node.
SSH into the worker node and run 'kubeadm upgrade node', then upgrade kubelet and kubectl, then restart kubelet.
This is the standard procedure for upgrading a worker node with kubeadm.
Upgrade kubelet on the worker node using the package manager and restart kubelet.
Run 'kubeadm upgrade apply' on the worker node.
Which component runs on every node in a Kubernetes cluster and ensures containers are running in a pod?
kubelet
The kubelet is the Kubernetes node agent that runs on every node, including control-plane nodes. It registers the node with the API server, watches for Pod objects bound to that node, and continually drives the actual state of containers toward the desired PodSpec. It performs liveness, readiness, and startup probes and reports pod/node status back to the API server. Because it is the component that owns the pod lifecycle on a node, it is the only component in this list that is a required Kubernetes component on every node.
kube-scheduler
container runtime
kube-proxy
A user reports that they can't authenticate to the cluster using a kubeconfig file. Running 'kubectl config view' shows the current context points to a user with client certificate and key. Which command checks the expiration date of the client certificate?
kubeadm upgrade plan --certificate-expiration
kubectl config view --raw | grep client-certificate
openssl x509 -in /etc/kubernetes/admin.conf -text -noout
kubeadm certs check-expiration
This subcommand is the authoritative way to inspect the lifetimes of all certificates managed by kubeadm, including the CA, apiserver, controller-manager, scheduler, kubelet, and the client certificate embedded in admin.conf. It prints a table showing the expiration date and remaining days for each component, giving immediate insight into whether certificate expiry is causing authentication problems. For kubeadm-based clusters, this is the correct first tool for diagnosing certificate-related authentication issues.
An admin runs 'kubectl get pods' and sees a pod in 'Pending' state for a long time. 'kubectl describe pod' shows '0/1 nodes are available: 1 node has memory pressure'. Which is the most likely cause?
The node's disk is full.
The pod's image pull secret is missing.
The node is under memory pressure and cannot admit the pod.
Memory pressure prevents the scheduler from placing the pod on that node.
The pod requires more CPU than any node can provide.
Which command creates a kubeconfig file that can be used to authenticate as a specific user?
kubectl config set-context
kubectl config set-credentials
This is the correct command because it creates or updates the user entry in the kubeconfig with the necessary authentication credentials, such as --client-certificate, --client-key, --token, or --username/--password. Running this command ensures that a named user with valid credentials is available for contexts to reference. Without it, you only have cluster and context definitions but no authenticated identity to actually connect to the API server.
kubectl config create-user
kubectl config set-cluster
Want more Cluster Architecture, Installation and Configuration practice?
Practice this domain10% of exam · 6 sample questions below
Which of the following service types exposes a service on a static port on each node's IP address?
ExternalName
NodePort
NodePort exposes the service on a static port on each node's IP address.
LoadBalancer
ClusterIP
You have a Service named 'my-service' in namespace 'ns1'. Another pod in namespace 'ns2' needs to resolve 'my-service' using DNS. What FQDN should the pod use?
my-service.svc.cluster.local
my-service.cluster.local
my-service.ns1.svc.cluster.local
This is the correct Fully Qualified Domain Name (FQDN) for a Kubernetes service. It adheres to the standard format: `<service-name>.<namespace-name>.svc.<cluster-domain>`. Here, `my-service` is the service name, `ns1` is its namespace, `svc` denotes it as a service, and `cluster.local` is the default cluster domain. This FQDN provides an unambiguous and universally resolvable address for the service from any pod within the cluster, regardless of the querying pod's own namespace.
my-service.ns2.svc.cluster.local
An Ingress resource is created with the following spec:
spec: rules: - host: example.com http: paths: - path: /api pathType: Prefix backend: service: name: api-service port: number: 80
The backend service 'api-service' is in the same namespace as the Ingress. What must be true for the Ingress to route traffic to the service?
The Ingress controller must be configured to use the NodePort of the service.
The service 'api-service' must be of type NodePort.
The service 'api-service' must have a valid ClusterIP and at least one endpoint.
The Ingress controller forwards traffic to the service's ClusterIP, and endpoints must exist for the service to forward to pods.
The Ingress must have an IngressClass annotation.
A pod cannot resolve a service DNS name. The cluster uses CoreDNS. Which of the following is the most likely cause if the pod's /etc/resolv.conf contains 'nameserver 10.96.0.10' and the CoreDNS pod is running?
The CoreDNS ConfigMap does not have the correct cluster domain.
CoreDNS's kubernetes plugin reads a ConfigMap (typically named 'coredns' in the kube-system namespace) to determine the cluster domain, usually 'cluster.local.' If the 'kubernetes' block in that ConfigMap specifies a mismatched or missing domain, CoreDNS will not append the correct search domain, so fully qualified service names like 'my-svc.my-ns.svc.cluster.local' will fail to resolve. Since the pod is running, a static misconfiguration in the ConfigMap is a primary suspect and directly explains the symptom.
The pod's DNS policy is set to 'Default'.
The CoreDNS pod is in CrashLoopBackOff.
The service's DNS name is misspelled.
You have a headless service named 'my-headless' with clusterIP: None. A pod in the same namespace queries the DNS name 'my-headless'. What will the DNS response contain?
An error because headless services cannot be queried by DNS.
A single A record with the service's IP.
The ClusterIP of the service (which is None).
A list of A records for each pod matching the service selector.
A headless Service with a selector creates Endpoints (or EndpointSlices) from the ready pods that match the labels. When a client looks up this Service name, CoreDNS returns one A record for each such pod IP, allowing direct pod discovery. This behavior is fundamental to StatefulSets, where each pod gets its own DNS name from this list.
You have three pods selected by a service. One pod is in 'CrashLoopBackOff' state. How does the service's endpoints behave?
The service removes all endpoints to avoid partial connectivity
The service endpoints include only the two healthy pods
The Endpoints object for a Service contains only the IP addresses of Pods that are currently Ready — that is, passing their readiness probes. Since two of the three Pods are healthy, the Service's Endpoints (or EndpointSlices) list exactly those two Pod IPs, and the ClusterIP load balances only to them.
The service endpoints include the unhealthy pod but traffic is not routed to it
The service includes all three pods in its endpoints
Want more Services and Networking practice?
Practice this domain8% of exam · 6 sample questions below
A pod in the 'production' namespace is in a CrashLoopBackOff state. The pod has been running successfully for several days. You run 'kubectl describe pod app-pod -n production' and see the message: 'OOMKilled'. What is the MOST appropriate action to resolve this issue?
Increase the memory limit in the pod's container resource specification
OOMKilled indicates the container exceeded its configured memory limit. Increasing the memory limit allows the container to use more memory and prevents the OOM kill.
Delete the namespace and redeploy all workloads
Delete and recreate the pod to clear the crash loop
Increase the CPU request for the container
Which kubectl command will show the rollout history of a Deployment named 'web-app'?
kubectl describe deployment web-app
kubectl rollout status deployment web-app
kubectl rollout history deployment web-app
kubectl rollout history deployment web-app is correct because it is the dedicated kubectl subcommand for viewing the Deployment's rollout history. It lists all revisions with their change-cause annotations (if set), and can be combined with --revision to inspect a specific revision; this history is actually derived from the underlying ReplicaSets created for each change to the pod template.
kubectl get deployment web-app -o yaml
You have a Deployment 'db' with 3 replicas. Each pod writes to a PersistentVolumeClaim (PVC). A StatefulSet is required for stable network identities and ordered pod management. Which of the following is a key characteristic that differentiates a StatefulSet from a Deployment?
StatefulSets support rolling updates but not canary deployments
StatefulSets automatically create a Service for each pod
StatefulSets cannot use PersistentVolumeClaims
StatefulSets maintain a sticky identity for each pod, including stable hostnames and persistent storage
StatefulSets are designed to provide a stable, unique identity to each pod they manage, which is crucial for stateful applications. This identity includes a stable network hostname, typically in the format `$(pod-name).$(headless-service-name)`, and persistent storage that remains associated with the pod's ordinal index even if the pod is rescheduled to a different node. This ensures data integrity and consistent application behavior across pod lifecycle events.
A pod with a resource request of 500m CPU and a limit of 1 CPU is scheduled. The node has a CPU capacity of 2 cores. What does the '500m' represent?
500 millicores (0.5 CPU core)
In Kubernetes, CPU resources are specified in millicores, where 'm' is the unit suffix. A value of 500m precisely denotes 500 millicores, which is equivalent to 0.5 of a full CPU core. This is the standard, absolute measure for CPU requests and limits, ensuring consistent resource allocation across nodes.
500 megabytes of memory
50% of the node's CPU capacity
A limit of 500,000 CPU seconds per day
You have a PriorityClass 'high-priority' with value 1000 and 'low-priority' with value 100. A pod A with 'high-priority' is pending because the node has no resources. A pod B with 'low-priority' is running on that node. What will happen if preemption is enabled?
Pod A will be scheduled only after pod B completes its work
Pod A will remain pending because preemption is not enabled by default
The cluster administrator must manually delete pod B to allow pod A to schedule
Pod B will be preempted (evicted) to allow pod A to be scheduled on the node
This is the correct behavior. When Pod A, possessing a higher priority, cannot find a node with sufficient available resources, the kube-scheduler will identify a node where Pod B (a lower-priority pod) is running and whose eviction would free up the necessary resources. The scheduler then initiates the preemption process, which involves evicting Pod B from that node. This action frees up the required resources, allowing Pod A to be successfully scheduled and started on the now-available node.
Which TWO of the following are valid ways to expose environment variables from a ConfigMap to a pod? (Select TWO.)
Using envFrom with secretRef
Using env field with configMapKeyRef directly
Using envFrom with configMapRef
Using envFrom with configMapRef is a valid and straightforward way to expose all key-value pairs from a ConfigMap as environment variables. The configMapRef field inside envFrom specifies a source ConfigMap by name, and Kubernetes populates every entry from that ConfigMap into the container's environment. This is ideal when you want to inject multiple variables without listing each key individually, though you may still override specific keys using the env field.
Mounting the ConfigMap as a volume, which automatically sets environment variables
Using env field with valueFrom and configMapKeyRef
The env field with valueFrom and configMapKeyRef is a valid way to expose a specific key from a ConfigMap as an environment variable. The valueFrom wrapper indicates that the variable's value should be sourced from an external reference, and configMapKeyRef specifies the ConfigMap name and the key to extract. This allows you to cherry-pick individual entries and optionally give the environment variable a different name than the ConfigMap key.
Want more Workloads and Scheduling practice?
Practice this domainA cluster uses a CSI driver for dynamic provisioning. An administrator creates a StorageClass with 'volumeBindingMode: WaitForFirstConsumer' and a PVC. The pod using the PVC is scheduled to a node. However, the PV is never provisioned. What is the most likely cause?
The PVC is not bound to a PV because no PV exists.
The CSI driver is not installed or malfunctioning.
The StorageClass references a CSI provisioner (e.g., csi.contoso.com), and Kubernetes relies on the external-provisioner sidecar to send CreateVolume RPCs to the CSI driver controller. If that driver controller is not installed, the DaemonSet pods are CrashLooping, or the CSI socket is unavailable, the provisioner cannot create the backend volume, so no PV is bound and the PVC remains Pending with events like 'Failed to provision volume with storage class'. Inspecting the csi-controller logs and the driver DaemonSet status will confirm the malfunction.
The pod does not have the correct node selector.
The StorageClass uses 'Immediate' binding mode.
A developer wants to mount a ConfigMap as a volume in a pod. However, the pod should only see specific keys from the ConfigMap, not all keys. What is the best approach?
Use the ConfigMap to set environment variables instead of a volume mount.
Use the 'items' field in the ConfigMap volume definition to specify which keys to include.
The `items` field within a ConfigMap volume definition is the precise and recommended method for selectively exposing specific keys as files inside a container. By specifying `key` and `path` for each desired entry, only the relevant data from the ConfigMap is mounted into the pod's filesystem, preventing unnecessary data exposure. This approach ensures minimal resource usage and adheres to the principle of least privilege by only providing what is strictly required. For example, `items: [{key: "app-config.yaml", path: "config.yaml"}]` mounts only the `app-config.yaml` key as `config.yaml`.
Mount the entire ConfigMap and use a startup script to remove unwanted files.
Create a new ConfigMap with only the needed keys.
Which TWO statements about PersistentVolume (PV) reclaim policies are correct?
Retain: The PV remains in the cluster and must be manually reclaimed.
Retain is correct because the PersistentVolume object remains in the cluster after its PVC is released, transitioning to the Released phase rather than being automatically removed. The underlying storage asset is preserved intact, and an administrator must manually reclaim it, typically by deleting the PV or clearing the claimRef so the volume can be reused under a new claim.
Retain: The underlying storage asset is automatically deleted.
Recycle: The PV is automatically cleaned and made available for a new claim.
Delete: The PV must be manually deleted by the administrator.
Delete: The PV and the associated storage asset are automatically deleted.
Delete correctly describes the policy where both the PersistentVolume object and its associated cloud storage asset are automatically removed once the PVC is deleted. This is the default for many dynamic provisioners, such as AWS EBS or GCE PD, and helps ensure that orphaned volumes do not incur ongoing costs.
A DevOps team needs to deploy a stateful application that requires persistent storage with ReadWriteMany access mode across multiple pods running on different nodes. Which Kubernetes resource should they use to provision the storage?
A hostPath volume
A PersistentVolume with access mode ReadWriteOnce
A PersistentVolume with access mode ReadWriteMany
A PersistentVolume with access mode ReadWriteMany allows multiple pods across different nodes to simultaneously read and write to the same storage volume, satisfying the stem’s requirement for concurrent access from pods scheduled on distinct nodes. This access mode directly addresses the constraint of multi-node, multi-pod stateful workloads, whereas ReadWriteOnce would restrict access to a single node.
An emptyDir volume
You are a cluster administrator managing a production Kubernetes cluster that hosts a stateful application using StatefulSets with PersistentVolumeClaims (PVCs) backed by a cloud provider's persistent disk. A developer reports that a new pod in the StatefulSet is stuck in 'Pending' state. You describe the StatefulSet and see that it has 3 replicas. Two pods are Running, but the third pod (pod-2) is Pending. You check the PVC for pod-2 and see it is 'Pending'. The StorageClass uses 'WaitForFirstConsumer' volume binding mode. The node where pod-2 should run has sufficient resources. Other PVCs in the same namespace bound successfully. What is the most likely cause of the pending PVC and pod?
The PV that should bind to the PVC has a nodeAffinity that does not match any available node.
When a PersistentVolumeClaim (PVC) uses the WaitForFirstConsumer binding mode, the selection or provisioning of a PersistentVolume (PV) is delayed until a pod requiring that PVC is scheduled. If the selected PV has nodeAffinity rules that do not match the node where pod-2 was scheduled, the volume attachment will fail. This mismatch prevents the volume from being mounted, causing pod-2 to remain in a Pending state, unable to start its containers.
The CSI driver is not installed on the node where pod-2 is scheduled.
The PVC's requested storage size exceeds the available capacity in the cloud provider's quota.
The PVC's access mode is ReadWriteOnce, but the pod requires ReadWriteMany.
A developer accidentally runs 'kubectl delete pvc data-claim'. What is the immediate effect on the PersistentVolume pv-data?
The PV pv-data is automatically deleted.
The PV pv-data remains Bound to the deleted PVC.
The PV pv-data immediately becomes Available and can be reused.
The PV pv-data enters the Released state and is not deleted.
With the Retain reclaim policy configured, deleting the bound PVC causes the PV to enter the Released state rather than being deleted or recycled. This means the PV still exists and its underlying storage resources—such as disk data—remain intact, but it is no longer bound to any claim. The PV will remain in Released status until an administrator manually intervenes, typically by deleting the PV and recreating it or by editing its claimRef to allow rebinding. This preserves data for recovery but leaves the PV unused until explicit manual action is taken.
Want more Storage practice?
Practice this domainBased on the exhibit, the pod is in CrashLoopBackOff. Which command should you run NEXT to identify the root cause?
kubectl describe node node-1
kubectl top pod api-6f4d7b9d4c-abcde -n production
kubectl get deployment api -n production -o yaml
kubectl logs api-6f4d7b9d4c-abcde -n production --previous
kubectl logs api-6f4d7b9d4c-abcde -n production --previous is the correct command because it fetches the stdout/stderr from the previous, now-terminated container instance in the pod. In a CrashLoopBackOff, the currently restarted container usually has no useful logs — it may not have started, or it immediately restarted before writing anything — while the last crashed instance carries the actual error that triggered the restart. This gives you the application-level failure message (e.g., uncaught exception, missing config, listen EADDRINUSE) needed to fix the root cause; pair it with kubectl describe pod to see the last exit code and restart count.
You are a CKA managing a production cluster with 5 worker nodes. A developer reports that a new deployment 'payment-service' is not accessible from other pods via its Service 'payment-svc' in the 'default' namespace. The Service is of type ClusterIP with selector 'app: payment'. The deployment has 3 replicas, all showing 'Running' status. From a test pod, you run 'curl http://payment-svc:8080' and get 'Connection refused'. You verify that the pods are listening on port 8080 and the container's readiness probe passes. 'kubectl get endpoints payment-svc' shows no endpoints. 'kubectl describe svc payment-svc' shows the selector 'app=payment'. What is the most likely cause?
A NetworkPolicy is blocking traffic from the test pod to the service IP.
The service type should be NodePort to allow in-cluster access.
The readiness probe is failing on all pods, causing them to be removed from service endpoints.
The pods have label 'app: payment-service' instead of 'app: payment', so the service selector does not match.
A Service's spec.selector uses exact key-value matching to choose backing pods. If the selector is app: payment and the pods are labeled app: payment-service, the values are different, so the Endpoints controller does not add any pod IP to the Service's backend. Label matching is exact, not substring-based, so the Service will have no endpoints and in-cluster clients cannot connect to it.
Based on the exhibit, what is the most likely cause of the pod not running?
The volume driver is not installed on node-1.
The pod has exceeded its resource limits.
The node 'node-1' is experiencing disk pressure.
The Secret 'my-secret' does not exist in the namespace.
The exhibit's event message contains the exact Kubernetes error string: the secret `my-secret` could not be found in the pod's namespace, so the kubelet is unable to inject the environment variable or volume content required by the container spec. Every Secret reference is namespaced, and the kubelet queries the API server for the secret exactly as it appears in the pod manifest; any typo, wrong namespace, or omitted resource will immediately produce this failure. Because the error is explicit and points to a missing API object, the most likely cause is that `my-secret` simply does not exist in the namespace where the Pod is running.
A pod has status 'Init:Error'. What does this indicate?
The main container has crashed
An init container failed
When an init container exits with a non-zero exit code, the pod status transitions to Init:Error (or Init:CrashLoopBackOff if it keeps failing). Kubernetes treats init containers as mandatory prerequisites: they run sequentially to completion before any regular containers start. The failing init container can be identified with kubectl describe pod, which shows the last exit code and reason, and its logs are available via kubectl logs <pod> -c <init-container-name>. This directly matches the init error status shown in the question stem.
The pod is being initialized
There is a network error during initialization
A pod is running but cannot be accessed via its ClusterIP service from another pod in the same namespace. The service endpoints list shows the pod's IP. What is the most likely cause?
The kube-proxy is not running on the node
A NetworkPolicy is blocking the traffic
NetworkPolicy is a namespace-scoped firewall that can restrict egress traffic from a specific pod (via podSelector) to a destination service's backing pod IP or CIDR. Even if the Service object and endpoints are intact, a NetworkPolicy denying egress from the source pod to the backend pod's IP or port will silently drop the packets, making the Service unreachable only for the affected pod(s).
The service's targetPort is incorrect
The pod is running on a different node without proper routing
A ClusterIP Service is not reachable from within the cluster. You verify that the Service has endpoints. Which of the following could be the cause? (Select two.)
kube-proxy is not running on the node.
The container is listening on a different port than the Service targetPort.
The pod's readiness probe is failing.
The Service name is too long.
Want more Troubleshooting practice?
Practice this domain12% of exam · 5 sample questions below
A DevOps engineer notices that the kubelet on a node is unable to register with the Kubernetes API server. The kubelet logs show 'Failed to get bootstrap CA certificate' and the node is not yet part of the cluster. What is the most likely cause?
The kubelet configuration file has incorrect node IP.
The node's RBAC permissions are misconfigured.
The API server is not running.
The bootstrap token used for TLS bootstrapping has expired.
Bootstrap tokens used in TLS bootstrapping are intentionally short-lived and can expire, especially if they were created for a one-time node registration. When a token expires, the API server rejects the kubelet's authentication attempt, returning a 401 Unauthorized, and the kubelet cannot complete the bootstrap sequence or download the CA certificate. This precisely matches the observed symptom of a bootstrap CA retrieval failure, making it the correct root cause.
An administrator is tasked with setting up a new Kubernetes cluster using kubeadm. They have two nodes: one control plane and one worker. After initializing the control plane with 'kubeadm init', the worker node fails to join with the error 'error execution phase preflight: [preflight] Some fatal errors occurred: [ERROR CRI]: container runtime is not running'. What should the administrator check first?
Ensure that containerd is installed and running on the worker node.
The kubelet on the worker node communicates with the container runtime through the Container Runtime Interface (CRI), typically over a Unix socket such as /run/containerd/containerd.sock. If containerd is not installed, the service is stopped, or the socket is missing, kubelet will fail with a CRI connection error and never start pods. Run `systemctl status containerd` and check the socket path configured in kubelet (--container-runtime-endpoint) to confirm the runtime is active.
Verify that the control plane node is healthy.
Check if the join token has expired.
Install a network plugin like Calico on the control plane.
A team is configuring etcd for a multi-node Kubernetes cluster. They want to ensure that etcd data is encrypted at rest. Which approach should they use?
Use LUKS to encrypt the disk partition where etcd data is stored.
Create an EncryptionConfiguration resource specifying a provider like 'aescbc' and configure the kube-apiserver with --encryption-provider-config.
An EncryptionConfiguration resource defines the order and type of providers (such as aescbc, aesgcm, secretbox, or kms) for protecting specific API resource types. The kube-apiserver must be started with --encryption-provider-config=/path/to/encryption-config.yaml, and when it writes data like Secrets to etcd it encrypts that data using the chosen provider (aescbc uses AES-CBC with a randomly generated IV and a 32-byte key). This is the canonical, Kubernetes-native mechanism for encryption at rest and is exactly what the CKA objectives expect.
Use TLS certificates to encrypt communication between etcd and the API server.
Configure etcd to use encryption at rest by setting --experimental-encryption-provider.
A Kubernetes cluster is running with a single control plane node. The administrator wants to add a second control plane node for high availability. What is the first step after the new node has been provisioned with the required software?
Create a bootstrap token on the existing control plane node.
Run kubeadm join with the --control-plane flag on the new node.
To expand a single control plane Kubernetes cluster into a highly available multi-control plane setup, the `kubeadm join` command is the correct utility. Specifically, including the `--control-plane` flag instructs `kubeadm` to not only join the new node to the cluster but also to install and configure all necessary control plane components (API server, scheduler, controller-manager, etcd member) on that node. This command orchestrates the secure integration and replication of critical cluster services, ensuring the new node can participate as a full control plane member.
Run kubeadm init on the new node.
Take a snapshot of etcd using etcdctl.
A DevOps engineer is designing a Kubernetes cluster for a production environment. Which of the following is a best practice for etcd deployment?
Deploy etcd on exactly 2 nodes for simplicity.
Deploy etcd on all worker nodes to maximize redundancy.
Deploy etcd on dedicated nodes with SSD storage.
Deploying etcd on dedicated nodes with SSD storage is the recommended best practice for production Kubernetes clusters. Dedicated nodes ensure etcd has exclusive access to CPU, memory, and network resources, preventing interference from other workloads. Furthermore, etcd is highly sensitive to disk I/O latency, making fast SSD storage crucial for maintaining low write latencies, high throughput, and overall cluster stability and responsiveness.
Deploy etcd on the same nodes as GPU-accelerated workloads.
Want more Cluster Architecture, Installation & Configuration practice?
Practice this domain7% of exam · 6 sample questions below
A developer wants to deploy a pod that will run only once to initialize a database schema. Which Kubernetes resource should they use?
DaemonSet
Job
A Job controller creates one or more pods and tracks them until a specified number successfully terminate. For a one-time task, a simple Job with default completions=1 runs once to completion, and the workload is not recreated if it exits with code 0. It is the native Kubernetes API for exactly-once batch processing.
Deployment
CronJob
You are managing a Kubernetes cluster that hosts a microservices application. One of the services, 'payment-processor', is critical and must always be available. It has a Deployment with 3 replicas, each requesting 1 CPU and 2Gi memory. Recently, the team added a new service 'data-analyzer' that runs as a DaemonSet on all nodes, consuming significant CPU and memory. After the addition, you notice that 'payment-processor' pods are occasionally being evicted, and new pods are slow to be scheduled. You check node resource usage and find that some nodes are overcommitted. You want to ensure that 'payment-processor' pods are never evicted and are scheduled before less critical workloads. Which action should you take?
Add a taint to nodes that have low resources and add tolerations only to 'payment-processor' pods
Increase the resource requests for 'payment-processor' pods to guarantee resources
Create a PriorityClass with a high value and assign it to the 'payment-processor' Deployment
Creating a PriorityClass with a high integer value and assigning it to the 'payment-processor' Deployment is the most effective solution. Pods with higher priority are preferentially scheduled by the kube-scheduler. Crucially, if a high-priority 'payment-processor' pod cannot be scheduled due to insufficient resources on any node, the scheduler will attempt to preempt (evict) lower-priority pods on suitable nodes to free up the necessary resources, thereby ensuring the critical workload runs.
Use node affinity to ensure 'payment-processor' pods run on dedicated nodes
A Pod with a restartPolicy of 'OnFailure' exits with code 0. What will happen?
The container will restart immediately.
The Pod will be terminated.
The Pod will remain in Running state.
The container will not restart, and the Pod will be in Succeeded phase.
With restartPolicy: OnFailure, an exit code of 0 means the container completed its workload successfully, so the kubelet deliberately avoids restarting it. Because all containers have exited with code 0 and no restart is warranted, the Pod's phase is set to Succeeded, which is the terminal state for successful Pod completion. This matches the expected behavior for batch or job-style workloads that should run to completion exactly once.
A Kubernetes cluster has a node pool with GPU nodes labeled 'accelerator=nvidia-tesla'. A Pod requires a GPU. Which configuration is necessary?
Use nodeAffinity with requiredDuringSchedulingIgnoredDuringExecution for the GPU label.
Set resources.limits for 'nvidia.com/gpu' only.
Set nodeSelector to 'accelerator=nvidia-tesla' and request 'nvidia.com/gpu' in resources.
This is the correct and comprehensive approach because it addresses both the placement of the Pod and the allocation of the specialized hardware resource. The `nodeSelector` ensures the Pod is scheduled exclusively onto nodes labeled `accelerator=nvidia-tesla`, which are the GPU-equipped nodes in this scenario. Simultaneously, requesting `nvidia.com/gpu` in the Pod's `resources` section (either `requests` or `limits`) informs the Kubernetes device plugin for NVIDIA GPUs to allocate a specific GPU device to the container, making it available inside the Pod. Both mechanisms are crucial for successful GPU workload deployment.
Add a toleration for GPU node taints.
Which THREE of the following are valid considerations when using resource requests and limits? (Select 3)
Limits must be equal to requests for a Pod to be scheduled.
Requests are used by the scheduler to decide which node can accommodate the Pod.
During scheduling, kube-scheduler evaluates each candidate node by subtracting the sum of container requests for CPU and memory from the node's allocatable capacity. A node is deemed feasible only if it can satisfy all requested quantities, because requests represent the minimum resource reservation needed to run the Pod. Limits are deliberately ignored in this admission calculation, making requests the primary input for node fit decisions.
CPU limits guarantee the Pod will get that amount of CPU.
The QoS class is determined based on requests and limits.
Kubernetes classifies a Pod's QoS class by comparing requests and limits set for every container in the Pod. If all containers specify equal requests and limits for both CPU and memory, the class is Guaranteed; if any container's request or limit differs, it is Burstable; if no resources are specified at all, it is BestEffort. This class determines how the kubelet ranks Pods for eviction and OOM score adjustments under memory pressure.
Memory limits can cause the Pod to be OOMKilled if exceeded.
Memory is incompressible, so the kernel enforces a memory limit as a hard cgroup cap. When a container's memory usage exceeds that cap, the OOM killer is triggered and terminates a process with the highest OOM score, often resulting in the entire Pod being restart. This is fundamentally different from CPU throttling because the limit breach causes termination, not just reduced performance.
You are a platform engineer managing a Kubernetes cluster with 5 worker nodes (node1-node5). The cluster runs a mix of stateless web services and stateful databases. Users report that a critical database Pod (part of a StatefulSet) is frequently evicted during node maintenance. The StatefulSet has a single replica. You need to improve the availability of this database Pod. The current configuration: the Pod has resource requests (2 CPU, 4Gi memory) and limits (4 CPU, 8Gi memory). The cluster uses the default scheduler with no custom policies. Nodes have varying capacities: node1 and node2 have 8 CPU/32Gi memory, node3-node5 have 4 CPU/16Gi memory. During rolling node reboots, the database Pod gets evicted and takes a long time to reschedule because no node has enough resources. What should you do to minimize downtime and ensure the Pod is rescheduled promptly after eviction?
Add nodeAffinity to prefer node1 and node2.
Create a PodDisruptionBudget with minAvailable: 1.
Assign a high priority class to the database Pod.
Assigning a high priority class to the database Pod is the most effective solution for ensuring critical workloads are scheduled promptly. When the scheduler attempts to place a high-priority Pod and cannot find a node with sufficient resources, it will actively preempt (evict) lower-priority Pods from existing nodes to free up the necessary capacity. This mechanism directly addresses resource contention, significantly reducing the scheduling delay for essential applications like a database.
Increase the resource requests to match the limits.
Want more Workloads & Scheduling practice?
Practice this domain10% of exam · 6 sample questions below
A cluster has multiple namespaces: 'frontend', 'backend', and 'monitoring'. A pod in the 'frontend' namespace needs to reach a Service named 'db-service' in the 'backend' namespace. The 'db-service' Service is of type ClusterIP. Which DNS name should the pod use?
db-service.svc.cluster.local
db-service
db-service.backend.cluster.local
db-service.backend.svc.cluster.local
db-service.backend.svc.cluster.local is the fully qualified domain name Kubernetes automatically creates for the Service named db-service in the backend namespace. Any Pod in any namespace, including frontend, can use this FQDN because it contains every component needed by CoreDNS to locate the ClusterIP. It is the canonical cross-namespace address and avoids relying on search domains or local-only short names.
A pod is running with the default DNS policy. The cluster DNS service is at 10.96.0.10. The node's /etc/resolv.conf has nameserver 8.8.8.8. When the pod tries to resolve an external hostname like 'example.com', which DNS server will it query first?
The node's DNS server (8.8.8.8)
There is no DNS resolution; the pod cannot resolve external names by default
The cluster DNS service (10.96.0.10)
With the default `ClusterFirst` DNS policy, the `kubelet` configures the pod's `/etc/resolv.conf` to list the cluster DNS service IP (e.g., 10.96.0.10, which is the default `kube-dns` or `CoreDNS` service IP in many clusters) as the primary nameserver. All DNS queries originating from the pod are initially sent to this cluster DNS service. The service then resolves internal cluster names directly and forwards external name queries to upstream DNS servers.
The pod's own /etc/resolv.conf which contains the node's DNS
An administrator notices that traffic to a Service is not being forwarded to any pod. The Service has selector 'app: web' and there are pods with that label. However, 'kubectl get endpoints' shows no endpoints. What is the most likely cause?
The Service port name does not match the container port name.
The Service type is ClusterIP.
The Service targetPort is not specified.
The pods are not in Ready state (e.g., failing readiness probes).
Readiness probes determine whether a pod is included in the Service's EndpointSlices. The endpoint controller monitors pod readiness and only adds pods whose readiness probe is currently passing; pods failing readiness (or running a container that never becomes ready) are excluded. If all matching pods fail their readiness probe, the endpoint list is empty, and traffic to the Service's ClusterIP or DNS name is dropped. This directly explains why traffic is not reaching the application when the selector matches but no endpoints exist.
A company wants to expose a web application running as a Deployment with 3 replicas to external users. They need a stable IP address that does not change and the ability to terminate TLS. Which resource should they use?
LoadBalancer Service
ClusterIP Service
Ingress resource with a TLS certificate
An Ingress resource, coupled with an Ingress controller, provides a robust solution for exposing web applications externally by offering HTTP/S routing, virtual hosting, and crucially, built-in TLS termination. It allows defining rules to route external traffic to specific services based on hostnames or URL paths, and can manage TLS certificates (stored as Kubernetes Secrets) to encrypt traffic from the client to the Ingress controller, ensuring secure communication.
NodePort Service
A Kubernetes cluster uses a NetworkPolicy to restrict traffic to a set of pods labeled 'app: db'. Which TWO statements about the following NetworkPolicy are correct?
apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: db-policy spec: podSelector: matchLabels: app: db policyTypes: - Ingress ingress: - from: - podSelector: matchLabels: app: api ports: - port: 5432
The database pods can accept traffic on any port from pods with label 'app: api'.
Pods in other namespaces with label 'app: api' cannot reach the database pods.
The database pods can initiate outbound connections to any destination.
Since only Ingress is specified, egress is allowed by default.
Pods from the same namespace but without matching labels can still access the database pods.
Pods with label 'app: api' can connect to the database pods on TCP port 5432.
The ingress rule explicitly allows pods with label app:api on port 5432.
Given the following YAML manifests in the same namespace: ```yaml apiVersion: v1 kind: Pod metadata: name: my-pod labels: app: my-app spec: containers: - name: app image: nginx ports: - containerPort: 8080 --- apiVersion: v1 kind: Service metadata: name: my-service spec: selector: app: my-app ports: - port: 80 targetPort: 8080 ``` A pod in the same namespace tries to reach my-service on port 80. What is the most likely outcome?
The connection succeeds but reaches the pod on port 80.
The connection fails because the endpoints list is empty.
The connection is randomly dropped due to missing port specification.
The connection succeeds and reaches the pod on port 8080.
The service is correctly configured with endpoints mapping port 80 to targetPort 8080.
Want more Services & Networking practice?
Practice this domainThe CKA exam is performance-based — there are no multiple-choice questions. It is a hands-on lab exam completed within 120 minutes. You complete practical tasks in a live or simulated environment. Courseiva practice questions cover the underlying concepts.
Hands-on labs and command-line tasks in a live Kubernetes cluster. Courseiva provides concept checks and scenario questions to support lab preparation.
The exam covers 8 domains: Cluster Architecture, Installation and Configuration, Services and Networking, Workloads and Scheduling, Storage, Troubleshooting, Cluster Architecture, Installation & Configuration, Workloads & Scheduling, Services & Networking. Questions are weighted by domain — higher-weight domains appear more on your actual exam.
No. These are original exam-style practice questions written against the official CNCF CKA exam objectives. They are not copied from the real exam. Courseiva focuses on genuine understanding, not memorisation of braindumps.
Courseiva tracks your accuracy per domain and routes you toward weak areas automatically. Free, no account required.