Autocoder

DevOps Interview Questions and Answers

Last updated 2026-11-19

A DevOps interview rarely checks whether you can recite tool names. Interviewers want to see that you understand why a pipeline is shaped the way it is, how you would ship a risky change safely, and what you do when production breaks at night. This page works through 15 questions that come up repeatedly, with answers written the way you would say them aloud, plus the commands and config an interviewer may ask you to sketch on a whiteboard.

The questions move from fundamentals (what DevOps actually changes, CI versus CD) to deployment strategies, GitOps, secrets, observability and incident response. For tool-specific depth, use the dedicated pages on Docker, Kubernetes, Terraform, Jenkins and Ansible linked at the end. For the interview process itself, read how to crack a DevOps interview.

Typical roundsScreening call, technical deep-dive, scenario or troubleshooting round, sometimes a take-home pipeline task
Core areasLinux, networking, Git, CI/CD, containers, cloud, IaC, monitoring
Good to practiseDrawing a pipeline, writing a short YAML or shell script, explaining a past outage

How to answer DevOps questions well

Answer in three beats: the principle, a concrete tool or command, and the trade-off. For example, when asked about blue-green deployment, say what it is, show how a load balancer or Kubernetes Service switches traffic, then mention the cost of running two environments and the database migration problem. Interviewers mark you down for tool lists with no reasoning behind them.

Keep a story ready for each of these: a pipeline you built or improved, a failure you diagnosed, and something you automated. If you are a fresher, a personal project with a GitHub Actions workflow, a Dockerfile and a deployment to a cloud VM is enough, as long as you can explain every line.

