DevOps Interview Bank

Questions grouped by topic, each with the shape of a passing answer — not a script to recite. Vague answers fail. Name the actual service, flag, or file.

!!! asked in most interviews — must be cold Unmarked — know it, don't rehearse it Orange rule — the follow-up that catches people out

AWS

Identity, network, cost
A1

Security group vs NACL — when does the difference actually bite you?

SG: stateful, attaches to an ENI, allow rules only. NACL: stateless, subnet-wide, allow and deny, evaluated in rule-number order.

Follow-up: stateless means return traffic needs its own rule — the classic symptom is an outbound request that works while the reply is dropped on an ephemeral port.

A2

Give an EC2 instance read access to one S3 bucket, with no access keys.

IAM role + instance profile. Policy scoped to arn:aws:s3:::bucket and arn:aws:s3:::bucket/* — both ARNs, bucket-level and object-level. Credentials arrive through IMDS and rotate on their own.

Say the words: "no long-lived credentials on disk." That's the point of the question.

A3

What actually makes a subnet public?

A route table entry sending 0.0.0.0/0 to an internet gateway. Not the name, not auto-assign public IP — those are consequences, not causes.

A4

What is a NAT gateway for, and why might you avoid one?

Outbound internet for private subnets. Avoid because it bills hourly and per GB processed; S3 and DynamoDB gateway endpoints are free and remove most of the traffic.

A5

IAM user vs role vs policy, one sentence each.

User: a long-lived identity, usually with keys. Role: assumed, hands out temporary STS credentials. Policy: the JSON document granting permissions, attached to either.

A6

A bill alert fires for $300. Walk me through finding the cause.

Cost Explorer grouped by service, then by usage type to find the line item. Usual suspects: NAT gateway data processing, unattached EBS volumes, idle load balancers, CloudWatch log groups with no retention, cross-AZ transfer.

Close the loop: a budget alert and a tagging policy so the next one is caught at $30, not $300.

A7

An S3 bucket is public and shouldn't be. What do you check?

Block Public Access at account and bucket level, then the bucket policy, then ACLs. IAM Access Analyzer finds the rest; CloudTrail says who changed it and when.

A8

What does an instance profile do?

It's the wrapper that lets EC2 attach an IAM role. You attach the profile; the instance assumes the role inside it.

A9

IMDSv1 vs IMDSv2 — why does anyone care?

v2 requires a PUT to get a session token and honours a hop limit, so a server-side request forgery bug in an app can no longer read the instance's role credentials.

A10

How do you give a private subnet access to an AWS API without internet?

VPC endpoints. Gateway endpoints for S3 and DynamoDB (route-table based, free); interface endpoints via PrivateLink for everything else (an ENI, billed hourly).

Terraform

State, drift, promotion
T1

What's in the state file, and why can't it live in git?

The mapping from resource address to real-world ID, plus attributes and metadata. It holds secrets in plaintext, and git gives you no locking — two people, two branches, one corrupted state.

Follow-up: where does it live instead? Remote backend — S3 with encryption and locking, or Terraform Cloud. Know that S3 now does native locking; DynamoDB was the old way.

T2

Two engineers run apply at the same time. What happens?

Without locking, interleaved writes and a corrupted state — the worst failure mode in Terraform, because the code is fine and reality no longer matches. State locking serialises it.

T3

Someone changed a resource in the console. How do you find out, and how do you fix it?

A plan shows the diff; terraform apply -refresh-only accepts reality into state. Then decide: revert to code, or codify the change. Prevent it by removing write access to the console.

T4

count vs for_each — which, and why?

count is index-keyed, so removing the middle element re-creates everything after it. for_each is key-keyed and stable. Default to for_each; count is for on/off toggles.

T5

How do you promote a change from dev to prod?

Same module, different variable files and separate state per environment. Plan runs on the PR, apply on merge. Prod gets a manual approval gate.

T6

Terraform needs to manage a resource that already exists.

terraform import, or an import block in 1.5+ which is reviewable in the plan and can generate the config for you.

T7

What does terraform plan actually do?

Refreshes state against the provider APIs, diffs desired config against that, and prints the actions. It reads the real world — it isn't a dry run against the file alone.

T8

When is -target acceptable?

Recovering from a partial apply or a broken state. Never as routine workflow — if you need it often, the root module is too big.

T9

Module vs workspace.

Module: reusable code. Workspace: separate state for the same code. Using workspaces for environments is contested — separate directories make the differences explicit.

T10

How do you handle secrets in Terraform?

Don't commit tfvars with secrets. Pull at apply time from SSM Parameter Store, Secrets Manager or Vault.

The honest part: they still land in state in plaintext. That's why the backend is encrypted and access-controlled. Saying this out loud reads as experience.

CI/CD

Pipelines, auth, rollback
C1

Walk me through what happens from git push to running in production.

The big one. Linear narrative: trigger → lint and unit tests → build image → tag with the commit SHA → push to registry → scan → deploy to staging → smoke test → promote to prod → verify. Name the gate at each step and who owns it.

Must be cold. Hesitating here undoes a good interview. Rehearse it aloud until it runs 90 seconds without a pause.

C2

How does your pipeline authenticate to AWS?

OIDC federation — the CI provider presents a signed token, an IAM role trusts that issuer with a condition on the repo and branch, and returns short-lived credentials.

Wrong answer: static access keys in repo secrets. If that's what a past job did, say so and say what you'd change.

C3

Where do secrets live, and who can read them?

Repo or org secrets for CI-only values, a real secret store for runtime. Access is scoped by environment protection rules and reviewers. Secrets are masked in logs but a determined job can still print them — so scope them per environment.

C4

A deploy broke prod. What's your rollback?

Redeploy the previous immutable tag — kubectl rollout undo, a Helm or Argo rollback, whatever the platform is. Seconds, not a rebuild.

Where it gets real: database migrations don't roll back. Answer with expand/contract — additive migrations deployed ahead of the code that uses them.

C5

What runs on a PR vs on merge to main, and why the split?

PR: lint, test, build, terraform plan — everything read-only. Merge: apply and deploy. The split exists because only the second half needs privileged credentials.

C6

Why is :latest a problem in a deployment?

Non-deterministic — two pods on two nodes can run different code. No rollback target, and a manifest that never changes doesn't trigger a new rollout. Pin the SHA or a digest.

C7

Rolling vs blue/green vs canary.

Rolling: cheapest, two versions live at once, so the API must stay compatible. Blue/green: instant cutover and instant rollback, double the infrastructure. Canary: percentage shift with metrics as the gate.

C8

Your pipeline takes 40 minutes. How do you make it faster?

Measure first — find the slow stage. Then: cache dependencies and layers, parallelise independent jobs, run the expensive suite only on merge, use a smaller base image.

GitOps

Argo CD, Flux, reconciliation
G1

What is GitOps, and how is it different from a normal CD pipeline?

Push CD runs kubectl apply from a pipeline that holds cluster credentials. GitOps puts a controller inside the cluster that pulls from git and continuously reconciles. Say: desired state, continuous reconciliation, no credentials leave the cluster.

G2

How do you detect and handle drift?

The controller reports OutOfSync. Self-heal reverts manual changes automatically; detect-only leaves the decision to a human. Start detect-only on an existing cluster.

G3

How do you manage secrets in GitOps?

Never in plaintext in the repo. SOPS with age or KMS, Sealed Secrets, or External Secrets Operator pulling from Vault or AWS Secrets Manager — the repo holds a reference or ciphertext, the cluster resolves it.

This follow-up is near-automatic after G1. Have a named tool ready, not "we'd encrypt them somehow."

G4

Argo CD or Flux?

Both CNCF-graduated. Argo CD: UI, multi-tenancy, wider adoption, heavier. Flux: lighter, git-native, CLI-driven, better on constrained clusters. Answer with the tradeoff, not a favourite.

G5

You inherit a cluster with 15 namespaces of hand-applied resources. How do you onboard it?

Export live state, diff it against the repo, reconcile the gaps in git, then enable sync. Auto-sync with self-heal goes on last.

Turning on self-heal first deletes everything that was never committed. Saying that unprompted is the whole point of the question.

G6

How do you manage many apps or many clusters?

App-of-apps, or ApplicationSet generating Applications from a list, a git directory, or the cluster inventory. One repo change onboards a new environment.

G7

How do you roll back under GitOps?

git revert and let the controller reconcile. The UI rollback is for emergencies — it puts you out of sync with git until you commit the same change.

Kubernetes

Workloads, scheduling, failure modes
K1

A pod is stuck in Pending. Walk me through it.

kubectl describe pod and read the events — the scheduler writes the reason there. Insufficient CPU or memory, a taint with no toleration, a nodeSelector or affinity that matches nothing, or an unbound PVC.

K2

CrashLoopBackOff. Where do you look?

kubectl logs --previous for the run that died, then the exit code. 137 is OOM, 1 is usually application error. Then check probes, and missing ConfigMap or Secret keys.

K3

Requests vs limits.

Requests are what the scheduler reserves; limits are what the kernel enforces. Over a CPU limit you get throttled; over a memory limit you get OOMKilled. They also decide QoS class, which decides eviction order.

Opinion worth having: always set memory limits, be careful with CPU limits — throttling a latency-sensitive service to enforce a number nobody measured is a common self-inflicted outage.

K4

How does traffic actually reach a pod?

Service selector matches pod labels, the endpoint controller keeps the EndpointSlice current, kube-proxy programs iptables or IPVS on every node to DNAT the cluster IP to a pod IP. ClusterIP → NodePort → LoadBalancer is the layering.

K5

Deployment vs StatefulSet vs DaemonSet.

Deployment: interchangeable replicas. StatefulSet: stable identity, ordered rollout, per-pod storage. DaemonSet: one per node, for agents.

K6

Liveness vs readiness vs startup probes.

Liveness restarts the container. Readiness removes it from the service. Startup suppresses the other two while a slow app boots.

The classic outage: a liveness probe that hits a dependency. The dependency blips, every pod fails the probe, the whole deployment restarts itself into a loop. Liveness checks the process, readiness checks the dependencies.

K7

How does a rolling update work, and how do you undo one?

maxSurge and maxUnavailable control the window; a new ReplicaSet scales up as the old scales down. kubectl rollout undo re-points at the previous ReplicaSet, which is why revision history matters.

K8

A node goes NotReady. What's your process?

kubectl describe node and read conditions — MemoryPressure, DiskPressure, PIDPressure. Then on the node: is kubelet running, can it reach the API server, is the disk full, is container runtime alive.

K9

You change a ConfigMap. The pods don't pick it up. Why?

Env vars are injected at start and never change. Mounted volumes update eventually, but the app has to re-read the file. Force it with a checksum annotation on the pod template, or a controller that restarts on change.

K10

Why does etcd need an odd number of members?

Quorum is n/2+1. Three tolerates one failure; four also tolerates only one, so the fourth member adds failure surface and no availability. Losing quorum means the API goes read-only and you're restoring from a snapshot.

Kubernetes security

Policy, isolation, supply chain
S1

How do you stop one compromised pod reaching everything else in the cluster?

Default-deny NetworkPolicy per namespace, both ingress and egress, then allow only what's needed. Pods are flat and fully routable until you do this.

The gotcha everyone hits: default-deny egress also blocks DNS. You must allow UDP and TCP 53 to kube-dns or nothing in the namespace resolves anything.

S2

What's Pod Security Admission?

Namespace labels enforcing privileged, baseline or restricted, in three modes: warn, audit, enforce. Built in since PodSecurityPolicy was removed.

How you roll it out: warn and audit first, read what would have broken, then enforce. Going straight to enforce on a live namespace blocks the next deploy.

S3

Harden a container. What do you set?

runAsNonRoot, a non-zero runAsUser, allowPrivilegeEscalation: false, capabilities.drop: ["ALL"], readOnlyRootFilesystem: true, seccompProfile: RuntimeDefault. No privileged, no hostPath, no host namespaces.

S4

How do you apply least privilege to a workload's API access?

Dedicated ServiceAccount per workload, Role scoped to the verbs and resources it actually uses, automountServiceAccountToken: false everywhere it isn't needed. Verify with kubectl auth can-i --as=system:serviceaccount:ns:name.

S5

Are Kubernetes Secrets encrypted?

Base64 is encoding, not encryption. At rest in etcd they're plaintext unless you configure an EncryptionConfiguration with a KMS provider. Anyone who can read etcd, or the backup, reads every secret.

S6

How do you know what's running in your cluster is what you built?

Pin image digests not tags, scan in CI and fail the build on high severity, restrict pulls to approved registries via admission policy, generate an SBOM, sign images and verify the signature at admission.

S7

Someone deleted a production deployment. How do you find out who?

API server audit log — an audit policy defining which verbs and resources get recorded at which level, plus the flags and a mounted host path for the log. If it wasn't enabled beforehand, you can't answer, which is the lesson.

S8

How would you detect a shell being spawned inside a running container?

Runtime detection — Falco watching syscalls via an eBPF probe, with rules matching process execution inside a container. That's the detect half; container immutability (readOnlyRootFilesystem, no shell in the image) is the prevent half.

S9

A CIS benchmark scan reports 17 failures on your cluster. What do you do?

Verify every finding against ground truth before changing anything. A scanner reports what it can see, and on some distributions it cannot see the control plane at all — k3s and RKE2 run the apiserver, controller-manager and scheduler in a single process, so a flag-based scanner records FAIL where it should record N/A. Separate real gaps from tool limitations, fix the real ones, and record the rest as accepted deviations with the evidence.

The senior signal: remediating blind is how you break a control plane to satisfy a scanner. And the findings that actually matter are usually in the policy layer — no NetworkPolicies, no Pod Security Admission, default ServiceAccounts in use — not in the flags.

Linux & networking

The questions that separate ops from tutorial-followers
L1

A server is at 100% CPU. Your first five commands?

uptime for load against core count, top to find the process, vmstat 1 to split user / system / iowait, pidstat -t for the thread, ss -s if it looks network-bound.

Read the shape, not the number: high iowait isn't a CPU problem, high system time points at syscalls or interrupts, load above cores with idle CPU means blocked on I/O.

L2

Disk is full. Find what's eating it.

df -h, then du -xh --max-depth=1 / walking down. df -i if it's inodes rather than bytes.

When du and df disagree: a deleted file is still held open by a process. lsof +L1 finds it; restarting the process frees the space.

L3

A service won't start. How do you find out why?

systemctl status for the exit code, then journalctl -u <unit> -xe for the actual error. Then the config syntax check, then permissions on whatever it opens.

L4

What happens when you type a URL and press enter?

Open-ended on purpose — they're finding your depth. DNS resolution, TCP handshake, TLS negotiation, HTTP request, response, render. Go one layer deeper than feels necessary and let them stop you.

L5

How do you debug a DNS problem?

dig +short against the resolver, then against an authoritative server to split resolution from caching. Check /etc/resolv.conf and search domains.

In Kubernetes: ndots: 5 means a name with fewer than five dots gets tried against every search domain first — which looks like slow DNS, not broken DNS.

L6

What's listening on this box, and what's it talking to?

ss -tulpn for listeners with PIDs, ss -tp state established for current connections.

L7

A connection hangs instead of failing fast. What does that tell you?

A refused connection means something answered — the port is closed. A hang means packets are being dropped silently: firewall with a DROP rule, security group, or a routing black hole. The difference is the fastest diagnostic in networking.

L8

What does an MTU mismatch look like?

Small requests work, large ones hang. Common with VPN and overlay networks where encapsulation eats header space. Comes up constantly in real clusters.

Observability & incidents

Alerting, on-call, postmortems
O1

How do you know when something is down?

Alert on user-visible symptoms — error rate, latency, request success — not on CPU. Blackbox probes from outside prove the whole path works. Resource metrics explain an incident; they don't detect one.

O2

Your team is drowning in alerts. Fix it.

Only symptoms page a human; causes go to a dashboard or a ticket. Route by severity, inhibit downstream alerts when the upstream one is already firing, and delete anything nobody acted on last quarter.

O3

Metrics, logs and traces — when do you reach for each?

Metrics: is something wrong, cheap and always on. Logs: what exactly happened, for one request. Traces: where the time went across services. RED for services, USE for resources.

O4

Walk me through an incident you handled.

Structure beats drama: how you were alerted, what you checked and in what order, what you ruled out, how you mitigated, what the root cause was, what you changed so it can't recur. Give a time and a number.

Mitigate before diagnose is the senior signal — restore service first, find the cause after. Say it explicitly.

O5

What makes a good postmortem?

Blameless, a timeline, contributing factors rather than one root cause, and action items with owners and dates. A postmortem with no assigned actions is a diary entry.

O6

Why would a Prometheus instance fall over?

Cardinality. A label carrying a user ID, request ID or pod name creates a new time series per value and memory follows. Keep labels bounded and low-cardinality.

O7

What's an SLO, and what's an error budget?

SLO: the target, e.g. 99.9% of requests succeed over 30 days. Error budget: the 0.1% you're allowed to spend. Burn it fast and you freeze releases — it turns reliability into a decision rule instead of an argument.

Behavioural

STAR — situation, action, measurable outcome
B1

Tell me about yourself.

Ninety seconds, arc not history: where you came from, what you've been building, what you're aiming at. It's the only question guaranteed to be asked. Write it, say it out loud, cut it in half.

B2

The hardest problem you've debugged.

Pick one with multiple stacked causes — real systems fail that way, and the story shows how you handle a wrong hypothesis. Include the moment you realised your first theory was wrong and what you did about it.

Know your own numbers. How long, what time, how many users, what the fix was. Vagueness on your own story reads as fiction.

B3

A time you caught a problem before it caused damage.

Shows judgment rather than heroics. Name what you noticed, why it was wrong, and what would have happened.

B4

A time you broke something.

Answer it honestly — a candidate who has never broken anything has never had access. What broke, how you found out, how long to recover, what changed afterwards.

B5

A time you disagreed with a technical decision.

How you made the case, what evidence you brought, and what you did when the decision went the other way. Disagree-and-commit is the answer they want to hear.

B6

How do you work under constraints — no budget, no hardware, no time?

Constraint-driven engineering stories land well because they're concrete. What the limit was, what you traded away, why that trade was right.

B7

How do you use AI tools, and how do you know the output is right?

Increasingly standard, and a trap if you're defensive or evasive. Say what you use it for, and — the part they're actually testing — how you verify: you run it, you read it, you check it against the docs, you own the result.

Questions to ask them

Having none is an answer, and it's a bad one
Q1

How does an infrastructure change get reviewed and deployed here?

Tells you whether there's real process or a person with production credentials and good intentions.

Q2

What does on-call look like, and how often does it actually fire?

The follow-up matters more than the answer: what happened to the last page, and did it produce a fix?

Q3

Does staging actually match production?

Nobody says yes. How they say no tells you how much of your week will be spent on environment drift.

Q4

What's the oldest piece of infrastructure nobody wants to touch?

Every org has one. A team that can name it and laugh has a healthy relationship with its own debt.

Q5

How is this team distributed, and how do decisions get made across time zones?

For remote roles, the real question behind "is this remote-first or remote-tolerated".

Q6

What would you want the person in this role to have done by their first ninety days?

Makes them state the actual expectation. Surprising how often they haven't decided.

Related: CKA cheat cards · CKS cheat cards · AWS & Terraform cheat cards · CI/CD cheat cards