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. You apply a NetworkPolicy with a podSelector matching your app, listing only ingress rules and no policyTypes field. What happens to egress traffic from these pods?

The NetworkPolicy is invalid and rejected by the API server
Egress is blocked by default the moment any NetworkPolicy targets the pod
Egress remains fully allowed - omitting policyTypes with only ingress rules present defaults it to Ingress onlyCorrect
Egress is blocked only for traffic leaving the cluster

policyTypes defaults based on which rule types are present in the spec. A NetworkPolicy with only ingress rules and no explicit policyTypes only restricts ingress - egress from those pods is untouched.

medium

2. How do you check which resources a Role named dev-role allows?

kubectl get rolebinding dev-role -o yaml
kubectl describe role dev-role
kubectl auth can-i --list --as=system:serviceaccount:default:dev-user
Both A and C (if you know the SA/user)Correct

A Role by itself only defines a list of possible permissions, it doesn't tell you who actually HAS them, that's a separate RoleBinding. describe role shows you the rules on the Role itself, while auth can-i --list --as=<user> tells you what's actually, effectively granted to a specific person or service account, so checking both gives you the complete picture.

hard

3. A pod is repeatedly OOMKilled, but kubectl top pod shows memory usage well below its configured limit right before each kill. What's the likely explanation?

A short-lived memory spike happened between metrics-server's sampling intervals, exceeding the limit even though it wasn't visible in the last sampleCorrect
OOMKilled only ever happens when requests, not limits, are exceeded
kubectl top is unrelated to OOM kills and can be ignored entirely
The pod's memory limit is being enforced against the node's total memory, not the container's

metrics-server samples periodically (commonly every 15-60s), so a brief spike that crosses the cgroup memory limit and gets OOM-killed can easily happen between two samples, leaving no trace in the metrics you can see afterward.

easy

4. A team wants their pods to only ever be scheduled onto nodes labeled disktype=ssd, but without hardcoding a specific node name. Which feature should they use?

A PodDisruptionBudget scoped to disktype=ssd nodes
resources.requests.storage set on the container spec
nodeAffinity with a requiredDuringSchedulingIgnoredDuringExecution rule matching disktype=ssdCorrect
A NoSchedule taint on every node that isn't disktype=ssd, with no tolerations added anywhere

Node affinity lets you constrain which nodes a pod CAN be scheduled on based on node labels, which is exactly the "prefer or require these nodes" use case. Taints work in the opposite direction: they repel pods away from nodes unless the pod has a matching toleration, so tainting every non-SSD node would technically work but is far more invasive than just labeling the SSD nodes and using affinity. A PodDisruptionBudget only limits voluntary disruptions during maintenance and has nothing to do with initial scheduling.

medium

5. What is the purpose of a Kubernetes Ingress?

Storing secrets like API keys
Routing external HTTP/HTTPS traffic to internal Services based on rules like hostname or pathCorrect
Managing internal Pod-to-Pod communication only
Assigning IP addresses to Nodes

Pod-to-Pod traffic and Node IP assignment are handled elsewhere, and secrets have their own dedicated object entirely. An Ingress sits at the cluster's edge and routes incoming external HTTP/HTTPS traffic to the right internal Service based on rules you define, like which hostname or URL path was requested, something a plain Service can't do on its own.

hard

6. An Ingress specifies tls with a secretName pointing at a valid Let's Encrypt certificate, but browsers still show a self-signed certificate warning. What's the likely cause?

The referenced TLS Secret doesn't exist in the same namespace as the Ingress, so the controller falls back to its own default self-signed certCorrect
The Service behind the Ingress must also declare its own TLS config
Let's Encrypt certificates aren't supported by Ingress resources
The Ingress is missing an annotation to enable HTTPS entirely

TLS Secrets referenced by an Ingress must live in the same namespace as the Ingress itself. If the Secret isn't found there, most controllers silently serve their built-in default certificate instead of erroring.

easy

7. What is the smallest deployable unit in Kubernetes?

Node
Cluster
Container
PodCorrect

A Node is a machine, and a Cluster is a group of Nodes, both much bigger units than what gets deployed. A Container is close, but Kubernetes doesn't actually deploy bare containers, it always wraps one or more containers together in a Pod, making the Pod the smallest thing Kubernetes actually schedules and manages.

medium

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

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

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

9. Two separate NetworkPolicy resources both select the same pod: one allows ingress from namespace A, the other allows ingress from namespace B. What's the resulting effective policy for that pod?

Only the most recently applied policy takes effect
Ingress is allowed from both namespace A and namespace B - multiple policies selecting the same pod are additiveCorrect
Ingress is allowed only from namespace A, since policies are evaluated in creation order
Ingress is blocked from both, since the two policies conflict

When multiple NetworkPolicy resources select the same pod, their rules are combined as a union, not an intersection. A pod ends up allowing everything any applicable policy permits.

easy

10. What does a Kubernetes Service primarily provide?

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

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.

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.