DevopsDevopsintermediate

DevOps Interview Questions and Answers

24 DevOps questions with short spoken answers, real commands and follow-up traps, grouped by fresher, 2 years and 5 years of experience.

Published
TL;DR – Quick Answer

DevOps interviews test Linux, Git, CI/CD, Docker, Kubernetes, infrastructure as code, cloud and monitoring. Freshers explain what each tool does, 2-year candidates explain pipelines they have run, and 5-year candidates explain design choices and incidents. A strong answer names the problem, the tool, the command you would use and one trade-off.

On This Page

Most DevOps interview questions test one thing: can you move code from a laptop to production safely, and fix it when it breaks? This page gives you 24 DevOps interview questions and answers. They are grouped by level, so you can start where you fit.

Each question opens with a short answer you can say aloud. The text after it helps with follow-ups.

How DevOps interview questions change with experience

Level Main topics What a good answer shows
Fresher Linux, Git, Docker, CI/CD basics You understand the idea and have tried it
2 years Pipelines, Kubernetes, Terraform You have run it and fixed common failures
5 years Design, security, cost, incidents You can choose, explain and lead

Use one pattern for every answer: problem, tool, steps, trade-off. For example, "Builds differed between laptops, so we used Docker. One image runs everywhere, but we now have to scan and update it."

Pro tip: Draw your last project as boxes: repository, build, tests, registry, cluster and monitoring. Interviewers often ask you to walk through exactly this picture.

DevOps questions for freshers

Q1. What is DevOps?

30-second answer: DevOps is a way of working where the people who write software and the people who run it share responsibility. They use automation, small releases and fast feedback to deliver changes safely.

Tools help, but they are not the definition. A team that has Jenkins and Kubernetes but still works in separate silos is not really doing DevOps.

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

30-second answer: Continuous integration builds and tests every merged change. Continuous delivery keeps each passing change ready to release. Continuous deployment releases each passing change to users with no manual approval.

The difference between the last two is one human decision before production.

Q3. Which Linux commands do you use to check a slow server?

30-second answer: I check load and CPU, then memory, disk space, disk activity and open ports. After that I read the service logs.

uptime
top
free -h
df -h
iostat -x 1 3
ss -tulpn
journalctl -u nginx --since "30 minutes ago"

iostat may need the sysstat package. df -h shows space, but a disk can also run out of inodes, the entries that track files. Check those with df -i. Practise with our Linux commands guide.

Q4. What is the difference between a Docker image and a container?

30-second answer: An image is a read-only package with the app and everything it needs. A container is a running instance of that image, with its own thin writable layer.

You can start many containers from one image. Data written inside a container is lost when the container is removed, unless you use a volume.

Q5. What is the difference between CMD and ENTRYPOINT?

30-second answer: ENTRYPOINT sets the program the container runs. CMD gives default arguments, or a default command when there is no ENTRYPOINT.

ENTRYPOINT ["python", "app.py"]
CMD ["--port", "8000"]

Here, docker run myapp --port 9000 replaces only the CMD part.

Q6. What is infrastructure as code?

30-second answer: It means describing servers, networks and permissions in files, then letting a tool create them. The files can be reviewed, versioned and reused.

Terraform mainly creates infrastructure. Ansible mainly configures machines that already exist. Their uses overlap, so say "mainly".

Q7. What happens when you type a URL in the browser?

30-second answer: DNS turns the name into an IP address. The browser opens a connection, sets up TLS for HTTPS and sends a request. A load balancer may pass it to a server, which returns the response.

Interview note: This question checks where you would look during an outage. Add one failure for each step, such as a wrong DNS record or an expired certificate.

Q8. Why does a DevOps engineer need Git?

30-second answer: Git holds the app code, pipeline files and infrastructure files. It records who changed what, allows review and gives a known version to return to.

Expect a short branch and merge discussion. Our Git interview questions cover that round.

DevOps interview questions for 2 years experience

Q9. Explain a CI/CD pipeline you have worked on.

30-second answer: A merge request starts a build, unit tests and a code scan. A passing merge builds one image, pushes it to a registry and deploys it to staging. After smoke tests and approval, the same image goes to production.

