Medium CKA practice questions
Applied — put a concept to work in a realistic situation. 107 medium questions available — no sign-up, always free.
You SSH into a control-plane node after users report that all kubectl commands fail with 'The connection to the server 10.0.1.5:6443 was refused - did you specify the right host or port?'. The node itself is up and other cluster nodes are Ready according to a monitoring dashboard cached minutes ago. The API server runs as a static pod managed by kubelet. Which command sequence will most directly help you diagnose why the API server is not responding?
You created a ClusterRole named 'pod-reader' that grants get, list, and watch on pods. A developer's ServiceAccount 'ci-bot' in the 'dev' namespace needs to read pods only within the 'dev' namespace. Which binding correctly grants exactly this access using the existing ClusterRole?
After bootstrapping a new single-control-plane cluster with kubeadm, you notice all nodes report NotReady and every Pod (including CoreDNS) remains stuck in ContainerCreating. Running 'kubectl describe pod' on a CoreDNS Pod shows the event: 'Failed to create pod sandbox: ... failed to find plugin "..." in path [/opt/cni/bin] ... network plugin is not ready: cni config uninitialized'. What is the correct action to bring the cluster to a healthy state?
You maintain a Deployment for a payments service. The team stores 12 application settings in a ConfigMap named 'payments-config' and wants ALL of them injected as environment variables into the container without listing each key individually in the Pod spec. Which configuration achieves this?
You mount a ConfigMap named app-config into a Deployment's pod using a volume with a subPath reference (mountPath: /etc/app/config.yaml, subPath: config.yaml). After editing the ConfigMap with 'kubectl edit configmap app-config', you notice the running pods still see the old file contents even after several minutes. Other Deployments that mount the same ConfigMap as a full directory (no subPath) do receive the update automatically. What is the correct explanation and fix?
You create a Deployment named 'web' with replicas set to 3, but after several minutes 'kubectl get pods' shows no pods at all for that Deployment. 'kubectl get deployment web' shows DESIRED 3 but CURRENT and AVAILABLE both 0, and no ReplicaSet exists. The scheduler and kubelets are healthy, and other existing pods run fine. Which action is the most appropriate first step to diagnose the root cause?
Pods in your cluster can resolve internal service names (e.g., my-svc.default.svc.cluster.local) but all attempts to resolve external domains (e.g., api.github.com) return NXDOMAIN. CoreDNS pods are Running with no restarts, and the CoreDNS Service has valid endpoints. You inspect the CoreDNS ConfigMap and find that the 'forward' plugin line was recently edited. What is the MOST likely cause and the correct fix?
Users report that all applications in the cluster suddenly cannot resolve any DNS names, both internal (svc.cluster.local) and external. Pods themselves start fine and node-to-node connectivity works. Running 'kubectl get pods -n kube-system' shows no CoreDNS pods listed at all, and 'kubectl get deploy coredns -n kube-system' shows READY 0/0. Recent cluster maintenance was performed by another engineer. What is the most likely cause and the correct fix?
Users report that pods across the cluster cannot resolve any DNS names, both internal and external. You check the CoreDNS deployment and see two CoreDNS pods in Running state with 0 restarts, and the pods' logs show no errors. From a test pod, 'nslookup kubernetes.default' times out. You run 'kubectl get svc -n kube-system' and notice there is no service named 'kube-dns'. What is the most likely cause of the DNS failure?
A worker node's kubelet is running, but you suspect containers are failing at the runtime level. The node uses containerd as its CRI. You need to list all running containers and inspect a specific container's status directly at the runtime layer, bypassing the Kubernetes API. Which tool and configuration is the correct approach?
You maintain a monitoring DaemonSet that must run a node-exporter pod on every node in the cluster, including the control-plane nodes. After deploying, you notice the DaemonSet pods are running on all worker nodes but not on the control-plane nodes. Describing a control-plane node shows the taint 'node-role.kubernetes.io/control-plane:NoSchedule'. Which change to the DaemonSet pod spec will allow the pods to also be scheduled on the control-plane nodes without affecting scheduling elsewhere?
A developer creates a PVC named 'cache-data' that dynamically provisions a PV through a StorageClass whose reclaimPolicy is 'Delete'. After testing, the developer deletes the PVC to free resources. A day later, the team asks you to recover the data that was on that volume. Which statement correctly describes what happened and why?
You manage a Deployment named 'billing-api' whose pods mount a ConfigMap named 'billing-config' as environment variables using envFrom. After a colleague updates several values in 'billing-config' with 'kubectl edit configmap billing-config', users report the application is still using the old configuration values. The pods are all Running and healthy. What is the correct explanation and remediation?
A Deployment named web has 10 replicas and uses the default RollingUpdate strategy with maxSurge: 0 and maxUnavailable: 25%. You trigger a rolling update with a new image. During the rollout, you observe that only some old pods are terminated at a time and no extra pods beyond 10 are ever created. What is the maximum number of pods that can be unavailable at any moment during this rollout?
You need to apply several changes to a running Deployment named 'web': update the container image, add a new environment variable, and increase the CPU request. You want to make all these edits without triggering a separate rolling update for each change, then roll them all out together as a single revision. Which sequence of commands achieves this?
A platform engineer manages a Deployment named 'payments-api'. After several rolling updates, they attempt to roll back two revisions using 'kubectl rollout undo deployment/payments-api --to-revision=3', but the command fails with an error stating that the revision was not found. Running 'kubectl rollout history deployment/payments-api' shows only the two most recent revisions. What is the most likely cause?
A Deployment named 'payments' runs 10 replicas behind a Service that must never drop below full capacity during updates. The team also wants updates to proceed as fast as possible while guaranteeing that at no point are fewer than 10 Pods Ready. Which rollingUpdate strategy configuration satisfies these requirements?
A frontend Deployment reports intermittent 502 errors when calling the 'payments' Service. The Service selector matches the pods, and `kubectl get endpoints payments` shows several IPs listed. However, inspecting `kubectl get endpointslices -l kubernetes.io/service-name=payments -o yaml` reveals that some endpoints have `conditions.ready: false` while their pods show STATUS Running. What is the most likely cause of the endpoints being marked not ready?
After a maintenance reboot of a single-node control plane, `kubectl get nodes` fails with 'The connection to the server 10.0.0.5:6443 was refused'. You SSH into the control-plane node. `systemctl status kubelet` shows kubelet is active and running. You need to find out why the kube-apiserver static pod is not serving requests. What is the BEST first step to diagnose the failure?
Your production cluster uses an external etcd topology (etcd runs on dedicated nodes outside the control-plane machines). You need to take an etcd snapshot for backup from one of the etcd nodes using etcdctl v3. The etcd cluster is secured with client certificate authentication. Which command correctly produces the snapshot?
You are responsible for etcd backups on a kubeadm-provisioned cluster where etcd runs as a stacked static pod on the control-plane node. Before a risky upgrade, you must take a manual snapshot of the etcd data from the control-plane host. The etcd server certificates are located in /etc/kubernetes/pki/etcd/. Which command correctly captures a consistent snapshot?
You are administering a three-node stacked etcd control plane provisioned with kubeadm. After a network partition, users report intermittent API server errors. You want to inspect the etcd cluster membership and confirm each member's health directly from one control-plane node. Which command correctly queries etcd using the certificates that kubeadm places on the node?
You are deploying a Cassandra cluster as a StatefulSet named 'cassandra' in the 'data' namespace. The application requires each pod to be individually addressable via a stable DNS name so peers can discover each other directly, rather than routing through a single virtual IP that load-balances requests. Which Service configuration will produce per-pod DNS A records like 'cassandra-0.cassandra.data.svc.cluster.local'?
You are deploying an application named 'billing' with Helm. The chart's values.yaml sets 'replicaCount: 2'. Your team maintains an environment file prod-values.yaml that sets 'replicaCount: 4'. During a hotfix rollout you run: helm install billing ./billing-chart -f prod-values.yaml --set replicaCount=6. After the release completes, how many replicas will the Deployment be configured with, and why?
A platform engineer reports that a Helm release named 'billing-api' was installed several days ago, but running `helm list` in their current shell shows no releases. Other teammates confirm the workload pods are running in the 'finance' namespace. Which command will correctly reveal the 'billing-api' release and its status?