DevOps Interview Questions and Answers

38 questions with short, clear answers · Updated December 2026

DevOps interviews mix concepts, tools and troubleshooting. These questions cover the parts almost every DevOps engineer role asks about: the culture and metrics, Git, CI/CD pipelines, configuration management, monitoring and security, ending with the scenario questions where interviewers test how you think.

Docker, Kubernetes and Terraform have their own pages with deeper questions; this page covers how everything fits together.

DevOps concepts

Q1. What is DevOps?

DevOps is a way of working where development and operations share responsibility for building, releasing and running software. It combines culture (collaboration, shared ownership, learning from failures), practices (CI/CD, infrastructure as code, monitoring) and tools, with the goal of releasing small changes often, safely and reliably.

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

Continuous integration: developers merge small changes often, and every change is built and tested automatically. Continuous delivery: every change that passes the pipeline is ready to release, but going to production needs a manual approval. Continuous deployment: every change that passes all checks goes to production automatically, with no manual step.

Q3. What are the DORA metrics?

Four measures of software delivery performance from the DORA research: deployment frequency, lead time for changes (commit to production), change failure rate (share of deployments causing a failure) and time to restore service after a failure. Recent DORA reports also look at rework from unplanned deployments. Good teams deploy often with short lead times and still have low failure rates.

Q4. What is infrastructure as code, and why does it matter?

Infrastructure as code means defining servers, networks and other infrastructure in files (Terraform, CloudFormation, Bicep, Ansible) stored in Git. Environments become repeatable, changes are reviewed like code, drift can be detected, and a lost environment can be rebuilt quickly instead of by hand.

Q5. What is the difference between DevOps and SRE?

DevOps is a broad culture and set of practices. Site Reliability Engineering, which started at Google, is a specific way of doing operations with software engineering: it defines reliability with SLIs and SLOs, uses error budgets to balance speed and stability, limits manual toil, and runs blameless postmortems. SRE is often described as one concrete implementation of DevOps.

Q6. What is GitOps?

GitOps uses a Git repository as the single source of truth for the desired state of infrastructure and applications. An agent such as Argo CD or Flux runs in the cluster, compares the live state with Git and syncs any difference. Changes happen through pull requests, which gives review, an audit trail and easy rollback by reverting a commit.

Git and branching

Q7. What is the difference between git merge and git rebase?

Merge combines two branches with a merge commit and keeps the full history as it happened. Rebase replays your commits on top of another branch, giving a straight, linear history but rewriting commit IDs. Rebase your own local branch to tidy it up; do not rebase commits that others have already pulled.

Q8. What is the difference between git fetch and git pull?

git fetch downloads new commits and branches from the remote but does not change your working branch. git pull is fetch followed by a merge (or a rebase, if configured) into your current branch. Fetch first when you want to see what changed before integrating it.

Q9. How do you undo a commit that has already been pushed?

Use git revert <commit>, which creates a new commit that undoes the change, so the shared history is not rewritten. git reset moves the branch pointer back and is fine for local commits, but resetting and force-pushing a shared branch breaks other people's copies.

Q10. Compare Git Flow and trunk-based development.

Git Flow uses long-lived develop and release branches plus feature and hotfix branches; it suits software with planned versioned releases. Trunk-based development keeps everyone committing small changes to main (directly or through short-lived branches), with feature flags hiding unfinished work; it suits continuous delivery and is what most high-performing teams use.

Q11. How do you resolve a merge conflict?

Git marks the conflicting sections in the files with <<<<<<<, ======= and >>>>>>>. Edit each file to keep the correct combined code, remove the markers, run the tests, then git add the files and complete the merge or rebase (git commit or git rebase --continue). Talking to the other author is often the fastest way to get it right.

Q12. What are git stash and git cherry-pick used for?

git stash saves your uncommitted changes and cleans the working directory so you can switch branches, and git stash pop brings them back. git cherry-pick applies one specific commit from another branch onto the current branch, for example to bring a hotfix into a release branch.

CI/CD pipelines

Q13. What stages does a typical CI/CD pipeline have?

Checkout, build, unit tests, static analysis and security scans (SAST, dependency and secret scanning), build and scan a container image, push it to a registry, deploy to a test or staging environment, run integration or smoke tests, approval if needed, deploy to production, and verify with monitoring. Each stage fails fast so problems are caught early.

Q14. What is the difference between a declarative and a scripted Jenkins pipeline?

