10 role-specific questions
DevOps Engineer Interview Questions & Answers
DevOps and platform interviews cover delivery pipelines, containers and Kubernetes, infrastructure as code, observability, secrets and how you handle incidents.
Free, no sign-up. 83 questions in this role's practice pool, including behavioural, HR and situational questions.
DevOps & cloud interview questions
CI/CD, containers, Kubernetes, infrastructure as code, monitoring and incident response.
1.
Describe a good CI/CD pipeline for a web application.
BeginnerTechnicalPractise this question and get feedbackWhat the interviewer is evaluating
Delivery fundamentals.
Key points a strong answer covers
- CI on every change. Every change triggers build and tests automatically.
- Stages. Lint, test, security scan, build an artifact once.
- Environments & promotion. Deploy the same artifact to staging, then production.
- Safe deployment. Rolling/canary/blue-green deployments with quick rollback.
- Fast feedback. Keep it fast with caching and parallel jobs.
Suggested answer structure
- Define it in one sentence.
- Explain how it works underneath.
- Give a practical example from code or a project.
- Close with a trade-off, pitfall or when you'd use it.
Common mistakes
- Building separately for each environment.
- No rollback plan.
Likely follow-up questions
- How would you speed up a 40-minute pipeline?
- What's the difference between continuous delivery and continuous deployment?
Example strong answer
Every pull request triggers CI: install dependencies with caching, lint and type-check, run unit and integration tests, run security checks like dependency and secret scanning, then build an artifact — usually a container image — exactly once, tagged with the commit. Merging to main deploys that same artifact to staging, where smoke and end-to-end tests run, and then promotes it to production, either automatically or with an approval. Production deploys are gradual — rolling or canary — with health checks and automatic rollback if error rates rise, and feature flags decouple releasing a feature from deploying code. I keep the pipeline fast, ideally under ten minutes, with caching and parallel jobs.
2.
What is a container, and how is it different from a virtual machine?
BeginnerTechnicalPractise this question and get feedbackWhat the interviewer is evaluating
Containerisation basics.
Key points a strong answer covers
- Shares the host kernel. Containers share the host OS kernel and isolate processes.
- VM has full OS. A VM runs a full guest OS on a hypervisor.
- Isolation mechanisms. Namespaces and cgroups isolate and limit containers.
- Image & portability. Images package the app and dependencies for consistent environments.
Suggested answer structure
- Define it in one sentence.
- Explain how it works underneath.
- Give a practical example from code or a project.
- Close with a trade-off, pitfall or when you'd use it.
Common mistakes
- Saying containers are mini VMs.
- Ignoring that weaker isolation has security implications.
Likely follow-up questions
- How would you make a Docker image smaller?
- Why shouldn't containers run as root?
Example strong answer
A container is an isolated process — or group of processes — that shares the host's operating system kernel. Linux namespaces give it its own view of the filesystem, network and processes, and cgroups limit its CPU and memory. A virtual machine instead runs a complete guest operating system on a hypervisor. So containers start in seconds and are lightweight, while VMs give stronger isolation. The image packages the app with its exact dependencies in layers, so it runs the same on a laptop, in CI and in production. I keep images small with multi-stage builds and slim base images, and run as a non-root user.
3.
What makes a good, production-ready Dockerfile?
IntermediateTechnicalPractise this question and get feedbackWhat the interviewer is evaluating
Practical container hygiene.
Key points a strong answer covers
- Small base / multi-stage. Multi-stage builds and slim or distroless base images.
- Layer caching. Copy dependency manifests first so the install layer is cached.
- Non-root & security. Run as non-root, pin versions, scan images, no secrets in layers.
- Runtime concerns. Handle SIGTERM, add a .dockerignore, configure via env.
Suggested answer structure
- Define it in one sentence.
- Explain how it works underneath.
- Give a practical example from code or a project.
- Close with a trade-off, pitfall or when you'd use it.
Common mistakes
- Copying the whole repo before installing dependencies.
- Baking secrets into the image.
Likely follow-up questions
- Why does instruction order affect build speed?
- How does a process handle SIGTERM in a container?
Example strong answer
I use a multi-stage build: one stage with the full toolchain compiles the app, and the final stage copies only the output onto a slim or distroless base, so the image is small and has less attack surface. I order instructions for caching: copy the dependency manifest, install, then copy the source, so code changes don't reinstall everything. A
.dockerignorekeepsnode_modules,.gitand local env files out. The final image runs as a non-root user, pins base image versions, gets scanned for vulnerabilities in CI, and never contains secrets — they come from the environment at runtime. The app handles SIGTERM to shut down gracefully, and configuration comes from environment variables.4.
Explain the main Kubernetes objects and what each is for.
IntermediateTechnicalPractise this question and get feedbackWhat the interviewer is evaluating
Working knowledge of Kubernetes.
Key points a strong answer covers
- Pod. A Pod is one or more containers scheduled together — the smallest unit.
- Deployment / ReplicaSet. A Deployment manages replicas and rolling updates.
- Service / Ingress. A Service gives pods a stable address; Ingress/Gateway routes external HTTP.
- Config & secrets. ConfigMaps and Secrets inject configuration.
- Health & scaling. Probes, resource requests/limits and the HorizontalPodAutoscaler.
Suggested answer structure
- Define it in one sentence.
- Explain how it works underneath.
- Give a practical example from code or a project.
- Close with a trade-off, pitfall or when you'd use it.
Common mistakes
- Running bare pods without a controller.
- No readiness probes, so traffic hits pods that aren't ready.
Likely follow-up questions
- What's the difference between liveness and readiness probes?
- Why set resource requests and limits?
Example strong answer
A Pod is the smallest unit: one or more containers that share networking and storage, scheduled together on a node. You rarely create pods directly; a Deployment declares how many replicas you want and manages rolling updates and rollbacks through ReplicaSets. Because pods come and go, a Service gives them a stable name and load-balances between them, and an Ingress or the Gateway API routes external HTTP traffic to Services. ConfigMaps and Secrets inject configuration. Readiness probes stop traffic until a pod is ready, liveness probes restart stuck containers, resource requests and limits help the scheduler and protect neighbours, and a HorizontalPodAutoscaler scales replicas on metrics like CPU.
5.
What is infrastructure as code, and how do you use it safely?
IntermediateTechnicalPractise this question and get feedbackWhat the interviewer is evaluating
Reproducible, reviewable infrastructure.
Key points a strong answer covers
- Definition. Infrastructure defined in version-controlled code.
- Tools. Terraform/OpenTofu, Pulumi, CloudFormation, Bicep.
- Plan & review. Review a plan in a pull request before applying.
- State management. Remote, locked state files.
- Modules & drift. Reusable modules per environment; detect drift.
Suggested answer structure
- Define it in one sentence.
- Explain how it works underneath.
- Give a practical example from code or a project.
- Close with a trade-off, pitfall or when you'd use it.
Common mistakes
- Making manual console changes that drift from the code.
- Storing state locally or committing it.
Likely follow-up questions
- What happens if two people run terraform apply at once?
- How do you handle secrets in IaC?
Example strong answer
Infrastructure as code means defining servers, networks, databases and permissions in code — Terraform or OpenTofu, Pulumi, CloudFormation — stored in Git, so infrastructure is reproducible, reviewed and has history. Changes go through a pull request where CI runs
terraform planand posts the diff, and someone reviews exactly what will change before it's applied, ideally by the pipeline rather than a laptop. State is stored remotely with locking so two applies can't collide, and it's never committed since it can contain secrets. Reusable modules keep staging and production consistent, secrets come from a secrets manager, and I detect drift from manual console changes regularly.6.
Production is down. Walk me through how you respond.
IntermediateTechnicalPractise this question and get feedbackWhat the interviewer is evaluating
Calm, structured incident handling.
Key points a strong answer covers
- Assess & declare. Confirm the impact and declare an incident with a severity.
- Roles & communication. Assign roles, communicate on a channel and status page.
- Mitigate first. Restore service first — roll back recent changes — before root-causing.
- Use data. Use dashboards, logs and recent changes to find the cause.
- Post-mortem. A blameless post-mortem with action items.
Suggested answer structure
- Define it in one sentence.
- Explain how it works underneath.
- Give a practical example from code or a project.
- Close with a trade-off, pitfall or when you'd use it.
Common mistakes
- Debugging the root cause while users are down instead of rolling back.
- No communication with stakeholders.
Likely follow-up questions
- What goes in a good post-mortem?
- How do you decide between rollback and a fix forward?
Example strong answer
First I confirm the impact — which users, which features, since when — and declare an incident with a severity so the right people join. Someone takes the incident commander role, someone handles communication: a dedicated channel, regular updates to stakeholders and the status page. The priority is restoring service, not finding the root cause: I check what changed recently — deploys, config, feature flags, infrastructure — and roll back or disable the change if it lines up, using dashboards, logs and traces to confirm. Once service is stable, we investigate properly. Afterwards there's a blameless post-mortem with a timeline, the root cause and contributing factors, and owned action items.
7.
What would you monitor for a web service, and how would you set up alerts?
IntermediateTechnicalPractise this question and get feedbackWhat the interviewer is evaluating
Signal over noise in monitoring.
Key points a strong answer covers
- Golden signals. Latency, traffic, errors, saturation.
- SLOs. SLOs and error budgets define what 'good' means.
- Alert on symptoms. Page on user-facing symptoms; avoid noisy alerts.
- Tools / logs / traces. Metrics, logs and traces in tools like Prometheus/Grafana or Datadog.
- Runbooks. Every alert links to a runbook.
Suggested answer structure
- Define it in one sentence.
- Explain how it works underneath.
- Give a practical example from code or a project.
- Close with a trade-off, pitfall or when you'd use it.
Common mistakes
- Alerting on every CPU spike.
- No SLOs, so nobody knows if the service is healthy.
Likely follow-up questions
- What's an error budget and how does it guide decisions?
- How do you reduce alert fatigue?
Example strong answer
I'd monitor the golden signals: latency (p50, p95, p99), traffic, error rate and saturation — CPU, memory, connection pools, queue depth — plus business signals like checkouts per minute. I define SLOs with the team, such as 99.9% of requests succeeding and 95% completing under 300 ms over 30 days, which gives an error budget. Pages go out only for user-facing symptoms that need action now, like burning the error budget too fast; causes such as high CPU go to dashboards or low-urgency tickets. Every alert links to a runbook. Metrics live in something like Prometheus and Grafana or Datadog, alongside structured logs and traces.
8.
How do you manage secrets in pipelines and production?
IntermediateTechnicalPractise this question and get feedbackWhat the interviewer is evaluating
Security in operations.
Key points a strong answer covers
- Never in code. Secrets are never committed or hard-coded.
- Secret managers. Use a secrets manager (Vault, AWS Secrets Manager, Azure Key Vault).
- Least privilege / short-lived. Prefer short-lived credentials (OIDC, workload identity) and least privilege.
- Rotation & detection. Rotate regularly, scan for leaks, audit access.
Suggested answer structure
- Define it in one sentence.
- Explain how it works underneath.
- Give a practical example from code or a project.
- Close with a trade-off, pitfall or when you'd use it.
Common mistakes
- Long-lived cloud keys stored in CI variables.
- Printing secrets in logs.
Likely follow-up questions
- How does OIDC let CI deploy without stored cloud keys?
- What do you do when a secret is committed to Git?
Example strong answer
Secrets never go in the repository — I run secret scanning like gitleaks in CI and pre-commit hooks to catch mistakes. In production they live in a secrets manager — Vault, AWS Secrets Manager or Azure Key Vault — and are injected at runtime, with access granted per service on least privilege. Wherever possible I avoid long-lived credentials altogether: CI deploys to the cloud using OIDC federation and short-lived tokens, and workloads use cloud identities instead of keys. Secrets are rotated regularly and access is audited. If one is ever committed, I treat it as compromised: revoke and rotate it first, then clean up history.
9.
How would you design cloud infrastructure for high availability?
AdvancedTechnicalPractise this question and get feedbackWhat the interviewer is evaluating
Reliability architecture.
Key points a strong answer covers
- Redundancy across zones. Run across multiple availability zones with no single point of failure.
- Load balancing & autoscaling. Load balancers with health checks and autoscaling.
- Data layer. Replicated managed databases with automatic failover and tested backups.
- Stateless apps. Stateless app tiers so instances are replaceable.
- RTO / RPO & testing. Define RTO/RPO and test failover regularly.
Suggested answer structure
- Define it in one sentence.
- Explain how it works underneath.
- Give a practical example from code or a project.
- Close with a trade-off, pitfall or when you'd use it.
Common mistakes
- Never testing backup restores.
- A single database instance in one zone.
Likely follow-up questions
- What are RTO and RPO?
- When is multi-region worth the cost?
Example strong answer
I start with requirements: the target availability and the RTO and RPO — how long we can be down and how much data we can lose. Then I remove single points of failure: stateless application instances spread across at least two or three availability zones behind a load balancer with health checks and autoscaling; sessions and files in shared services like Redis and object storage. The database is a managed service with a synchronous standby in another zone and automatic failover, plus point-in-time backups that we actually test restoring. Multi-region is for when a whole-region outage is unacceptable, and it adds a lot of cost and complexity. Finally, I test failover with game days, because untested redundancy often doesn't work.
10.
A Linux server is slow. What commands and steps would you use to investigate?
IntermediateTechnicalPractise this question and get feedbackWhat the interviewer is evaluating
Hands-on troubleshooting.
Key points a strong answer covers
- CPU / load. top/htop and load average for CPU.
- Memory. free, vmstat and dmesg for memory pressure, swapping and OOM kills.
- Disk. df/du for space, iostat for I/O wait.
- Network. ss/netstat for connections, ping/curl/dig for network issues.
- Logs. journalctl and application logs.
Suggested answer structure
- Define it in one sentence.
- Explain how it works underneath.
- Give a practical example from code or a project.
- Close with a trade-off, pitfall or when you'd use it.
Common mistakes
- Restarting the server before collecting evidence.
- Checking only CPU.
Likely follow-up questions
- What does a high load average with low CPU usage suggest?
- How would you find which process is filling the disk?
Example strong answer
I'd follow a quick checklist before restarting anything.
uptimeandtoporhtopshow load average and which processes use CPU — a high load with idle CPU often points to I/O wait.free -handvmstat 1show memory pressure and swapping, anddmesgorjournalctl -kreveal whether the OOM killer has been killing processes.df -handdf -icheck disk space and inodes,dufinds what's filling it, andiostat -xshows whether the disk is saturated.ss -tunapshows connections — thousands in TIME_WAIT or a full connection pool. Then the service's logs withjournalctl -u. Once I find the cause, I fix it and add monitoring so it's caught earlier next time.
Ready to answer them out loud?
Run a timed devops engineer mock interview, type or speak your answers, and get a score breakdown with what to improve.