DevOps Engineer Interview Prep: Questions and a Mock Test
DevOps interviews have a wide surface and a shallow trap: it is easy to sound fluent by naming tools, and interviewers have adapted by asking what the tool is actually doing. Why does a container isolate anything, what does a liveness probe do that a readiness probe does not, what breaks when two people apply infrastructure code at the same time. This page covers the areas that get tested, the details that separate practitioners from tool users, and ends with a graded mock across six of them.
How the process is structured
| Round | Length | What it tests |
|---|---|---|
| 1.Containers and orchestration[1] | Not published | What a container actually is, image layering and build hygiene, and Kubernetes objects in practice. Probes come up constantly, including the documented warning that "incorrect implementation of liveness probes can lead to cascading failures". |
| 2.CI/CD and delivery[2] | Not published | Designing a pipeline and defending it: reproducible builds, ephemeral runners, build-once-promote-many, test strategy and where secrets live. DORA's delivery metrics are the usual shared vocabulary, and the guidance warns against treating any one of them as a standalone target. |
| 3.Infrastructure as code[3] | Not published | State and its locking, drift between code and reality, module structure and blast radius, and reading a plan carefully enough to notice a change that forces resource replacement. |
| 4.Troubleshooting and on-call[1] | Not published | A live scenario: a pod that will not start, a deploy that half-succeeded, a node under memory pressure. Assessed on a systematic method and on whether you mitigate before diagnosing. |
Bracketed markers point to the dated sources at the end of this article. Loops change; check the retrieval dates before relying on a round count.
Containers are processes, not small machines
The most common conceptual gap in a DevOps interview is treating a container as a lightweight virtual machine. It is not one, and the difference determines several correct answers.
A container is an ordinary process on the host kernel, constrained by two mechanisms. Namespaces control what the process can see: its own process tree, network interfaces, mount table, hostname and user IDs. Control groups control what it can use: CPU shares, memory limits, I/O. There is no second kernel and no hypervisor boundary, which is why a kernel vulnerability is a container escape and why running as root inside a container is a real risk when user namespaces are not in play.
Images are the other half. A layered filesystem means each instruction in a build produces a layer, layers are content addressed and cached, and only the topmost layer is writable at runtime. That explains a set of practical answers: ordering instructions so the least frequently changed come first maximises cache reuse, deleting a file in a later layer does not reclaim its space or remove it from the image, and secrets baked into an early layer remain retrievable however carefully they are deleted later. Multi-stage builds exist so the toolchain used to compile something never ships in the artefact.
A tag is a mutable pointer, so pinning by digest rather than by tag is what makes a deployment reproducible.
Kubernetes: probes and resources, precisely
Two areas produce most Kubernetes interview questions because they are so often misconfigured in the wild.
Probes come first. The documentation is explicit about the division of labour. "Liveness probes determine when to restart a container. For example, liveness probes could catch a deadlock, where an application is running, but unable to make progress." "Readiness probes determine when a container is ready to accept traffic." And when they fail, different things happen: a failed liveness probe means "the kubelet restarts that container", while a failed readiness probe means "the EndpointSlice controller removes the Pod's IP address from the EndpointSlices of all Services that match the Pod". One kills, the other steers traffic.
The documented warning is worth quoting in an interview because it shows you have seen this go wrong: "Incorrect implementation of liveness probes can lead to cascading failures. This results in restarting of container under high load; failed client requests as your application became less scalable; and increased workload on remaining pods due to some failed pods." A liveness probe that fails because a dependency is slow will restart every pod during a dependency outage, converting a degradation into an outage. Slow starts belong to the startup probe, which suspends the other two until the application has initialised.
Resources are the second area. A request is what the scheduler uses to place the pod; a limit is what the runtime enforces. Exceeding a memory limit gets the container killed, while exceeding a CPU limit throttles it, and that asymmetry is why CPU limits are contentious and memory limits are not.
Pipelines, and the metrics conversation
CI/CD rounds ask you to design a pipeline and then defend its properties. The properties that matter are speed, reliability and reversibility.
A build should be reproducible, which means pinned dependencies and no reliance on ambient state on the runner. Runners should be ephemeral so one job cannot contaminate the next. Artefacts should be built once and promoted through environments rather than rebuilt per environment, because rebuilding means the thing you tested is not the thing you shipped.
On measurement, DORA's current guidance is worth being current about, because a lot of preparation material is not. The guide now presents five metrics rather than four: change lead time, deployment frequency, failed deployment recovery time, change fail rate, and deployment rework rate. Note the renaming: mean time to restore has become failed deployment recovery time, and deployment rework rate is an addition.
The guidance about how to use them is the part that separates a thoughtful answer from a recited one. The metrics are meant to be read as a set, and treating one as a standalone target "encourages gaming the system". It also warns against comparing across teams and applications with different contexts, and directs attention to a team's own improvement over time. A candidate who proposes putting deployment frequency on an individual performance review has answered the wrong question.
Infrastructure as code, and the state problem
Infrastructure as code questions almost always converge on state, because that is where the real operational pain lives.
Declarative tools keep a state file mapping the resources they manage to real infrastructure. That file is how the tool knows the difference between creating something new and modifying something existing, which is why it must be shared, must be locked during an apply, and is a sensitive artefact in its own right, since it frequently contains resource attributes including secrets. Two engineers applying concurrently without locking is the classic way to produce a state file that no longer describes reality.
Drift is the companion topic: someone changes something in a console, the code no longer matches, and the next apply either reverts their change or fails. The mature answers are detecting drift on a schedule, restricting console write access in environments that are managed by code, and importing anything created by hand rather than leaving it unmanaged.
Expect a question about blast radius. Splitting state by environment and by blast radius means an error in one component cannot destroy another, and it keeps plan times tolerable. Expect also a question about deletion: knowing which changes force replacement of a resource rather than an in-place update, and reading a plan carefully enough to notice, is the difference between a routine change and an outage.
Secrets belong in a secret manager, injected at deploy time, not in the repository and not in the state file if it can be avoided.
Shipping safely, and being able to undo it
The final theme is reversibility, and it is where behavioural and technical questions meet.
Rolling updates replace instances gradually and are the default in most orchestrators. Blue-green keeps two full environments and switches traffic, which makes rollback instant at the cost of running two of everything. Canary exposes a small share of traffic and, done properly, includes the analysis that decides whether to proceed, since a canary nobody evaluates is just a slow rollout.
Feature flags are the important separation: deploying code and releasing behaviour become different events, so a bad feature can be turned off without a deploy. The cost is flag debt, and a good answer includes removing flags once a decision is made.
The hardest part of reversibility is data. A schema change that drops or renames a column cannot be undone by redeploying the previous binary, because the old code no longer matches the database. The expand-and-contract pattern is the standard answer: add the new shape, write to both, migrate readers, and only remove the old shape once no deployable version depends on it. Backwards compatibility between adjacent versions is the invariant that makes rolling deploys and rollbacks possible at all.
Twelve-factor's disposability factor, "maximize robustness with fast startup and graceful shutdown", is the underlying property: instances that start quickly and drain connections cleanly are what make all of the above routine rather than risky.
What they actually ask
1.A pod is in CrashLoopBackOff. Walk me through your diagnosis.
What a strong answer coversStrong answers are systematic rather than a list of commands. Start with the pod description to see events and the last termination reason, which immediately separates image pull failures, scheduling failures and application crashes. Check the previous container's logs rather than the current ones, since the current container may have only just started. Then partition the causes: exit code 1 with application logs points at configuration, a missing secret or an unreachable dependency; exit code 137 points at an out-of-memory kill against the container's memory limit; instant restarts with no logs point at a bad command or entrypoint. A specific strong answer mentions that an aggressive liveness probe with too short an initial delay produces the same symptom for a perfectly healthy application that simply starts slowly, which is what startup probes exist to fix.
2.Design a CI/CD pipeline for a service deployed to Kubernetes.
What a strong answer coversExpected: stages from commit to production with a clear promotion model. Build once, tag by digest, promote the same artefact through environments rather than rebuilding. Fast feedback first, so lint and unit tests run before slower integration tests. Ephemeral runners, pinned dependencies, and no long-lived cloud credentials, using short-lived identity federation instead. Then deployment: rolling or canary, with automated verification, and a rollback path that is exercised rather than assumed. Strong answers name what gates production, who can override the gate, and how database migrations are sequenced relative to the deploy, since that is where the reversibility of the whole pipeline is usually lost.
3.Two engineers run an infrastructure apply at the same time. What happens, and how do you prevent it?
What a strong answer coversThe failure is a corrupted or stale state file, where the recorded state no longer matches reality, producing spurious plans to recreate or destroy resources. Prevention is state locking, which most remote backends provide, so the second apply waits or fails rather than interleaving. Strong answers go further: applies should run in a pipeline rather than from laptops, so there is one path with one identity and an audit trail; state should be split by environment and blast radius so a lock on one component does not block everyone; and state should be versioned so a bad write can be rolled back. Mentioning that state files often contain sensitive attributes, and therefore need encryption and restricted access, is a good extra.
4.A deployment is halfway through a rolling update and the new version is failing. What do you do?
What a strong answer coversStop the rollout first so no further old pods are replaced, then roll back to the previous revision; both are single commands and the instinct to reach for them before investigating is what is being tested. Strong answers ask whether the rollout is actually progressing or stuck, because a properly configured readiness probe should have halted it automatically by refusing to mark new pods ready, and a rollout that sailed through with broken pods is itself a finding about the probe. Then the harder question: whether anything irreversible has already happened, particularly a database migration, since a rollback of code against a migrated schema can be worse than going forward. The post-incident half is what the canary or the staging environment failed to catch and why.
5.How would you manage secrets for an application running in Kubernetes?
What a strong answer coversThe expected starting point is that a Kubernetes Secret is base64 encoded, not encrypted, and is stored in etcd, so encryption at rest and restricted RBAC are prerequisites rather than extras. From there: an external secret manager as the source of truth, synced in or mounted through a driver, so rotation happens in one place and secrets are not committed to a repository. Strong answers prefer short-lived credentials issued through workload identity over long-lived static ones, since the best secret is the one that expires on its own. They also cover the operational details, how an application picks up a rotated secret without a restart, and why environment variables are a weaker delivery mechanism than mounted files because they are visible in process listings and often captured in crash dumps.
6.Your team deploys once a month and each deploy is stressful. How would you change that?
What a strong answer coversThe strong answer identifies the loop rather than blaming cadence: deploys are stressful because they are large, and they are large because they are infrequent. Reducing batch size is the intervention, and everything else supports it. Concretely: automated tests that make a small change verifiable quickly, trunk-based development with feature flags so incomplete work can ship dark, a pipeline that promotes one artefact, and a rollback path that has been rehearsed. Measurement should follow the DORA framing, tracking change lead time and change fail rate as a set and looking at the team's own trend, while explicitly avoiding turning deployment frequency into a target, since the guidance warns that isolating a metric as a target encourages gaming.
Three sample questions, answered
These three show the level the mock is pitched at, with the answer and the reasoning in the open. The graded paper keeps its answer key server-side.
- Restarts the container immediately
- Removes the Pod's IP from the EndpointSlices of matching Services, so it stops receiving traffic
- Reschedules the Pod onto a different node
- Marks the whole Deployment as failed and rolls it back
Why: Readiness controls traffic, not lifecycle. When it fails, "the EndpointSlice controller removes the Pod's IP address from the EndpointSlices of all Services that match the Pod", so the pod stays running and stops being sent requests. Restarting the container is what a failed liveness probe causes.
- Because layers are immutable, so the file still exists in the earlier layer that added it
- Because the build cache retains a copy for later builds
- Because deletion only applies at container runtime, not build time
- Because the registry recompresses layers on push
Why: Each instruction produces an immutable layer, and a deletion in a later layer only records a whiteout entry hiding the file. The bytes remain in the earlier layer and can be extracted from the image, which is why a secret written and then deleted during a build is still exposed. Multi-stage builds, or not adding the file at all, are the real fixes.
- Both are enforced identically; request is simply the older name
- A request is enforced at runtime, a limit is advisory
- A request applies to CPU only, a limit applies to memory only
- A request is what the scheduler uses to place the pod, a limit is what the runtime enforces
Why: Requests are a scheduling input: the scheduler finds a node with that much capacity uncommitted. Limits are enforcement: exceeding a memory limit terminates the container, while exceeding a CPU limit throttles it. Setting requests too low leads to overcommitted nodes and eviction under pressure; setting them too high wastes capacity.
An 18-question knowledge check
This is a knowledge check, not a simulation. The real loop happens on a whiteboard, in an editor, and in conversation. What this paper does measure is the underlying knowledge those rounds draw on: each question is tagged with a topic, grading happens per topic, and a weak topic points you at the course that fixes it.
- 1.What actually provides isolation between two containers on the same host?Containers and image builds
- 2.Why should a Dockerfile copy dependency manifests and install dependencies before copying application source?Containers and image builds
- 3.Why is deploying by mutable tag, such as :latest, considered unsafe?Containers and image builds
- 4.A liveness probe calls an endpoint that checks the database connection. The database has a slow period. What happens?Kubernetes probes and resources
- 5.What problem does a startup probe solve?Kubernetes probes and resources
- 6.A container is killed with exit code 137. What is the most likely cause?Kubernetes probes and resources
- 7.Which of these is NOT one of the metrics in DORA's current guidance?CI/CD and delivery metrics
- 8.Why should an artefact be built once and promoted between environments rather than rebuilt per environment?CI/CD and delivery metrics
- 9.Why are ephemeral CI runners preferred over long-lived ones?CI/CD and delivery metrics
- 10.Why must infrastructure state be locked during an apply?Infrastructure as code and state
- 11.Someone changes a security group by hand in the cloud console. What is the consequence for the managed code?Infrastructure as code and state
- 12.Why split infrastructure state into several smaller states rather than one large one?Infrastructure as code and state
- 13.Which set of signals is most appropriate for alerting a human on a user-facing service?Monitoring, logging and tracing
- 14.Why are structured logs preferred over free-text logs in a distributed system?Monitoring, logging and tracing
- 15.A dashboard shows request rate, errors and latency but the team still cannot tell why a specific slow request was slow. What is missing?Monitoring, logging and tracing
- 16.What makes blue-green deployment attractive compared with a rolling update?Rollout safety and rollback
- 17.Which database change cannot be made safe by rolling back the application?Rollout safety and rollback
- 18.What distinguishes a genuine canary release from simply deploying slowly?Rollout safety and rollback
Sources
Hiring loops change. Every claim above carries a retrieval date so you can judge how current it is.
- [1]Kubernetes Documentation, Liveness, Readiness, and Startup Probes · retrieved 2026-08-13
- [2]DORA, Software delivery metrics: the four keys · retrieved 2026-08-13
- [3]The Twelve-Factor App · retrieved 2026-08-13
Refresh your memory
Free learning paths covering the ground this loop tests, whatever your score. Each one ends with a shareable certificate.
- ProgrammingContainers From First Principles
There is no container object in the Linux kernel and no container system call. A container is an ordinary process with several isolation features switched on, all of which predate the technology by years. So the thing that actually changed practice was not the kernel: it was an image format that is immutable, content-addressed and shippable, built on the same idea as Git's object store. This path covers the primitives, the format and its consequences, where data and traffic have to go, and the honest answer on how much the isolation is worth.
4 lessons - ProgrammingKubernetes: Orchestration as a Set of Control Loops
Kubernetes looks like a pile of object types until you notice it is one idea repeated. Store a description of the desired state, and run loops that compare it to reality and act on the difference. Because those loops read the current state rather than react to events, missed and duplicated messages are harmless and an interrupted controller simply resumes. This path builds the loop, shows every object as a controller joined by label matching, covers the two resource numbers that drive most cost and latency bugs, and ends with the failures the design itself creates.
4 lessons - ProgrammingDeployment Strategies: Shipping Without Breaking Things
A deploy replaces a working system with a different one while people are using it. This path covers how teams make that routine: the four strategies as answers to how many users meet a bad version, canary releases as controlled experiments, feature flags separating deploy from release, and the compatibility discipline that decides whether the rollback you are counting on actually works.
4 lessons - ProgrammingObservability: Knowing Why Production Is Slow
Monitoring answers the questions you wrote down in advance; production fails in ways you did not. This path builds observability from its raw materials: the three telemetry signals and their very different bills, the percentile and cardinality arithmetic that decides what your data can honestly say, tracing and the craft of throwing spans away, and the SLO machinery that turns reliability into a number a team can actually spend.
4 lessons - ProgrammingTesting Strategy: What Is Worth Testing
Tests are a purchase, not a virtue: you spend writing time, run time and maintenance time to buy confidence about specific breakages. This path works out how to spend that budget. What each level of test can and cannot catch, how test doubles buy speed by trading away fidelity, how property-based testing finds the inputs you would never have imagined, and why flakiness destroys a suite faster than any missing test.
4 lessons