Both are written in a Jenkinsfile using Groovy. A declarative pipeline has a fixed structure (pipeline, agent, stages, steps, post) that is easier to read and validate, and is recommended for most pipelines. A scripted pipeline is plain Groovy code inside node blocks, more flexible but harder to maintain.

Q15. What are Jenkins agents, and why not run builds on the controller?

The controller schedules jobs, stores configuration and serves the UI; agents (static machines, Docker containers or Kubernetes pods) run the builds. Running builds on the controller risks its stability and security, because build scripts would have access to Jenkins itself, so the controller should have zero executors.

Q16. How does GitHub Actions work?

Workflows are YAML files in .github/workflows that run on events such as push, pull_request, a schedule or a manual trigger. A workflow has jobs, which run on GitHub-hosted or self-hosted runners, and each job has steps that run shell commands or reusable actions from the marketplace. Secrets and environments with protection rules control deployments.

Q17. How should a pipeline authenticate to a cloud provider?

Use OpenID Connect (OIDC) federation: the CI system gets a short-lived token, and the cloud (an AWS IAM role, an Azure federated credential or a GCP workload identity pool) trusts it for a specific repository and branch. This avoids storing long-lived access keys as pipeline secrets.

Q18. Explain blue-green, canary and rolling deployments.

Rolling replaces old instances with new ones a few at a time. Blue-green runs the new version (green) alongside the old (blue) and switches all traffic at once, so rollback is just switching back. Canary sends a small share of traffic, say 5%, to the new version, watches error rates and latency, then increases it gradually. Feature flags add another layer by turning features on per user.

Q19. What is an artifact repository, and why is it needed?

An artifact repository (Nexus, JFrog Artifactory, GitHub Packages, a container registry such as ECR or Harbor) stores versioned build outputs: JARs, packages and container images. Building once and promoting the same artifact through test, staging and production guarantees that what you tested is exactly what you release.

Configuration management with Ansible

Q20. What is Ansible, and why is it called agentless?

Ansible automates configuration, deployment and orchestration with YAML playbooks. It is agentless because it connects to managed machines over SSH (or WinRM for Windows) and runs modules there; nothing needs to be installed except Python on Linux targets. This makes it quick to adopt compared with agent-based tools such as Puppet or Chef.

Q21. What do inventory, playbook, role and handler mean in Ansible?

The inventory lists hosts and groups (static file or dynamic from a cloud). A playbook maps groups of hosts to tasks. A role packages tasks, templates, files, variables and handlers in a standard folder layout for reuse. A handler is a task that runs only when notified by a change, such as restarting Nginx after its config file changes.

Q22. What does idempotency mean in configuration management?

Running the same playbook once or ten times leaves the system in the same state. Modules check the current state first and change only what differs, reporting "ok" or "changed". Using the shell or command module breaks this unless you add conditions such as creates or changed_when.

Q23. How do you keep passwords out of Ansible code?

Encrypt sensitive variables with Ansible Vault and supply the vault password at run time from a file or the CI system, or look secrets up at run time from a secrets manager such as HashiCorp Vault, AWS Secrets Manager or Azure Key Vault. Use no_log: true on tasks that would otherwise print secrets.

Q24. When would you use Ansible and when Terraform?

Terraform is best for provisioning infrastructure (networks, VMs, databases, managed services) and tracking it in state. Ansible is best for configuring what runs inside servers and for orchestrating steps. A common pattern is Terraform to create the servers and Ansible to configure them, although with containers and images much of the configuration moves into Dockerfiles or Packer.

Monitoring, observability and SRE

Q25. What is the difference between monitoring and observability?

Monitoring watches known signals and alerts when they cross thresholds ("CPU above 90%"). Observability is the ability to understand why a system behaves as it does from its outputs, using metrics, logs and traces together, so you can investigate problems you did not predict. OpenTelemetry is the common open standard for collecting all three.

Q26. How do Prometheus and Grafana work together?

Prometheus scrapes metrics from targets over HTTP at regular intervals, stores them as time series and evaluates alert rules, sending alerts to Alertmanager for routing to Slack, email or PagerDuty. Grafana connects to Prometheus (and other sources such as Loki for logs) and shows the data on dashboards. PromQL is the query language.

Q27. What are SLI, SLO, SLA and an error budget?

