DevOps Interview Questions (with real STAR answers)

The DevOps interview questions that come up most, from junior to senior - CI/CD, Linux, Docker, Terraform, monitoring, and incident response. Short model answers for the technical questions, and STAR answers for the "tell me about a time" questions, built from real production work you can do yourself.

Get started - freeLive cloud workspace in your browser · nothing to install

DevOps interviews mix technical questions, troubleshooting scenarios, and behavioral questions. This page covers the questions that come up most, from junior to senior: behavioral questions with STAR answers built from real production work you can do yourself, then technical and scenario questions with short model answers.

DevOps behavioral interview questions (STAR answers)

Tell me about a time you debugged a production outage.

Situation: Right after a deploy, the production site started returning 502 Bad Gateway. Users were locked out and the backend was confirmed running, so something between the proxy and the app had broken.
Task: I needed to restore traffic fast and find the actual cause, not just restart things and hope.
Action: I read the nginx error log, traced the upstream connection, and found the proxy was pointed at the wrong port after the deploy. I corrected the upstream config, tested it with nginx -t, and reloaded nginx.
Result: Traffic recovered within minutes, and I documented the port mismatch so the next deploy would not reintroduce it.

Go earn this story: Fix the Nginx 502 Bad Gateway →

Tell me about a time you dealt with infrastructure drift.

Situation: Infrastructure had drifted from its Terraform definition because changes were being made by hand, so nobody trusted the plan output.
Task: I had to bring the live infrastructure back in line with code so future changes were safe and reviewable.
Action: I ran terraform plan to list the drift, imported the resources that were missing from state, and updated the configuration until the plan came back clean.
Result: Infrastructure changes went back through version control and code review, which removed a whole class of surprise outages.

Go earn this story: Reconcile Terraform State Drift →

Tell me about a time you handled an incident under pressure.

Situation: A containerized service exited right after startup and would not stay up, which blocked a release.
Task: I needed to get the container to a healthy running state quickly without guessing.
Action: I checked docker ps -a for the exit code and docker logs for the error, found the broken entrypoint and config, and corrected them so the process started cleanly.
Result: The service came up healthy and the release went out, and I wrote down the failure mode so it would be caught earlier next time.

Go earn this story: Fix a Docker Container That Exits Immediately →

Tell me about a time you made a CI/CD pipeline faster.

Situation: Our GitHub Actions pipeline had become slow, so developers waited a long time for feedback on every pull request.
Task: I had to cut the pipeline time without removing any of the checks.
Action: I measured each step, cached dependencies between runs, ran independent jobs in parallel, and stopped rebuilding things that had not changed.
Result: The pipeline became much faster with the same checks, and developers got feedback quickly enough to stay focused on their change.

Go earn this story: Speed Up a Slow GitHub Actions Pipeline →

Tell me about a time you released a change with zero downtime.

Situation: Every release restarted the app in place, so users saw errors for a short time on each deploy.
Task: I needed a release process where users never saw an outage, with a fast way back if the new version was bad.
Action: I set up a blue-green deploy: the new version started next to the old one, passed health checks, and only then did the proxy switch traffic to it. The old version stayed ready for rollback.
Result: Releases stopped causing errors for users, and rolling back became a single traffic switch instead of an emergency redeploy.

Go earn this story: Ship a Zero-Downtime Blue-Green Deploy →

Tell me about a time you improved monitoring or alerting.

Situation: We found out about problems from users, not from our own monitoring.
Task: I had to make sure the team heard about real problems first, without flooding them with noisy alerts.
Action: I set up Prometheus to scrape the services and Alertmanager to route alerts, and wrote alert rules on symptoms users feel - error rate, latency, and service down - instead of on every metric.
Result: The team saw problems before users reported them, and on-call alerts became fewer but more useful.

Go earn this story: Stand Up Prometheus and Alertmanager →

DevOps technical and scenario interview questions

What is the difference between continuous integration, continuous delivery, and continuous deployment?

Continuous integration means every change is merged often and automatically built and tested. Continuous delivery adds that every change that passes is ready to release, but a person still approves the release. Continuous deployment removes that manual step - every change that passes the pipeline goes to production automatically.

What is the difference between a container and a virtual machine?