The key phrase is "the same image". Rebuilding for production means you ship something you did not test.

Q10. How do you make a Docker image smaller?

30-second answer: Use a small base image, a multi-stage build, a .dockerignore file and only runtime dependencies. Order the steps so that rarely changed layers stay cached.

FROM maven:3.9-eclipse-temurin-17 AS build
WORKDIR /src
COPY pom.xml .
RUN mvn -q dependency:go-offline
COPY src ./src
RUN mvn -q package

FROM eclipse-temurin:17-jre
WORKDIR /app
COPY --from=build /src/target/app.jar app.jar
USER 1001
CMD ["java", "-jar", "app.jar"]

This example assumes Maven names the output app.jar. The final image has no Maven, source code or JDK build tools.

Q11. What are a Pod, Deployment and Service?

30-second answer: A Pod runs one or more containers. A Deployment keeps the wanted number of Pods running and handles rollouts. A Service gives changing Pods one stable network address.

See Docker vs Kubernetes if you mix up running containers with managing them across machines.

Q12. A Pod is in CrashLoopBackOff. What do you do?

30-second answer: The container starts, exits and Kubernetes waits longer before each restart. I read the events, the previous logs and the exit code, then check configuration, probes and memory limits.

kubectl describe pod api-7c9d
kubectl logs api-7c9d --previous
kubectl get events --sort-by=.lastTimestamp

Exit code 137 means the process was killed with SIGKILL. Running out of memory is a common reason, so look for OOMKilled before you decide.

Common mistake: Deleting the Pod first. A replacement usually fails the same way, and you may lose useful evidence.

Q13. What is the difference between liveness and readiness probes?

30-second answer: When a liveness probe keeps failing, Kubernetes restarts the container. When a readiness probe keeps failing, the Pod stops getting Service traffic but is not restarted.

Do not make liveness depend on the database. A short database problem could restart every Pod and make the outage worse.

Q14. Why does Terraform need a state file?

30-second answer: State links each resource in the code to the real resource. Terraform compares code, state and the real system to build its plan.

Teams keep state in a remote, encrypted place with locking. State can contain secrets, so never commit it to a repository.

Q15. How do you store secrets?

30-second answer: Keep them outside code and images, in a secret manager. Give each service only the secrets it needs, rotate them and prefer short-lived credentials.

A Kubernetes Secret is base64 encoded, which is not encryption. Turn on encryption at rest and limit access with RBAC, which controls who can do what.

DevOps interview questions and answers for experienced engineers

DevOps interview questions and answers for experienced people are mostly open problems. State your assumptions before you pick a design.

Q16. Compare rolling, blue-green and canary deployments.

30-second answer: Rolling replaces instances in groups. Blue-green runs two full environments and switches traffic. Canary sends a small share of traffic to the new version first.

Method Strength Cost
Rolling Little extra capacity Two versions run together
Blue-green Fast traffic switch back Extra environment
Canary Limits users affected Needs good metrics

Q17. How do you handle a database change with zero downtime?

30-second answer: Use expand and contract. Add the new column, deploy code that works with both forms, copy old data, switch reads and remove the old column in a later release.

This keeps the old app version working during rollback. A rename in one step breaks whichever version expects the other name.

Q18. What are SLI, SLO and error budget?

30-second answer: An SLI is a measured result, such as the share of successful requests. An SLO is its target. The error budget is the failure allowed by that target.

A 99.9 percent target allows about 43 minutes of full downtime in 30 days. If the budget is used up, the team slows risky releases and fixes reliability.

Q19. How do you debug one slow service among many?

30-second answer: Use metrics to find when and where requests became slow, traces to find the slow call, and logs to find the reason. Compare the time with recent deployments.

Metrics show a pattern, traces follow one request, and logs give event details. A shared request ID joins them.

DevOps interview questions for 5 years experience

DevOps interview questions and answers for 5 years experience focus on ownership. Use real decisions from your work and do not invent numbers.

Q20. Production fails right after a release. How do you lead?

30-second answer: I confirm user impact, name an incident lead, stop further changes and roll back if that is safe. I share regular updates, verify recovery with metrics and then run a blameless review.

