DevOps Interview Questions
Answers written to be said out loud in an interview — each with a common follow-up question and a link to the tutorial that explains it in depth.
- Beginner
- 9
- Intermediate
- 11
- Experienced
- 8
01Image vs container?Beginner
An image is a read-only template with the OS layer, runtime, code and dependencies. A container is a running instance of an image with its own writable layer.
02What is DevOps?Beginner
A set of practices and culture that brings development and operations together to deliver software faster and more reliably through automation, continuous integration and delivery, monitoring and shared ownership.
03Continuous integration vs continuous delivery vs continuous deployment?Beginner
CI merges and tests code frequently and automatically. Continuous delivery keeps every build releasable, with a manual approval to production. Continuous deployment releases every passing change automatically.
04What is a pull request?Beginner
A request to merge changes from one branch into another, used for code review, discussion and running automated checks before merging.
05What are the phases of the software development lifecycle?Beginner
Plan, design, build, test, release, deploy, operate and monitor — with feedback flowing back into planning. DevOps shortens this loop by automating builds, tests and deployments and by sharing ownership of production.
06What is Git, and why is it distributed?Beginner
Git is a version control system. Every clone has the full history, so you can commit, branch and view history offline, and there is no single point of failure. You sync with remotes using fetch, pull and push.
07What do the staging area and commits do?Beginner
git add moves changes into the staging area (index), choosing exactly what goes into the next snapshot. git commit records that snapshot with a message. Small, focused commits make history and reviews easier.
08What does GitHub add on top of Git?Beginner
Hosting for repositories plus collaboration: pull requests and code review, issues and projects, Actions for CI/CD, packages, security scanning (Dependabot, secret scanning, code scanning) and branch protection rules.
09What is YAML, and what are its common pitfalls?Beginner
A human-friendly data format used by pipelines, Kubernetes and Docker Compose. Indentation defines structure (spaces, never tabs), lists start with -, and unquoted values like yes, no or 1.10 may be parsed as booleans or numbers.
10Merge vs rebase?Intermediate
Merge preserves history and adds a merge commit. Rebase replays your commits on top of another branch for a linear history but rewrites commit hashes — never rebase commits others have pulled.
11Compare branching strategies.Intermediate
Trunk-based development uses short-lived branches merged to main frequently — great for CI/CD. GitFlow uses long-lived develop and release branches — suits scheduled releases but adds overhead.
12What is Docker Compose used for?Intermediate
Defining and running multi-container apps (API, database, cache) with one YAML file and one command, mainly for local development and testing.
13What are Kubernetes Pods, Deployments and Services?Intermediate
A Pod runs one or more containers. A Deployment manages replicas of Pods and rolling updates. A Service gives Pods a stable network address and load-balances between them.
14What is a GitHub Actions workflow?Intermediate
A YAML file in .github/workflows with triggers (on: push, pull_request, schedule), jobs that run on runners, and steps that run commands or reusable actions. Jobs run in parallel unless linked with needs.
name: ci
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 22, cache: npm }
- run: npm ci
- run: npm test
15What makes a good build pipeline?Intermediate
It is fast, deterministic and runs on every change: restore with lock files, build, lint, run unit tests, scan dependencies, and produce one versioned artifact or image that is promoted through environments unchanged.
16What is a release pipeline?Intermediate
The stages that take a built artifact through environments — dev, staging, production — with deployment jobs, configuration per environment, automated smoke tests, approvals and gates such as monitoring checks.
17How do you write a good Dockerfile?Intermediate
Use a small, pinned base image, multi-stage builds, copy dependency manifests before source code to maximise layer caching, run as a non-root user, add a .dockerignore and keep secrets out of the image.
18How do containers persist data?Intermediate
A container’s writable layer disappears when it is removed. Use named volumes (managed by Docker) for databases and bind mounts for development source code. In Kubernetes, use persistent volume claims.
19What is a container registry?Intermediate
A store for container images, such as Docker Hub, GitHub Container Registry, Azure Container Registry or Amazon ECR. Pipelines push tagged images; platforms pull them. Tag with the commit SHA, not only latest.
20What is Terraform state?Intermediate
A file mapping your configuration to real resources so Terraform can plan changes. Store it remotely (S3 + DynamoDB lock, Azure Storage, Terraform Cloud) with locking and encryption, and never edit it by hand.
21Blue-green vs canary deployments?Experienced
Blue-green runs two identical environments and switches all traffic at once, allowing instant rollback. Canary sends a small percentage of traffic to the new version first and increases it as metrics stay healthy.
22What is infrastructure as code and why use it?Experienced
Defining infrastructure in version-controlled files (Terraform, Bicep, CloudFormation) so environments are reproducible, reviewable, testable and can be recreated automatically.
23How do you manage secrets in CI/CD pipelines?Experienced
Store them in a secret manager (Key Vault, AWS Secrets Manager, GitHub encrypted secrets), prefer short-lived credentials via OIDC federation, mask them in logs and never commit them to the repository.
24What does DevSecOps add to a pipeline?Experienced
Security checks in every stage: dependency and container vulnerability scanning, static analysis (SAST), secret scanning, infrastructure policy checks and dynamic testing (DAST) — shifting security left.
25Logs vs metrics vs traces?Experienced
Logs are detailed event records, metrics are numeric time series for dashboards and alerts, and traces follow one request across services. OpenTelemetry collects all three; alert on symptoms users feel (error rate, latency), not every cause.
26Which tests belong in a CI pipeline?Experienced
A test pyramid: many fast unit tests on every commit, fewer integration tests against real dependencies in containers, a small set of end-to-end tests on critical journeys, plus static analysis and security scans. Flaky tests must be fixed or quarantined.
27How do you roll back a bad deployment?Experienced
Redeploy the previous artifact, swap back slots, shift traffic back in blue-green or canary setups, or use kubectl rollout undo. Database changes need backward-compatible migrations (expand and contract) so the old version still works.
28What does Azure DevOps offer compared with GitHub?Experienced
Azure Boards for work tracking, Repos, Pipelines (YAML with stages, environments and approvals), Test Plans and Artifacts feeds. It suits enterprises with existing Microsoft tooling; GitHub leads on open source and developer experience.