Back to sections

Kubernetes Quiz

Test what you actually know about Kubernetes. Free sample questions below, from easy to hard, with instant explanations.

easy

1. One of your pods keeps getting terminated with the status OOMKilled shortly after it starts processing a large batch of data. What does this status indicate?

The container ran out of CPU time.
The pod failed its liveness probe.
The container tried to use more memory than its configured limit allowed, so the kernel killed it.Correct
The node ran out of disk space.

OOMKilled specifically means the Linux out-of-memory killer terminated the process because it exceeded the memory limit set for the container. Running out of CPU causes throttling rather than a kill, and disk space or probe failures would show up as a different status entirely.

medium

2. A pod shows CrashLoopBackOff, and kubectl logs shows nothing at all - not even a startup line. What's the best next diagnostic step?

Delete the pod and recreate it, since empty logs mean the log driver is broken
Increase the pod's memory limit, since crashes are always OOM-related
Run kubectl logs <pod> --previous, since the current container may be crashing before its logs flush but the prior instance's logs are usually still availableCorrect
Check the node's kubelet logs instead, since pod-level logs are never useful for crash loops

--previous reads the logs from the last terminated instance of the container, not the fresh one currently restarting. For a container that crashes almost immediately, this is often the only way to see what actually happened.

hard

3. A cluster runs a 5-member etcd cluster for its control plane. A network partition takes 3 of the 5 etcd members offline at once, leaving 2 reachable. What happens to the cluster's ability to accept new writes (e.g., kubectl apply)?

Writes continue, but only for read-only kubectl get commands, since those don't touch etcd at all
Writes continue normally, since etcd only needs a single reachable member to accept writes
Writes automatically fail over to whichever kube-apiserver has the most recent local cache
Writes fail, since etcd requires a majority (quorum) of members to be reachable, and only 2 of 5 remainCorrect

etcd uses the Raft consensus algorithm, which requires a strict majority (quorum) of members to agree before committing a write, so with 5 members that means at least 3 must be reachable. This is exactly why etcd clusters are deployed with odd member counts, so a partition can never leave two halves each believing they might hold quorum. There's also no such thing as an apiserver "cache" acting as a substitute source of truth, kube-apiserver is stateless and depends entirely on etcd for both reads and writes.

easy

4. What does a Kubernetes Service primarily provide?

A way to schedule Pods onto Nodes
A container image registry
Persistent storage for a Pod
A stable network endpoint for a set of PodsCorrect

Storage, scheduling, and image registries are all handled by other things entirely, none of them are a Service's job. Because Pod IPs constantly change as Pods come and go, a Service's whole purpose is to give a stable name and address that always routes to whichever matching Pods happen to be running right now.

medium

5. A Pod is stuck in Pending state. Which is NOT a likely cause?

PersistentVolumeClaim not bound
Insufficient CPU/memory resources in the cluster
No node matches the Pod’s node selector/taint tolerance
Image pull failureCorrect

A Pod only shows as Pending BEFORE it's been scheduled onto a node, and everything else in this list (not enough resources, no matching node, an unbound volume claim) are all things that block scheduling itself. An image pull failure happens AFTER a Pod is already scheduled onto a node, which is why it shows up as ImagePullBackOff instead, not Pending.

hard

6. A NetworkPolicy allows egress to a specific external IP range via ipBlock, but pods still can't reach that service - packet captures show outbound SYN packets leaving the node with no response. What else could be blocking this?

The destination must be inside the cluster's own pod CIDR
NetworkPolicy egress rules require a corresponding Service object
A cloud provider firewall/security group outside the cluster, since NetworkPolicy only enforces at the CNI/pod levelCorrect
The ipBlock CIDR must always exactly match a single /32 address

NetworkPolicy is enforced by the CNI plugin at the pod/node level - it has no visibility into or control over firewalls, security groups, or NAT gateways further upstream in the cloud provider's network. Traffic can leave the pod exactly as allowed and still be dropped somewhere else entirely.

easy

7. What does a Service provide in Kubernetes?

Persistent storage for stateful apps
Auto-scaling of Pods
Scheduling of Pods onto nodes
Stable network endpoint (IP/DNS) to access PodsCorrect

Pods come and go, and each new one gets a new IP, so nothing else in the cluster could reliably talk to them directly. A Service gives you one stable address (an IP and a DNS name) that stays the same and automatically load-balances traffic to whichever Pods happen to be running right now.

medium

8. A container in a Pod keeps crashing. Which command helps diagnose it?

kubectl logs <pod> --previous
kubectl get events --field-selector involvedObject.name=<pod>
All of the aboveCorrect
kubectl describe pod <pod>

No single command tells the whole story of a crash: --previous shows you what the container printed right before it died, describe pod shows recent events and how many times it's restarted, and get events shows broader scheduling/health signals from the cluster. Using all three together gives you the fullest picture of what actually went wrong.

hard

9. You trigger a rolling update on a Deployment with maxUnavailable set to 0 and maxSurge set to 25 percent, but the cluster's nodes are already near full capacity. The rollout starts but then stalls indefinitely with new pods stuck in Pending. What's happening?

The Deployment's revision history limit was exceeded.
The container image tag was not updated.
The readiness probe was removed from the new pod spec.
maxSurge is trying to create extra pods above the current replica count, but there isn't enough free node capacity to schedule them, and maxUnavailable being 0 means old pods can't be removed to make room.Correct

With maxUnavailable at 0, Kubernetes can't remove any old pods until new ones are ready, and maxSurge is supposed to create extra pods temporarily to make that possible, but if the cluster has no spare capacity those surge pods just sit Pending forever, deadlocking the rollout. This is purely a capacity problem, unrelated to revision history limits or probes.

easy

10. Which command creates a Deployment from a YAML file named app.yaml?

kubectl create deployment app.yaml
kubectl deploy app.yaml
kubectl run -f app.yaml
kubectl apply -f app.yamlCorrect

kubectl apply reads whatever's described in a YAML file and either creates it (if it doesn't exist) or updates it (if it does), which is exactly the 'point at this file and make the cluster match it' behavior you want for deploying from app.yaml.

Ready for the real thing?

Take the full timed Kubernetes quiz and see your score.

    Welcome to OpsQuiz!

    Real scenario-based DevOps questions, hands-on practice, and clear explanations for every answer.