Restore service first. Find the full cause after users are safe. The review should produce actions with owners and dates.

Q21. How do you design a Kubernetes platform for several teams?

30-second answer: Separate teams with namespaces, RBAC, quotas and network policies. Give them standard templates, and use separate clusters where risk or rules demand stronger isolation.

Namespaces alone are not a full security wall. Explain which shared parts remain, such as nodes and the control plane. Also say who upgrades the cluster and how teams test their apps before the upgrade.

Q22. What is GitOps, and when would you avoid it?

30-second answer: In GitOps, Git holds the wanted state and an agent keeps the cluster matching it. It gives review, history and drift detection, which means spotting changes made outside Git.

It still needs an emergency process and a separate secret plan. It can be too much for one small app with rare releases.

Q23. How do you secure the software supply chain?

30-second answer: Protect branches, pin dependencies, scan code and images, build in isolated runners, sign artifacts and allow only trusted images to deploy.

Also remove long-lived cloud keys from pipelines. Short-lived identity tokens limit the damage from a leaked job log.

Q24. How do you reduce cloud cost without hurting reliability?

30-second answer: First tag and measure cost by service. Remove idle resources, match sizes to real use, set storage rules and then consider committed pricing for steady load.

Protect backups and spare capacity needed for failures. The AWS interview questions page helps you prepare the cloud details.

Interview note: Expect "what would you do differently?" after every project story. Give one honest improvement and the reason.

Scenario practice: solve these aloud

Try each one for two minutes before reading the hint. Say what you would check first and why.

Scenario Good first check
A pipeline passed yesterday and fails today with no code change Base image, dependency and runner changes
An app works by IP address but not by name DNS record and where the name is resolved
A Pod stays in Pending Events, free CPU and memory, taints, storage
Disk is full, but large files cannot be found Deleted files still held open by a process
Terraform wants to recreate a database Which argument forces replacement, before applying

Finish every scenario with prevention. An alert, a test or a safer default is stronger than "I would be careful next time".

How to prepare in 10 days

  1. Days 1-3: Revise Linux, networking, Git and one shell script.
  2. Days 4-6: Build an image, push it and deploy it to a local cluster. Break a probe, an image name and a memory limit on purpose.
  3. Days 7-8: Create and destroy one small environment with Terraform.
  4. Days 9-10: Practise two incident stories and draw one pipeline without notes.

If several topics are new, follow the DevOps engineer roadmap before booking interviews. Revise what a REST API is too, since health checks and load balancers use the same HTTP basics.

Frequently Asked Questions

What questions are asked in a DevOps interview?
Most rounds cover Linux, networking, Git, a CI/CD tool, Docker, Kubernetes, Terraform, one cloud and monitoring. After that you usually get a troubleshooting problem, such as a pod that keeps restarting or a deployment that broke production.
Do DevOps interviews include coding?
Many include a small scripting task in Bash or Python, such as reading a log file and counting errors. Long algorithm problems are less common, but the job description and the recruiter can tell you what to expect.
Can a fresher get a DevOps role?
Some companies hire trainees or junior cloud and support engineers who later move into DevOps. A fresher needs good Linux, Git, networking and Docker basics plus one project that builds, tests and deploys an app automatically.
Which cloud should I learn for a DevOps interview?
Pick the cloud named in the job posts you want. Learn its servers, networks, permissions, storage and managed Kubernetes well. The ideas carry over to other clouds even though the service names change.
How is a 5-year DevOps interview different from a 2-year interview?
At 2 years you are asked how you use pipelines, images and clusters. At 5 years you are asked why you chose a design, how you limit damage when it fails, how you control cost and access, and how you lead an incident.
Siva Prasad Galaba
Founder, CodeBegun · Staff Engineer

Founder of CodeBegun. 15+ years building Java systems at companies like Crunchyroll. Teaches Java, Spring Boot and system design the way the industry actually works, and mentors students through projects, mock interviews and placement preparation.

Technically reviewed by CodeBegun Technical TeamLast reviewed 3 December 2026 LinkedIn
Chat with us