DevOps Interview Questions and Answers: questions with worked answers

  1. 1

    What problem does DevOps solve, and how is it different from just having an operations team?

    easy

    DevOps removes the hand-off wall between people who write code and people who run it. Traditionally developers optimise for shipping features and operations for stability, so releases are infrequent, large and risky. DevOps puts shared ownership on the whole lifecycle: small changes, automated build and test, automated deployment, and feedback from production through monitoring. The result you can measure is shorter lead time and lower change failure rate, not a job title. Tools such as CI servers, containers and infrastructure as code are enablers; the cultural change is that the team that builds a service is also on the hook for how it behaves in production.

  2. 2

    Explain continuous integration, continuous delivery and continuous deployment.

    easy

    Continuous integration means every commit is merged to a shared branch frequently and automatically built and tested, so integration bugs surface within minutes. Continuous delivery extends this so every passing build produces a release artefact that is deployable at any time, but a human presses the button for production. Continuous deployment removes that button: every change that passes the pipeline goes to production automatically. The distinction matters in interviews because regulated or low-test-coverage teams often stop at delivery. A reasonable answer also names the gate between them, such as automated integration tests, security scans and a manual approval step.

  3. 3

    Sketch a CI pipeline for a containerised web service. What stages and why?

    medium

    Order stages from cheapest and fastest to most expensive so failures come early. Lint and unit tests run first, then dependency and secret scanning, then the image build, then an image vulnerability scan, then integration tests against the built image, then push to a registry tagged with the commit SHA. Deployment to staging follows, with smoke tests. Cache dependencies and Docker layers to keep it under ten minutes. Tag images with the immutable commit SHA rather than only latest, so any deployment can be traced to code and rolled back precisely. The workflow below shows the first stages in GitHub Actions.

    yaml
    name: ci
    on:
      pull_request:
      push:
        branches: [main]
    
    jobs:
      test:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-node@v4
            with:
              node-version: 22
              cache: npm
          - run: npm ci
          - run: npm run lint
          - run: npm test -- --ci
    
      image:
        needs: test
        runs-on: ubuntu-latest
        permissions:
          contents: read
          packages: write
        steps:
          - uses: actions/checkout@v4
          - uses: docker/setup-buildx-action@v3
          - uses: docker/login-action@v3
            with:
              registry: ghcr.io
              username: ${{ github.actor }}
              password: ${{ secrets.GITHUB_TOKEN }}
          - uses: docker/build-push-action@v6
            with:
              push: ${{ github.ref == 'refs/heads/main' }}
              tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
              cache-from: type=gha
              cache-to: type=gha,mode=max
  4. 4

    Compare blue-green, canary and rolling deployments.

    medium

    A rolling deployment replaces instances in small batches, so old and new versions serve traffic together briefly; it is cheap and the Kubernetes default, but rollback means rolling forward again. Blue-green keeps two full environments and flips traffic at once through the load balancer or a Service selector; rollback is instant, but you pay for double capacity and must handle database changes that both versions tolerate. A canary sends a small percentage of real traffic, say 5 percent, to the new version and watches error rate and latency before widening; it limits blast radius best, but needs good metrics and a traffic-splitting layer such as a service mesh, ingress controller or Argo Rollouts. Choose by risk: canary for user-facing changes, blue-green when you need instant rollback, rolling for low-risk internal services.

  5. 5

    What is GitOps and how does it differ from push-based CI/CD?

    medium

    In GitOps, Git is the single source of truth for the desired state of the system, and an agent inside the cluster, such as Argo CD or Flux, continuously pulls the repo and reconciles the cluster to match it. In push-based CI/CD the pipeline holds cluster credentials and runs kubectl or helm from outside. Pull-based GitOps improves security because credentials stay in the cluster, gives you drift detection and self-healing (manual changes are reverted), and gives an audit trail through Git history. Rollback is a git revert. The usual pattern is that CI builds and pushes the image, then commits the new image tag to a separate config repository, and the GitOps agent does the deployment.

  6. 6

    What are the four DORA metrics and how would you improve each?

    medium

    Deployment frequency, lead time for changes, change failure rate and time to restore service (recent DORA reports describe the last as failed deployment recovery time). The first two measure throughput and the last two measure stability. To raise frequency and cut lead time, shrink batch size, use trunk-based development with feature flags and automate the pipeline end to end. To reduce change failure rate, improve test coverage, add canary releases and automated rollback. To shorten restore time, invest in observability, runbooks, one-click rollback and on-call practice. Be careful to say these are team-level indicators and not individual performance targets, because gaming them defeats the purpose.

  7. 7

    What is infrastructure as code and why is idempotency important?

    easy

    Infrastructure as code describes servers, networks and services in versioned files that tools apply automatically, so environments are reproducible, reviewable and can be rebuilt after a disaster. Idempotency means applying the same definition repeatedly leaves the system in the same state without side effects. Terraform achieves it by comparing desired configuration with recorded state; Ansible modules check current state before acting. A shell script that runs useradd twice fails the second time, whereas the Ansible user module reports no change. Idempotency is what makes it safe to re-run a pipeline after a partial failure or to run configuration on a schedule to correct drift. See the Terraform questions for state and modules.

  8. 8

    How do you manage secrets in a pipeline and in production?

    medium

    Never commit them to Git, bake them into images or print them in logs. In CI use the platform's encrypted secret store and prefer short-lived credentials through OIDC federation, where GitHub Actions or GitLab exchanges a signed token for temporary cloud credentials, instead of long-lived access keys. In production, fetch secrets at runtime from a manager such as AWS Secrets Manager, Azure Key Vault, Google Secret Manager or HashiCorp Vault, authenticated by the workload identity of the pod or instance. Rotate regularly, grant least privilege, and add secret scanning such as gitleaks as a pre-commit hook and CI step. If a secret leaks, rotate it first and clean history afterwards, because anything pushed should be treated as compromised.

  9. 9

    A deployment to production fails health checks and users see errors. Walk through your response.

    medium

    First stabilise, then investigate. Check whether the change correlates with the error spike on your dashboards, and if it does, roll back immediately rather than debugging live; in Kubernetes that is kubectl rollout undo deployment/api. Announce in the incident channel, assign an incident commander and keep a timeline. After service is restored, look at the failed rollout: kubectl describe pod and kubectl logs --previous for crash loops, readiness probe configuration, missing config or secrets, and resource limits causing OOM kills. Then write a blameless post-mortem covering the root cause, why tests and canaries did not catch it, and concrete follow-ups with owners. The interviewer is listening for the order: mitigate, communicate, diagnose, learn.

    bash
    kubectl rollout status deployment/api --timeout=60s
    kubectl rollout history deployment/api
    kubectl rollout undo deployment/api
    kubectl get events --sort-by=.lastTimestamp | tail -20
    kubectl logs deploy/api --previous --tail=100
  10. 10

    What is the difference between monitoring and observability? What are the three pillars?

    medium

    Monitoring watches known failure modes through predefined metrics and alerts: is CPU high, is the endpoint returning 500s. Observability is the ability to ask new questions about a system from the data it emits, so you can debug failures you did not predict. The three pillars are metrics (numeric time series, cheap and good for alerting), logs (event records with detail) and traces (the path of one request across services, showing where latency comes from). Correlating them through a shared trace ID is what makes them powerful. Prometheus with Grafana, Loki or ELK, and OpenTelemetry with Jaeger or Tempo are common stacks. Alert on symptoms users feel, such as error rate and latency, rather than on every CPU spike.

  11. 11

    Explain the Git branching strategies you know and which suits CI/CD best.

    easy

    Git Flow uses long-lived develop, release and hotfix branches; it suits versioned products with scheduled releases but delays integration. GitHub Flow keeps main always deployable and uses short feature branches with pull requests. Trunk-based development has everyone commit to main, or to branches living under a day or two, using feature flags to hide unfinished work. Trunk-based fits continuous delivery best because integration is constant and merge conflicts stay small, but it demands strong automated tests and flag discipline. In an interview, mention branch protection rules, required status checks and code review as the controls that make a fast-moving main branch safe.

  12. 12

    How would you reduce a slow 40-minute pipeline?

    medium

    Measure first: look at per-stage timings to find the real bottleneck instead of guessing. Then apply the usual levers. Run independent jobs in parallel and shard long test suites. Cache dependencies and container layers, ordering Dockerfile instructions so rarely changing layers come first. Run only what changed in a monorepo using path filters or a build graph tool. Move slow end-to-end tests out of the pull request path to a post-merge or nightly stage while keeping a fast smoke subset. Use larger or self-hosted runners for compile-heavy jobs. Finally, delete flaky tests or quarantine them, because retries hide cost and erode trust in the pipeline.

  13. 13

    What is configuration drift and how do you prevent it?

    easy

    Drift is when the real state of servers or cloud resources diverges from what your code says, usually because someone made a manual change during an incident. It causes works-on-staging surprises and makes rebuilds unreliable. Prevent it by making infrastructure immutable where possible (replace instances from a new image instead of patching), restricting console write access, running terraform plan on a schedule to detect differences, and using GitOps controllers that self-heal. When drift is found, either codify the change or revert it, and note why it happened. Emergency manual changes are acceptable, but they must be followed by a code change the same day.

  14. 14

    What does a health check in a deployment need to verify? Distinguish liveness from readiness.

    medium

    A readiness check answers whether this instance should receive traffic now; it should fail while the app warms up, loses its database connection or is draining. A liveness check answers whether the process is stuck and needs a restart; it should be cheap and must not depend on downstream services, otherwise a database outage would restart every pod and make things worse. Startup probes protect slow-starting apps from being killed by liveness checks. Load balancers use a readiness-style check to remove bad targets. A common mistake is a liveness probe that calls the database, causing cascading restarts during a dependency outage.

  15. 15

    How do you handle database schema changes in a zero-downtime deployment?

    hard

    Use the expand and contract pattern so old and new application versions both work against the schema at every step. Expand: add the new nullable column or table, deploy code that writes to both old and new, backfill existing data in batches. Migrate: switch reads to the new column. Contract: once no running version uses the old column, drop it in a later release. Never rename or drop a column in the same release that stops using it, because a rolling or blue-green deployment runs both versions together and rollback would break. Run migrations as a separate pipeline step with a tool like Flyway or Liquibase, and test them against a copy of production-sized data to catch long locks.

  16. 16

    What is a service level objective and how does an error budget change how a team ships?

    hard

    A service level indicator is a measured quantity such as the proportion of requests answered successfully under 300 ms. A service level objective is the target for it, for example 99.9 percent over 30 days. The error budget is the allowed failure, here 0.1 percent, which is about 43 minutes of full downtime in a 30-day month. While budget remains, the team can ship features and take risks; when it is spent, the team slows releases and prioritises reliability work. It turns the arguments between speed and stability into a shared numerical policy. Read more in the site reliability engineer questions.

Frequently asked questions

Do I need to know programming for a DevOps role?

Yes, at scripting level at least. Python or Go for tooling, and strong Bash. You are rarely asked hard algorithm problems, but you may be asked to parse a log file, call an API or write a small automation script.

Which tools should a fresher learn first?

Linux, Git, one CI system such as GitHub Actions or Jenkins, Docker, one cloud provider's basics, Terraform and Kubernetes fundamentals, in roughly that order. Depth in a few beats shallow familiarity with twenty.

How are DevOps, SRE and platform engineering different?

DevOps is a set of practices and culture, SRE applies software engineering to reliability using SLOs and error budgets, and platform engineering builds internal self-service tooling so product teams can deploy without deep infrastructure knowledge. The skills overlap heavily.

What is the best way to prepare for scenario questions?

Practise out loud with real failure cases: a crash-looping pod, an expired certificate, a full disk, a bad deploy. Structure each answer as detect, mitigate, find the root cause, prevent recurrence.

Related guides

More in Role-wise Interview Questions by Job and Tech Stack

See all in this section