An SLI is a measurement, such as the percentage of requests served successfully under 300 ms. An SLO is the target for it, such as 99.9% over 30 days. An SLA is a contract with customers, usually looser than the SLO, with penalties if missed. The error budget is what the SLO allows to fail (0.1%); while budget remains the team can ship faster, and when it runs out the focus moves to reliability.

Q28. What are the four golden signals?

From Google's SRE book: latency (how long requests take, separating successes from errors), traffic (demand, such as requests per second), errors (rate of failed requests) and saturation (how full the system is, such as CPU, memory or queue length). If you can only monitor four things for a user-facing service, monitor these.

Q29. What is a blameless postmortem?

After an incident the team writes down the timeline, impact, root causes and contributing factors, and action items to prevent it happening again, without blaming individuals. The assumption is that people acted reasonably with the information they had, so the fix goes into systems and processes rather than "be more careful".

DevSecOps

Q30. What does "shift left" mean in DevSecOps?

Moving security checks earlier in the lifecycle, into design, coding and the CI pipeline, instead of a security review just before release. Examples are pre-commit secret scanning, SAST and dependency scanning on every pull request, scanning images and infrastructure-as-code in CI, and threat modelling during design. Problems found early are cheaper to fix.

Q31. What is the difference between SAST, DAST and SCA?

SAST (static analysis) reads source code for insecure patterns without running it, for example SonarQube or Semgrep. DAST tests the running application from outside, like an attacker, for example OWASP ZAP. SCA (software composition analysis) checks third-party libraries for known vulnerabilities and licence issues, for example Dependabot, Snyk or Trivy.

Q32. What is an SBOM, and why is it asked about now?

A software bill of materials lists every component and version inside an application or image, in formats such as SPDX or CycloneDX. After supply-chain attacks such as the Log4Shell vulnerability, companies and governments ask for SBOMs so they can find out within minutes whether they are affected by a newly published vulnerability. Tools such as Syft or Trivy generate them in the pipeline.

Q33. A developer accidentally pushed an AWS key to GitHub. What do you do?

First revoke or rotate the key immediately; removing it from the repository is not enough because it is already exposed and bots scan GitHub within minutes. Check CloudTrail for any use of the key, remove it from the code and history (git filter-repo) if needed, and prevent a repeat with secret scanning and push protection, plus pre-commit hooks and roles or OIDC instead of keys.

Scenario questions

Q34. A deployment to production just failed and users see errors. What do you do?

Restore service first: roll back to the last good version (or switch traffic back in a blue-green setup, or turn off the feature flag), and communicate the status. Then look at the pipeline logs, application logs and metrics to find what changed, add a test or check that would have caught it, and write a blameless postmortem.

Q35. The CI pipeline takes 40 minutes. How would you speed it up?

Measure where the time goes first. Then cache dependencies and Docker layers, run independent jobs and test suites in parallel, run only the tests affected by the change where possible, use multi-stage builds and smaller base images, move slow end-to-end tests to a later stage or nightly run, and use bigger or more runners for the slowest steps.

Q36. A server's disk is 100% full and the application has stopped. How do you handle it?

Find what is using space with df -h and du -sh /* (or ncdu); also check for deleted files still held open (lsof +L1), which only free space when the process restarts. Usually it is logs: compress or remove old ones and set up logrotate. Then add disk-usage alerts at 80% and fix the root cause, such as a debug log level or a missing log rotation.

Q37. How would you design a pipeline for a microservices application on Kubernetes?

Each service has its own pipeline triggered by changes to its folder or repository: build, test, scan, build the image tagged with the commit SHA, push to the registry and update the image tag in a GitOps repository. Argo CD or Flux syncs the change to staging, automated tests run, and promotion to production happens by pull request, with canary rollouts and automatic rollback on bad metrics.

Q38. Developers say "it works on my machine" but fails in testing. How do you fix that?

Make environments identical and reproducible: run the application in containers with pinned versions, define dependencies in lock files, keep configuration in environment variables rather than code, build infrastructure with code, and use the same image from CI through production. Dev containers or Docker Compose give developers the same setup locally.

Learn DevOps hands-on

Knowing the answers is half the job; interviewers also ask what you have built. Technical Guftgu's DevOps training is taught in Hindi with live classes, labs and project work, plus resume and mock-interview help. We do not promise or guarantee job placement.

DevOps training near you

More interview questions

TECHNICAL GUFTGU

© 2026 Technical Guftgu. All rights reserved.