DevOps Interview Questions: Fresher to Expert (2027)
DevOps interview questions asked three ways: fresher, 2-5 years and expert answers for Linux, Git, CI/CD, Docker, Kubernetes, Terraform and SRE.
DevOps interviews ask about the same topics at every level, but the depth changes. A fresher explains what Git, CI/CD, Docker or Kubernetes do; an engineer with a few years shows how they built and ran them; an expert defends design choices, trade-offs and failure recovery. This guide asks each topic three ways so you can see the jump between levels. It has 48 questions plus scenarios.
If you only have an evening, start with the 20 most common DevOps interview questions. For the widest coverage, use the 200+ DevOps interview questions guide. This page is for working out which level you are interviewing at and what a strong answer sounds like there.
Key takeaways
- Each topic below appears three times: a fresher question, a 2 to 5 years question and an expert question. Read across a row to see what changes.
- Freshers win with clear definitions and one small project they can explain end to end.
- Mid-level candidates are judged on what they actually ran: pipelines, clusters, Terraform state, alerts.
- Experts are judged on trade-offs, failure modes, cost and how they bring other teams along.
- DORA now describes five software delivery metrics: change lead time, deployment frequency, failed deployment recovery time, change fail rate and deployment rework rate.
One topic, three levels
| Topic | Fresher question | 2 to 5 years question | Expert question |
|---|---|---|---|
| DevOps culture | Q1 | Q17 | Q33 |
| Linux | Q2 | Q18 | Q34 |
| Git | Q3 | Q19 | Q35 |
| CI/CD | Q4 | Q20 | Q36 |
| Build artifacts | Q5 | Q21 | Q37 |
| Containers | Q6 | Q22 | Q38 |
| Kubernetes | Q7 | Q23 | Q39 |
| Infrastructure as code | Q8 | Q24 | Q40 |
| Configuration management | Q9 | Q25 | Q41 |
| Cloud | Q10 | Q26 | Q42 |
| Networking | Q11 | Q27 | Q43 |
| Monitoring | Q12 | Q28 | Q44 |
| Logging and tracing | Q13 | Q29 | Q45 |
| Security | Q14 | Q30 | Q46 |
| Scripting | Q15 | Q31 | Q47 |
| Reliability | Q16 | Q32 | Q48 |
Fresher questions
1. What is DevOps?
DevOps is a way of working where development and operations share responsibility for building, releasing and running software, supported by automation such as CI/CD, infrastructure as code and monitoring. The goal is frequent, low-risk changes with fast feedback. Our what is DevOps guide covers the basics.
2. Which Linux commands do you use to check a slow server?
top or htop for CPU and memory, df -h for disk space, free -m for memory, ss -tulpn for listening ports, and journalctl -u <service> for service logs. Explain what you would look for in each, not just the names.
3. What is the difference between git merge and git rebase?
Merge joins two branches with a merge commit and keeps history as it happened. Rebase replays your commits on top of another branch for a straight history. Do not rebase commits others have already pulled, because it rewrites them.
4. What is CI/CD?
Continuous integration builds and tests every change merged to the main branch. Continuous delivery keeps the software always releasable, with deployment to production on a manual approval. Continuous deployment releases every passing change automatically.
5. What is a build artifact?
The output of a build that you deploy, such as a JAR, a container image or a package. Build it once, version it, store it in a repository, and promote the same artifact through test and production.
6. What is the difference between a container and a virtual machine?
A VM virtualises hardware and runs its own kernel. A container shares the host kernel and isolates processes with namespaces and cgroups, so it starts faster and uses less memory. VMs give stronger isolation.
7. What does Kubernetes do?
It runs containers across a cluster of machines: it schedules pods, restarts failed ones, scales them, gives them stable network names through Services and rolls out new versions. You declare the desired state in YAML and controllers keep the cluster there.
8. What is infrastructure as code?
Defining servers, networks and cloud resources in version-controlled files and creating them with a tool such as Terraform or CloudFormation. It makes environments repeatable and changes reviewable.
9. What is Ansible used for?
Configuring servers and deploying applications over SSH using YAML playbooks, without an agent on the target. Tasks are written to be idempotent, so running a playbook twice gives the same result.
10. What are IaaS, PaaS and SaaS?
IaaS rents virtual machines, storage and networks (EC2, Compute Engine). PaaS runs your code without you managing servers (App Engine, Elastic Beanstalk). SaaS is finished software you use (Gmail, Jira). Responsibility moves from you to the provider as you go up.
11. What happens when you type a URL in a browser?
DNS resolves the name to an IP, the browser opens a TCP connection (and a TLS handshake for HTTPS), sends an HTTP request, and the server or load balancer returns a response. Mention caching and CDNs if you know them.
12. Why do we monitor applications?
To find problems before users report them and to understand behaviour. A common starting set is latency, traffic, errors and saturation, collected with tools such as Prometheus and shown in Grafana.
13. What is the difference between logs and metrics?
Logs are timestamped records of individual events with detail. Metrics are numbers aggregated over time, such as requests per second. Metrics tell you something is wrong; logs help you find why.
14. Why should secrets not be stored in Git?
Anyone with repository access, and anyone who gets a copy, can read them, and they stay in history even after deletion. Use a secret manager such as Vault or a cloud secret service and inject secrets at runtime.
15. Write a shell command to find the 5 largest files in /var/log.
find /var/log -type f -exec du -h {} + | sort -rh | head -5
16. What is high availability?
Designing a system so it keeps working when a component fails, usually by running several instances across zones behind a load balancer and removing single points of failure.
Questions for 2 to 5 years of experience
17. How did you reduce friction between development and operations in your last role?
Give a real example from your own work: a shared pipeline, on-call shared with developers, a dashboard both sides used, or a runbook. Say what changed and how you measured it, for example deployment frequency or recovery time.
18. A server's disk is 100 percent full. Walk through it.
Find what grew with du -sh /* | sort -rh, check for deleted files still held open with lsof +L1, clear or rotate logs safely, and restart only the process holding deleted files if needed. Then fix the cause: log rotation, retention or an alert at 80 percent.
19. What branching strategy have you used and why?
Trunk-based development with short-lived feature branches suits teams deploying often. GitFlow suits scheduled releases with several supported versions. Explain your choice with release frequency and team size, and mention branch protection and required reviews.
20. Describe a pipeline you built.
Walk through stages: checkout, build, unit tests, static analysis, image build, vulnerability scan, push to registry, deploy to staging, smoke tests, approval and production deploy. Name the tool (Jenkins, GitLab CI, GitHub Actions) and one problem you solved, such as slow builds fixed by caching.
21. How do you version and promote artifacts?
Tag images with the Git commit SHA or a semantic version, never only latest. Store them in a registry such as Artifactory, Nexus or a cloud registry, and promote the same digest from staging to production.
22. How do you make a Docker image smaller and safer?
Use multi-stage builds, a slim or distroless base, combine layers sensibly, add a .dockerignore, run as a non-root user and scan the image in CI.
FROM golang:1.23 AS build
WORKDIR /src
COPY . .
RUN CGO_ENABLED=0 go build -o /app .
FROM gcr.io/distroless/static
COPY --from=build /app /app
USER nonroot
ENTRYPOINT ["/app"]
23. A pod is in CrashLoopBackOff. What do you do?
Run kubectl describe pod for events and exit codes, and kubectl logs --previous for the last crash. Common causes are a bad config or secret, a failing liveness probe, or OOMKilled from a low memory limit. More in 15 common pod failures and fixes.
24. How do you manage Terraform state in a team?
Use a remote backend such as S3, Azure Storage or GCS with locking, split state by environment and component, never edit state by hand, and run plan in CI with apply after review.
25. How do you make an Ansible playbook idempotent?
Use modules that check state (package, template, service) instead of raw shell commands, add creates or changed_when where you must use shell, and run with --check --diff to confirm a second run makes no changes.
26. How do you control cloud costs?
Tag resources by team and environment, right-size instances from metrics, schedule non-production environments off at night, use reserved or committed-use discounts for steady load and spot or preemptible capacity for interruptible jobs, and review the bill monthly.
27. A service can reach a database by IP but not by hostname. Where is the problem?
DNS. Check /etc/resolv.conf, query with dig or nslookup, and in Kubernetes check CoreDNS pods and the service name format <service>.<namespace>.svc.cluster.local.
28. How do you write alerts that people do not ignore?
Alert on symptoms users feel (error rate, latency against an SLO) rather than every CPU spike, give each alert a runbook link, route by severity, and delete alerts nobody acts on.
29. How do you trace a slow request across services?
Instrument services with OpenTelemetry, propagate trace context headers, send traces to a backend such as Jaeger or Tempo, and put the trace ID in logs so you can jump from a trace to the matching log lines.
30. Where do you add security checks in a pipeline?
Secret scanning and static analysis on every commit, dependency and image scanning at build, infrastructure-as-code scanning before apply, and signed images verified at deploy. Fail the build on critical findings with an agreed exception process.
31. What have you automated with Python or Bash?
Pick one real script: cleaning old images, rotating credentials, a deployment helper. Explain error handling, logging, how it was tested and where it ran.
32. What is the difference between an SLI, an SLO and an SLA?
An SLI is a measurement (for example, percentage of successful requests). An SLO is the target for it (99.9 percent over 30 days). An SLA is a contract with customers, usually looser than the SLO, with penalties if missed.
Expert questions
33. How would you start a DevOps transformation in a company that deploys quarterly?
Measure the current state with the DORA metrics, pick one product team as a pilot, remove the largest bottleneck first (often manual testing or change approval), automate the path to production for that team, and publish the results before scaling. Culture changes when people see safer releases, not because a tool was bought.
34. How would you design a patching strategy for 2,000 Linux servers?
Group servers by role and risk, patch a canary group first, use configuration management or a patch service to apply updates in waves, check health between waves, and keep a rollback image. Prefer replacing immutable servers from new images over patching in place where possible. Report compliance continuously.
35. How do you run Git at scale for hundreds of engineers?
Decide between monorepo and multi-repo based on tooling and coupling, enforce branch protection and code owners, keep CI fast with path-based triggers and caching, and automate dependency updates. Make the main branch always deployable.
36. How would you design a platform that lets 50 teams deploy safely?
Offer golden-path templates for pipelines and services, a shared CI/CD system with policy checks built in, progressive delivery (canary or blue-green) as the default, and self-service environments. Measure adoption and developer feedback, and keep escape hatches for teams with real special needs.
37. How do you secure the software supply chain?
Pin dependencies, build in isolated ephemeral runners, generate SBOMs, sign artifacts and verify signatures at deploy, and track provenance using a framework such as SLSA. Restrict who can change pipeline definitions, because the pipeline itself is a target.
38. When would you not use containers?
For workloads that need special hardware access or kernel tuning that conflicts with shared hosts, for legacy apps where containerising adds risk without benefit, or when a managed service (serverless functions, managed databases) removes the need. Containers are a means, not a goal.
39. Single large Kubernetes cluster or many small ones?
One large cluster gives better bin packing and fewer things to upgrade, but a bigger blast radius and harder multi-tenancy. Many clusters isolate teams, regions and compliance zones at the cost of fleet management. Most large organisations land on a few clusters per environment and region, managed with GitOps.
40. How do you structure Terraform for a large organisation?
Reusable versioned modules, small state files per component and environment, policy as code checks in CI, a clear owner for each state, and drift detection. Plan how to upgrade providers across many states. Since 2023 Terraform is under the Business Source License; know that OpenTofu exists as an open-source fork if your company asks.
41. Configuration management or immutable images?
Immutable images (built with Packer or container builds) make servers identical and rollbacks simple. Configuration management still fits long-lived servers, network devices and estates where rebuilding is not practical. Many teams build images with Ansible and then never change running servers.
42. How do you design for a whole cloud region failing?
Decide recovery time and recovery point objectives per service first. Then choose backup and restore, pilot light, warm standby or active-active to match them. Replicate data, keep infrastructure as code ready for the second region, and run failover tests. Not every service needs active-active.
43. How would you design network segmentation for microservices?
Separate public, application and data tiers in different subnets, use security groups or firewall rules by role, add Kubernetes NetworkPolicies with default deny inside clusters, and use mTLS through a service mesh where you need service identity.
44. How do you introduce SLOs to teams that only watch CPU graphs?
Start with one user journey, define an availability and latency SLI from real request data, set a target the team can meet today, and alert on error budget burn rate. Use the error budget in planning: when it is spent, reliability work comes first.
45. How do you keep observability costs under control?
Set retention by data type, drop or sample high-volume debug logs, limit metric label cardinality, sample traces, and charge usage back to teams so they see the cost.
46. How do you run DevSecOps without slowing delivery?
Automate checks in the pipeline with clear severity thresholds, give developers fast feedback in their pull requests, provide secure base images and templates so the safe path is the easy one, and keep manual security reviews for high-risk changes only.
47. How do you decide what to automate first?
Pick tasks that are frequent, error-prone and well understood. Measure the time spent and incidents caused today, automate the highest-value one, and make sure someone owns the automation afterwards.
48. How do you run a blameless postmortem?
Write a timeline from facts, focus on how the system allowed the failure rather than who made the mistake, list contributing factors, and agree action items with owners and dates. Share it widely and track the actions to completion.
Scenario round
| Scenario | What a fresher should say | What an experienced or expert candidate should add |
|---|---|---|
| Production deploy failed and the site is down | Roll back to the last good version and tell the team | Rollback first, then compare the diff, check pipeline gates that missed it, write a postmortem, add a canary stage |
| Builds take 40 minutes | Find the slowest stage | Cache dependencies and layers, run tests in parallel, split the pipeline by changed paths, use bigger or more runners where cost is justified |
| A secret was pushed to a public repo | Tell security and remove it | Revoke and rotate the secret first, then rewrite history if needed, check access logs for misuse, add pre-commit secret scanning |
| Kubernetes node is NotReady | Check kubectl describe node | Check kubelet and container runtime logs, disk and memory pressure, cordon and drain if needed, and find why the node pool lacked headroom |
| Terraform plan wants to destroy a database | Do not apply | Find the cause (renamed resource, provider change, drift), use moved blocks or state commands, add prevent_destroy to critical resources |
How to prepare for your level
- Fresher: build one project end to end, such as a small app with a GitHub Actions pipeline that builds an image and deploys to a local Kubernetes cluster. Our DevOps project ideas for freshers list has options.
- 2 to 5 years: prepare three stories from your own work: something you built, an incident you handled, and something you improved with numbers.
- Expert: prepare one design you led, including what you would do differently. Read advanced DevOps interview questions for more design prompts.
Also useful: practical DevOps interview questions and 10 skills you need to crack DevOps interviews. Our DevOps training covers Linux, Git, CI/CD, Docker, Kubernetes, Terraform, Ansible and monitoring, in the Kharadi, Pune classroom and live online.
Frequently asked questions
How are DevOps interviews different for freshers and experienced candidates?
Freshers are asked definitions and how tools work, plus one project. Experienced candidates are asked what they built, ran and fixed. Experts are asked to design systems and defend trade-offs.
Which topics are asked at every level?
Linux, Git, CI/CD, containers, Kubernetes, infrastructure as code, cloud basics, monitoring and security. The depth changes with experience.
Do freshers need Kubernetes for DevOps interviews?
Basic knowledge helps: pods, deployments, services and kubectl. Linux, Git, one CI tool and Docker come first.
What are the DORA metrics?
DORA lists five: change lead time, deployment frequency, failed deployment recovery time, change fail rate and deployment rework rate.
How should experienced candidates answer scenario questions?
Restore service first, then explain diagnosis, root cause, the permanent fix and how you would prevent a repeat.
How many questions should I prepare?
Depth beats count. Be able to answer every question on this page for your level and the level above it in your own words.
Official references
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0