A virtual machine runs a full guest operating system on a hypervisor. A container shares the host's kernel and isolates only the process, using Linux namespaces and cgroups. Containers start faster and use less memory; virtual machines give stronger isolation.

How do you make a Docker image smaller?

Use a multi-stage build so build tools stay out of the final image, start from a slim or distroless base image, add a .dockerignore file, combine related RUN steps and clean package caches in the same step, and copy only the files the app needs.

What is the difference between CMD and ENTRYPOINT in a Dockerfile?

ENTRYPOINT sets the program that always runs. CMD sets the default arguments, and anything passed to docker run replaces CMD. A common pattern is ENTRYPOINT for the binary and CMD for default flags. Use the exec form (a JSON array) so the process is PID 1 and receives signals like SIGTERM.

What is Terraform state, and why does it matter?

State is Terraform's record of which real resources match which resources in your code. Terraform compares code, state, and the real world to build a plan. In a team, store state in a remote backend with locking (for example S3 with locking) so two people cannot change it at the same time, and never edit it by hand.

What is the difference between a 502, 503, and 504 error from a reverse proxy?

502 Bad Gateway: the proxy reached the upstream but got an invalid response or the connection was refused, often a wrong port or a crashed app. 503 Service Unavailable: no healthy upstream is available or the service is overloaded. 504 Gateway Timeout: the upstream did not answer in time.

What are blue-green and canary deployments?

Blue-green runs two full environments and switches all traffic from the old one to the new one at once, so rollback is one switch. Canary sends a small share of traffic to the new version first, watches error rate and latency, and increases the share step by step.

How do you handle secrets in a CI/CD pipeline?

Never put secrets in the repository or in the image. Store them in a secrets manager (Vault, AWS Secrets Manager, SSM Parameter Store) or the CI system's encrypted secrets, give each job only the secrets it needs, prefer short-lived credentials such as OIDC roles, mask them in logs, and rotate them.

What does idempotent mean in configuration management?

Running the same playbook or script many times leaves the system in the same state as running it once. In Ansible this means using modules that describe a desired state (package present, file with this content) instead of shell commands that change things every run.

What should you monitor for a web service?

Start with the four golden signals: latency, traffic, errors, and saturation (CPU, memory, disk, connections). Alert on symptoms users feel, such as high error rate or latency, and use logs and traces to find the cause.

How does a systemd service unit work?

A unit file in /etc/systemd/system describes how to start the process (ExecStart), which user runs it, when to restart it (Restart=on-failure), and what it depends on (After=, Wants=). Use systemctl daemon-reload after editing, systemctl enable --now to start it, and journalctl -u name to read its logs.

Scenario: a Linux server's disk is full. What do you do?

Confirm with df -h (and df -i for inodes), then find the large paths with du -sh /* and narrow down. Common causes are logs, old Docker images, and core dumps. Clean safely (logrotate, journalctl --vacuum-size, docker system prune), and check lsof +L1 for deleted files still held open by a process. Then add an alert on disk usage.

Scenario: a deploy just broke production. What do you do first?

Reduce user impact first: roll back to the last good version or switch off the feature flag. Tell the team what is happening. When the service is stable, find the cause from logs, metrics, and the diff, then write a blameless postmortem with actions so it does not happen again.

Scenario: a service will not start on a Linux server. How do you troubleshoot?

Run systemctl status and journalctl -u service to read the error. Check that the config is valid, that the port is free (ss -tlnp), that file permissions and the run user are correct, and that dependencies like the database are reachable. Change one thing at a time and restart.

What questions are asked in a DevOps interview?

Expect behavioral questions (tell me about a time you...), technical questions on CI/CD, Linux, containers, infrastructure as code, and monitoring, and troubleshooting scenarios such as a full disk or a broken deploy. Many companies also give a hands-on task. The questions on this page cover all three types.

How do you answer behavioral interview questions?

Use STAR: Situation, Task, Action, Result. Keep it concrete - a specific incident, what you owned, what you did, and the result. The answers above are all structured this way.

More for DevOps engineers

DevOps projectsDevOps roadmapResume projectsCareer guide

Do real production work, free. Live cloud workspaces in your browser - every project you complete lands on your portfolio.

Get started - free
Get started - free