DevOps interview questions
Reviewed by Mark Dickie · Last updated
DevOps is a set of practices that combine software development and IT operations to shorten the delivery cycle and improve reliability. For interviews, you should be solid on CI/CD pipelines, infrastructure as code, container orchestration (especially Kubernetes), monitoring and observability, cloud deployment models, and incident response. Expect questions that test both tool-specific knowledge (Terraform, Jenkins, Docker, Prometheus) and the reasoning behind when to apply each one.
| Topic Area | What comes up in interviews |
|---|---|
| CI/CD | Pipeline stages, branching strategies, rollback strategies, build vs. deploy separation |
| Containers & Orchestration | Dockerfile best practices, Kubernetes pods/services/deployments, health checks, resource limits |
| Infrastructure as Code | Terraform state management, module design, drift detection, immutable infrastructure |
| Monitoring & Observability | Metrics vs. logs vs. traces, SLO/SLI definitions, alerting thresholds, distributed tracing |
| Cloud & Networking | VPC design, load balancing, autoscaling groups, IAM least privilege, cost optimization |
| Security & Compliance | Secret management, image scanning, supply chain security, policy-as-code |
How should I prepare for a DevOps interview?
- Build at least one end-to-end pipeline from scratch — commit triggers a build, test, scan, and deploy to a cloud environment.
- Get hands-on with Kubernetes beyond the basics: write a Deployment with liveness and readiness probes, configure a HorizontalPodAutoscaler, and understand how services route traffic.
- Practice writing Terraform modules and managing state remotely with locking.
- Set up monitoring with Prometheus and Grafana, then define an SLO and wire an alert to it.
- Review common failure scenarios — a deploy breaks production, a pod keeps crashing, a pipeline is flaky — and talk through your debugging steps out loud.
What does a DevOps interview typically cover?
Most DevOps interviews split into three parts. The first is a conceptual round where you explain principles: why continuous integration matters, what immutable infrastructure means, how blue-green deploys differ from canary releases. The second is a practical or hands-on round where you might debug a broken pipeline, write a Dockerfile, or fix a Kubernetes manifest. The third often touches system design — designing a scalable, observable deployment architecture for a given workload. Strong candidates connect tool choices back to business outcomes: faster recovery, fewer outages, shorter feedback loops.
The quiz below pulls from real interview questions across all of these areas. Work through them to find gaps before the real thing.
Key facts
- Tarmac has 93 DevOps interview questions on this topic, 10 of them on this page, at difficulty 3–4 of 5.
- Tarmac last reviewed these DevOps interview questions on 23 August 2026.
At a glance
| Questions | 10 shown · 93 in the bank |
|---|---|
| Difficulty | 3–4 of 5 |
| Formats | Multiple choice, True / false, Code output, Short answer, Ordering, Fill in the blank, Multiple answer, Find the bug, Flashcard, Design exercise |
What you'll review
- canary release
- feature flags
- config management
- postmortems
- incident response
- declarative vs imperative
- error budgets
- idempotency
- gitops
- deployment gates
Practice questions
DevOps/release-strategies/canary-release
Your team wants to ship a risky checkout rewrite to a large user base and limit the blast radius if it misbehaves under real traffic. Which release strategy best fits, and why?#
Options
Show answer
Canary releasing fits best. You route a small percentage of live traffic to the new version, compare its error rate, latency, and business metrics against the stable version, and ramp up only if it holds — so a regression affects a fraction of users and rolls back by shifting traffic away. Blue-green gives instant cutover and rollback but sends the full load to the new version at once, so a load-sensitive bug hits everyone. Rolling updates replace instances gradually but offer no metric-gated traffic split.
Canary releasing exists precisely for this scenario: you expose the new version to a small slice of real traffic (say 1–5%), compare its error rate, latency, and business metrics against the stable version, and only ramp up if it holds. A regression is therefore detected while it harms a fraction of users, and you can roll back by shifting that slice back. Blue-green (b) is excellent for instant cutover and instant rollback, but at the moment of cutover the new version takes the entire load, so a load-sensitive regression hits everyone — it minimizes downtime, not blast radius under live traffic. Rolling updates (c) do gradually replace instances, but the claim is wrong: as soon as a new instance is in the pool it serves real traffic, and rolling gives you no metric-gated traffic split. (d) is false — the whole point of these strategies is progressive exposure without a downtime window.
DevOps/release-strategies/feature-flags
Feature flags let you decouple deployment from release: code for an unfinished or risky feature can be merged and deployed to production while staying dark, then turned on for users independently of any deploy.#
Options
Show answer
True. Deploying ships code to servers; releasing exposes behaviour to users. A feature flag is a runtime switch around the new code path, so you can merge and deploy an unfinished or risky feature while it stays dark in production, then enable it for users on your own schedule — internal users, a canary cohort, or everyone — and kill it instantly without a rollback deploy. This makes trunk-based development and continuous deployment practical, but stale flags accumulate as debt and should be removed after full rollout.
True, and this decoupling is the main strategic reason teams adopt feature flags. Deploying ships code to the servers; releasing exposes behaviour to users. A flag is a runtime switch wrapping the new code path, so you can merge to trunk and deploy continuously — keeping branches short-lived — while the feature stays off ('dark') in production. You then enable it on your own schedule: for internal users first, for a 5% canary cohort, or for everyone, and you can kill it instantly without a rollback deploy if it misbehaves. This is what makes trunk-based development and continuous deployment practical for large, in-progress features, and it underpins experimentation (A/B tests) and progressive delivery. The cost is real and worth naming: flags are conditional logic that accumulate, so undisciplined teams drown in stale flag debt — short-lived flags should be removed once a feature is fully rolled out.
DevOps/config-secrets/config-management
A twelve-factor app reads config from the environment, falling back to a checked-in default. The container is started with DATABASE_URL set in its environment to postgres://prod-db/app, while the repo's committed .env.defaults file sets DATABASE_URL=postgres://localhost/app. The startup code is below. Which database does the app connect to, and why?#
// load committed defaults first, then let the real environment win
const defaults = parseEnvFile('.env.defaults');
const config = { ...defaults, ...process.env };
connect(config.DATABASE_URL);Options
Show answer
postgres://prod-db/app — the spread merges process.env last, so the real environment variable overrides the committed default, which is the twelve-factor pattern
Object spread merges left to right, and on a key collision the last spread wins. { ...defaults, ...process.env } therefore lets any variable present in the real environment override the committed default — so DATABASE_URL resolves to postgres://prod-db/app. This is the twelve-factor 'store config in the environment' principle in miniature: the same artifact ships everywhere, and per-environment values (prod DB, secrets, feature toggles) come from the environment at runtime, while a committed defaults file gives a sane local-dev fallback that never contains real secrets. Option b inverts the precedence (committed defaults are the fallback, not the override). Option c is wrong — duplicate keys across the two sources is the normal, intended case, not an error. Option d is false: process.env is a readable map here and nothing about reading it from a file changes merge order. The interview point is that environment beats baked-in defaults, which is what keeps one build deployable to every environment.
DevOps/reliability/postmortems
What makes a postmortem 'blameless', and why does blamelessness make an organization more reliable rather than less accountable?#
Show answer
A blameless postmortem reviews an incident by focusing on the systems, processes, and contributing causes that let the failure happen, never on punishing the individual who happened to trigger it. It assumes people act reasonably given the information, tools, and pressures they had at the time, so the question is 'what about the system made this mistake easy and its consequences severe?' rather than 'who screwed up?'. The payoff is psychological safety: when engineers know they won't be blamed, they report incidents and near-misses honestly and in full detail, which surfaces the real root and contributing causes instead of a sanitized story. That honest signal is what lets the team fix the system — add guardrails, automation, better alerts, safer defaults — and file durable, tracked action items that prevent recurrence. Blame does the opposite: it drives reporting underground, so the same latent failure stays hidden and recurs. Blamelessness is about accountability to fixing the system, not the absence of accountability.
Blamelessness shifts the postmortem's question from 'who caused this?' to 'what about our systems and processes made this failure possible and its blast radius large?'. It rests on the assumption that people generally do their best with the context they had, so a human error is treated as a symptom of a system that allowed it (a missing guardrail, a confusing UI, an alert that fired too late), not as the cause to be punished. The reliability payoff is mechanistic, not soft: blame creates fear, fear suppresses honest reporting, and suppressed reports hide the real contributing causes — so the latent fault recurs. Remove blame and you get psychological safety, which produces candid, detailed accounts that reveal the true systemic gaps, which in turn become concrete, tracked action items (automation, safer defaults, better detection) that actually prevent recurrence. A strong answer stresses systems-over-individuals, psychological safety enabling honest reporting, and that accountability is redirected to fixing the system, not removed.
DevOps/reliability/incident-response
Order the phases of a well-run production incident, from the moment something breaks to the work that prevents a recurrence.#
Put these in order
Show answer
A well-run incident moves through five phases in order. Detect: an alert tied to an SLI, or a user report, signals the service is out of bounds. Triage and declare: assess severity, declare an incident, and assign an incident commander. Mitigate: restore service by the fastest safe lever — roll back, fail over, or flip a flag — before chasing root cause. Resolve: confirm the SLI is healthy and stand the incident down. Postmortem: run a blameless review, find contributing causes, and file durable action items so it can't recur.
Incident response follows a deliberate order. First you must detect the problem — ideally an automated alert wired to an SLI breach, not a customer tweet. Then triage and declare: size up impact and severity, formally declare an incident so the right people engage, and name an incident commander to coordinate (separating coordination from hands-on debugging). Next comes the phase juniors most often get wrong: mitigate before you diagnose. The first duty is to stop user pain by the fastest safe lever — roll back the last deploy, fail over to a healthy region, or disable the feature flag — even if you don't yet understand the root cause. Only once the bleeding stops do you resolve: verify the SLI is back in bounds and stand the incident down. Finally, after the adrenaline fades, the postmortem extracts lasting value through a blameless review that identifies contributing causes and produces tracked action items so the same failure can't recur. The two classic mistakes are chasing root cause before mitigating, and skipping the postmortem so nothing is learned.
DevOps/iac/declarative-vs-imperative
In a _____ approach to infrastructure as code, you describe the desired end state and let the tool compute the steps to reach it; in an _____ approach, you write the explicit sequence of commands that change the system step by step.#
Show answer
In a declarative approach to infrastructure as code, you describe the desired end state and let the tool compute the steps to reach it; in an imperative approach, you write the explicit sequence of commands that change the system step by step.
This is the foundational IaC distinction. A declarative approach states what you want — 'three web servers behind a load balancer with this config' — and the tool diffs that desired state against reality and figures out how to converge (create what's missing, change what differs, leave correct things alone). Because the spec is the end state, re-applying it is naturally idempotent and the tool can detect and correct drift. An imperative (or procedural) approach states how: an ordered list of commands ('create server, then install package, then edit file') that you must make safe to re-run yourself, since the script doesn't inherently know the current state. Most modern IaC and orchestration tools are declarative for exactly these reasons — idempotency, drift detection, and reproducibility — while shell-style provisioning scripts are imperative. Knowing which model a tool uses tells you how it will behave on a second run.
DevOps/reliability/error-budgets
An SRE team runs a service with a 99.9% availability SLO. Which statements about the resulting error budget are correct? Select all that apply.#
Options
Pick every one that applies.
Show answer
The error budget is the allowed unreliability — 100% minus the SLO, so a 99.9% target permits 0.1% failure over the window. While budget remains, the team can spend it on shipping features and deploy risk; once it is exhausted, the policy freezes risky releases and prioritizes reliability work. Its value is turning the velocity-versus-stability debate into a shared, data-driven number. Spending zero budget is not the goal — it signals the SLO is too loose or reliability is over-invested.
An error budget is derived directly from the SLO: it is 100% minus the objective, so a 99.9% target permits 0.1% unreliability over the measurement window (a). That budget is a currency. While it is unspent the team has room to move fast — deploy often, take calculated risk — and when it runs out, the agreed error-budget policy kicks in: stop shipping risky changes and redirect effort to reliability until the service earns budget back (b). Its real organizational value is making the eternal velocity-vs-stability tension an objective, shared number instead of a turf war between developers who want to ship and ops who want stability (c). Option d is the classic trap: a budget that is never spent means your SLO is too loose (or you're over-investing in reliability users don't perceive) — you're leaving velocity on the table, so consistently spending zero is a signal to recalibrate, not a victory. Option e is wrong: the budget is computed from the SLO/SLI math, not by tallying incident counts.
DevOps/iac/idempotency
This provisioning script is run by the configuration-management tool on every converge to ensure an 'app' user and its config line exist. It works the first time, but re-running it on an already-provisioned host fails or corrupts the file. Why is it not idempotent, and what is the fix?#
#!/usr/bin/env bash
set -euo pipefail
# create the service account
useradd app
# ensure the app reads from the shared config dir
echo 'CONFIG_DIR=/etc/app' >> /etc/app.envOptions
Show answer
Both operations assume a clean host: useradd app errors (and aborts under set -e) when the user already exists, and the >> append adds a duplicate CONFIG_DIR line every run — the script must check-then-act (e.g. id app || useradd app) and write the line only if absent, so repeated runs converge to the same state
Idempotency means running the operation any number of times leaves the system in the same end state as running it once — the contract a convergent config tool depends on, since it re-applies on every run. This script breaks that contract twice. useradd app is a create that fails with a non-zero exit when the user already exists; under set -e that aborts the whole converge on the second run. And echo ... >> /etc/app.env appends, so each run adds another identical CONFIG_DIR=/etc/app line, growing the file and potentially changing how the app parses it. The fix is to make every step check-then-act so it's safe to repeat: guard the user creation (id app >/dev/null 2>&1 || useradd app) and add the config line only if it isn't already present (grep -qxF 'CONFIG_DIR=/etc/app' /etc/app.env || echo 'CONFIG_DIR=/etc/app' >> /etc/app.env). Option b is backwards — set -e correctly surfaces the latent failure; deleting it just hides a broken converge. Option c fixes only half the problem and wrongly calls the append idempotent. Option d is plainly false on both counts.
DevOps/delivery-flow/gitops
What is GitOps, and how does its reconciliation model differ from a traditional push-based CI/CD deploy?#
Show answer
GitOps is an operating model where a git repository is the single source of truth for the desired state of your system — typically declarative infrastructure and application manifests. A controller (an agent running in the target environment) continuously reconciles the live state toward what git declares: it watches the repo, and on any divergence it pulls the desired state and converges the cluster to match. So you change production by committing/merging to the repo, not by running a deploy command against it. This differs from traditional push-based CI/CD, where a pipeline holds credentials to the environment and pushes changes outward at the end of a build. The pull/reconcile model has concrete benefits: git history is a complete, auditable, revertable record of every change (rollback = git revert); drift is automatically detected and corrected because the controller constantly compares actual vs declared; and the environment's credentials stay inside it rather than being handed to an external CI system. The trade-off is that you must keep the repo and reconciler healthy, and it fits declarative targets (like Kubernetes) far better than imperative ones.
The interview point is the pull-based reconciliation loop versus push-based deployment. In GitOps, declarative manifests in git define desired state and an in-cluster controller continuously diffs live state against the repo and converges to it — making git the audit log, the rollback mechanism (revert the commit), and the drift-correction engine all at once. Traditional CI/CD pushes: the pipeline ends by pushing artifacts/changes into the environment using credentials the external system holds. Strong answers name (1) git as single source of truth, (2) a controller that reconciles continuously, (3) the security win of pull-from-inside vs handing prod creds to CI, and (4) automatic drift detection. A common follow-up is the limitation: GitOps assumes a declarative target and a healthy reconciler, so it maps cleanly onto Kubernetes but awkwardly onto imperative provisioning.
DevOps/ci-cd-practice/deployment-gates
You are the platform lead for a large e-commerce platform running 40+ microservices on Kubernetes. Each service team owns its own CI/CD pipeline and can deploy independently. The organization wants to introduce deployment gates so that no service reaches production without passing automated checks, but without re-centralizing release approval or creating a single bottleneck team.#
Show answer
Gate architecture: Each pipeline has five stages with both team-configurable and org-mandated gates.
- Build stage: Org-mandated gate — container image build + SAST scan + dependency vulnerability scan (fail on Critical CVEs). Team gate — unit tests with ≥80% coverage delta threshold.
- Integration stage: Org-mandated gate — consumer-driven contract tests against the service's published API spec (Pact or equivalent). The gate fails if any registered consumer's contract is broken. Team gate — integration tests against a shared ephemeral environment.
- Staging stage: Org-mandated gate — load test reaching 2× expected peak QPS; p99 latency must stay within SLO. Team gate — smoke tests and synthetic transaction checks.
- Pre-prod (canary launch): The service is deployed to 5% of production traffic. Canary gate evaluates error rate (must not exceed baseline + 0.5 percentage points), p99 latency (must not exceed baseline × 1.2), and business KPI delta (e.g., checkout conversion rate must not drop more than 1% relative to control). If any metric breaches its threshold, the gate triggers an automatic rollback to the previous version. Metrics that are informative but not safety-critical (e.g., cache hit rate, memory usage trending up but within limits) trigger a hold-and-notify — deployment pauses at 5%, alerts the team, and waits for manual promotion or rollback.
- Production (progressive rollout): After canary passes, traffic is ramped 25% → 50% → 100% with the same canary gate re-evaluated at each step. A failure at any step rolls back to the last known-good percentage.
Cross-service dependency gating: Every service publishes an OpenAPI/Protobuf spec in a central schema registry. Before a service can deploy to production, the gate runs backward-compatibility checks — if the new spec removes a required field or changes a type in a breaking way, the gate fails unless all downstream consumers have already deployed a compatible version. The dependency graph is maintained by a service catalog; the gate queries it to identify consumers. Consumer-driven contract tests run at the integration stage and must all pass; the gate blocks if any registered consumer's contract is broken by the new version.
Decentralization with enforced baseline: Gates are defined as code in a shared gate-library repository. Each team's pipeline imports a 'base-gate-profile' that contains the org-mandated gates (SAST, CVE scan, contract tests, load test, canary SLO gate). Teams can add team-specific gates on top but the base profile is enforced by a policy controller (OPA/Conftest) that validates every pipeline definition at commit time — if the base gates are missing or disabled, the pipeline config is rejected by the CI system and cannot run. This gives teams autonomy to extend while guaranteeing the safety floor.
This design exercise tests the candidate's ability to architect a multi-layered deployment-gate system that balances safety with team autonomy. A strong answer covers stage-specific gates with concrete pass/fail criteria, canary rollback signals with numeric thresholds, cross-service dependency validation with an explicit block condition, and a policy-enforced baseline that prevents teams from disabling safety gates while still allowing extension. The rubric was corrected so that c1 (stage taxonomy) and c3 (cross-service dependency gating) no longer both credit consumer-driven contract tests: c1's integration-stage example now references integration tests against an ephemeral environment, while c3 exclusively owns contract tests, schema-compatibility checks, and dependency-graph mechanisms, and additionally requires the candidate to specify the exact block condition — making it discriminating against shallow answers that merely name a technique.
Related interview questions
The other 83 questions
This page shows 10. A free account opens the rest and marks your answers, which a page of answers can't do. Miss one and it returns a few days later, then a week after that, until you stop missing it.
Free · the whole bank · 100 graded answers per 30 days · written feedback and job-ad quizzes on the paid plan