Home / Blog / Programming / DevOps
Top 50 DevOps Interview Questions with Answers
Programming Β· DevOps Β· 50 min read
Fifty DevOps interview questions with answers, from Linux and Git to Kubernetes and Terraform. Plans on Terraform 1.9.8, rules on promtool 3.3.1.
How this sheet works
This sheet holds fifty DevOps interview questions, sorted by topic. The first four cover the fundamentals: what a DevOps engineer owns, how to prove a change helped, and where testing and security belong. Linux and networking troubleshooting follow, then Git, then pipelines and GitHub Actions. Docker and Kubernetes come after those, then Terraform, GitOps, and monitoring. AWS, production scenarios, and security close the sheet.
Three outputs on this page come from real runs. The Terraform plans ran with Terraform 1.9.8 and the AWS provider 6.72.0, offline, with dummy credentials and the provider's credential checks skipped. The Prometheus alert rules and the PromQL queries were checked with promtool 3.3.1. The Git sequences ran in a scratch repository, and the shell and DNS commands ran on a Linux machine. The YAML files were parsed and their fields checked.
Some commands could not run here, and the sheet says so where it matters. Docker commands need Docker, and this machine has none. The kubectl commands need a live cluster, and there is none. The AWS commands need an account, and the Argo CD commands need the Argo CD tool. The git filter-repo command needs the filter-repo tool, and the gitleaks scan needs gitleaks. Those snippets show the command and say what to look for in its output, instead of showing output that was never produced. The Kubernetes and Terraform fragments are shown as fragments, not as files to apply as they stand.
Take the questions in the order they come, one at a time. Answer each one aloud before you read the answer written here, then run the snippet beside it. Saying it and running it locks the idea in far better than reading the page from top to bottom.
There is no DevOps course on this site yet, so this sheet stands on its own. The Git Beginner course covers the Git ground, the Linux Beginner course covers the shell ground, and the Bash Beginner course covers scripting. The Top 50 System Design sheet covers the design half of the senior questions, and the Top 50 SQL sheet covers the database half.
1. What does a DevOps engineer actually own, end to end?
A DevOps engineer owns the path a change takes from a commit to production and back again.
That path starts when code is merged.
It runs through the build, the tests, the release, and the deploy.
It continues after the deploy, through monitoring, alerts, and incident response.
Ownership also covers the feedback loop, so a failure in production changes how the next change is shipped.
Tools are only the means to that end.
A pipeline, a cluster, and a dashboard are useful, but none of them is the job itself.
The job is accountability for whether a change reaches users safely and whether a failure is found and fixed fast.
Answering with a list of tools instead of an ownership boundary. "I use Docker and Kubernetes" says nothing about what you are accountable for.
2. How do you prove a DevOps change made things better?
Proof starts with four delivery numbers, measured before the change and after it.
The first number is how often the team ships to production.
The second number is how long a change takes to travel from commit to users.
The third number is how often releases fail in a way users notice.
The fourth number is how fast the team recovers when a release does fail.
A change has helped when those numbers move in the right direction together.
Shipping faster means little if releases fail more often.
Recovering faster matters as much as shipping faster, because failures are part of delivery.
Pick the numbers before you start the work, so the comparison is honest.
Quoting vanity numbers, such as the number of pipelines built or tickets closed, that do not measure delivery speed or recovery.
3. What is the difference between DevOps, SRE, and platform engineering?
DevOps is a way of working, built on shared ownership of delivery between the people who write code and the people who run it.
SRE is reliability engineering with numbers attached to it.
An SRE team sets a target for how reliable a service must be, measures whether it meets that target, and spends a fixed budget of allowed failure on shipping new work.
Platform engineering is building the paved road other teams ship on.
A platform team provides the shared pipeline, the standard deployment path, and the guardrails, so product teams do not each build their own.
The three overlap, but they answer different questions.
DevOps asks how a team ships together.
SRE asks how reliable the result must be.
Platform engineering asks what shared tools make both of those easier.
Treating the three as names for the same job, or claiming SRE is simply DevOps with more on-call duty.
4. Where do testing and security belong in a delivery pipeline?
Testing and security belong as early as the point where a mistake is still cheap to fix.
Lint checks and unit tests run on every commit, before anything is packaged.
Security scans run before the image is built, while the dependency list is still easy to change.
Policy checks run before the deploy, so a bad configuration never reaches production.
A bug found in production costs far more than the same bug found on a pull request.
The fix in production needs a hotfix, a deploy, and often an apology to users.
The fix on a pull request needs one more commit.
That cost curve is the whole reason to shift checks left.
Late testing is not a safety net. It is a bottleneck that every release must squeeze through.
Describing a pipeline that tests only at the end, or saying that security reviews the change later.
5. A server's disk is full and the app has stopped writing logs. How do you find what ate the disk?
Start with the filesystem, not with the application.
The disk-full check tells you which filesystem is full and how much room is left.
Then rank the top-level directories by size and follow the biggest one down, one level at a time.
The culprit is usually logs that were never rotated, or a journal that grew without a limit.
Do not delete anything until you know what the file is and which process owns it.
A file that a running process still holds open will not free any space when deleted.
The space only comes back when the process restarts or closes the file.
Check for held-open deleted files before you celebrate a cleanup.
Once the cause is known, fix the rotation or retention rule so the disk does not fill again next week.
Deleting files blindly, or deleting a file a running process still holds open, so the space never actually comes back.
df -h du -sh /* 2>/dev/null | sort -h du -sh /var/log/* 2>/dev/null | sort -h lsof | grep deleted
6. CPU is pinned at 100%. How do you tell whether it is the app, the traffic, or the box?
First find which process is actually burning the CPU.
A process list sorted by CPU usage names the suspect in seconds.
Then split the time into user time, system time, and waiting time.
High user time points at the application doing real work, or a runaway loop inside it.
High system time points at the kernel, often disk or network handling.
High waiting time means processes are stuck waiting, usually on disk, and the CPU number is misleading.
Next, compare the spike with traffic and with recent deploys.
A spike that starts with a deploy is a code change until proven otherwise.
A spike that follows traffic is load, not a bug.
A spike with no traffic change and no deploy points at the box itself, such as a runaway cron job or a noisy neighbour on a shared host.
Do not restart anything until you know which of the three it is, because a restart destroys the evidence.
Restarting the box first and destroying the evidence, or blaming the application when the load is a runaway cron job or a noisy neighbour.
uptime ps aux --sort=-%cpu | head vmstat 1 5 systemctl status <service-name>
7. The app is running, but nothing can reach it. Walk the path from the outside in.
Work layer by layer, from the outside in, and stop at the first layer that fails.
First check that the name resolves to an address.
A DNS failure means no packet ever leaves the client, so nothing downstream matters yet.
Next check that the load balancer answers at all.
Then check that the ingress routes the request to the right service.
Then check that the service has endpoints, meaning healthy pods behind it.
Then check that the pod itself is ready and listening.
Only then look inside the application.
Each layer has one command that answers one question, so a failure points at exactly one place.
Jumping to the application first wastes the whole investigation when the break is in the network path.
Jumping straight to restarting pods, or checking the application before confirming that a network path to it even exists.
dig example.com curl -v https://example.com kubectl get ingress,svc,endpoints kubectl get pods kubectl describe pod <pod-name> kubectl logs <pod-name>
8. A service only fails for some users, in one region. What do you check?
Split the problem by geography before touching the code.
Ask the DNS resolver in the affected region what address it returns.
A wrong or stale regional answer explains why only those users fail.
Next check the health of the content-delivery edge in that region.
Then check the regional load balancer and the cloud provider's status for that zone.
Routing and peering problems also show up this way, and they look exactly like an application bug from the outside.
Reproduce the failure from inside the affected region, with a synthetic check or a machine in that region.
A health check run from your own region will happily report green while users elsewhere fail.
Only when every regional layer answers correctly do you look at the application.
Treating it as an application bug and redeploying globally, or trusting a health check that runs in a single region.
dig @<regional-resolver> example.com curl -I https://example.com
9. Merge or rebase β how do you choose, and what must you never rebase?
Merge and rebase both combine branches, but they leave different histories behind.
A merge keeps the full story, including the branch point and the merge commit.
A rebase rewrites the branch onto the tip of the target, leaving one clean straight line.
Use a merge when the branch is shared, because shared history must stay stable for everyone who pulled it.
Use a rebase for private work nobody else has pulled yet, because a linear history is easier to read and to bisect later.
Never rebase a branch your teammates have already pulled.
Their local copies still point at the old commits, and your rewritten branch will strand them.
If a rebase is needed on a private branch, push it with the lease flag, which refuses to overwrite work someone else pushed since you last fetched.
A rebase can stop on a conflict when the same lines changed on both sides. Resolve the conflict, then continue the rebase before pushing.
Rebasing a branch teammates already pulled, then force-pushing and stranding their work.
git log --oneline --graph -10 git checkout feature-branch git rebase main git push --force-with-lease
10. A bad commit is already live on the shared branch. How do you undo it safely?
Add a new commit that reverses the bad one, instead of erasing history.
The revert command creates that commit for you, with a message recording what it undoes.
History stays intact, so everyone can see what happened and why.
The fix itself goes through review and CI like any other change, which catches a bad revert before it ships.
The bad commit remains in the log, and that is a feature, not a flaw.
An audit trail that shows the mistake and its correction is worth more than a clean-looking history.
Rewriting the shared branch would force every teammate to repair their local copy.
A revert asks nobody to do anything except pull normally.
Rewriting the shared branch to erase the commit, which leaves everyone else's local copy diverged from the remote.
git revert <commit-sha> git log --oneline -3 git push
11. How do you find the exact commit that broke production?
Bisect the range between the last good deploy and the first bad one.
The tool tests the midpoint of that range and asks whether it is good or bad.
Each answer halves the range, so a hundred commits take about seven tests.
The test at each step should be automatic, such as a single command that fails on the broken behaviour.
A manual check at every step is slow and invites mistakes.
When one commit is left standing, that commit introduced the failure.
Then you can read its diff with full context, instead of guessing through dozens of changes.
Reading through dozens of commits by hand, or guessing from the most recent change.
git bisect start git bisect bad <first-bad-sha> git bisect good <last-good-sha> git bisect run ./test.sh git bisect reset
12. What branching model fits a team that ships several times a day?
Short-lived branches off one main line fit a team that ships several times a day.
A branch lives for hours, not weeks, and merges back as soon as its change is reviewed.
Feature flags hide unfinished work from users, so a merge does not have to mean a release.
Continuous integration gates every merge, so the main line stays deployable at all times.
Long-lived release branches slow this kind of team down.
Each branch drifts from the others, and merging them back becomes a project of its own.
The heavy multi-branch model suits a regulated release train, where a version must be frozen and audited.
It does not suit a team whose value comes from shipping small changes fast.
Recommending a heavy multi-branch model, such as feature to develop to release to main, for a team that needs daily shipping, or the reverse for a regulated release train.
13. Walk through a complete pipeline, from push to production.
A push opens the pipeline, and each stage hands a concrete artifact to the next one.
First the code is checked out and linted, so style and syntax errors fail fast.
Then the unit tests run, and the pipeline stops if any of them fail.
A security scan follows, checking dependencies for known vulnerabilities before anything is packaged.
The build then produces one immutable image, tagged with the commit SHA, so the image and the code are linked forever.
That image is pushed to the registry, and the staging deploy pulls the exact same tag.
Staging is verified, and a human approval gate holds the production deploy until someone confirms it.
Production deploys the same image, runs a smoke test, and hands over to monitoring.
What stops the line matters as much as what moves it: a failed test, a failed scan, or a withheld approval all halt the pipeline before users are affected.
Listing stages without saying what passes between them, such as the artifact, the image tag, or the approval, or what stops the line.
name: ci-cd
on:
push:
branches: [main]
jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm run lint
- run: npm test
build-push:
needs: lint-test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/build-push-action@v6
with:
push: true
tags: ghcr.io/example/app:${{ github.sha }}
deploy-staging:
needs: build-push
runs-on: ubuntu-latest
environment: staging
steps:
- run: kubectl set image deployment/web web=ghcr.io/example/app:${{ github.sha }}
deploy-production:
needs: deploy-staging
runs-on: ubuntu-latest
environment: production
steps:
- run: kubectl set image deployment/web web=ghcr.io/example/app:${{ github.sha }}
- run: ./smoke-test.sh14. What is the difference between delivering continuously and deploying continuously?
Continuous delivery means every passing change could go live, and a person approves the last step.
Continuous deployment means every passing change does go live, with no human in the loop.
The difference is a single decision point, but it changes everything about risk.
Delivery keeps a human at the switch, which suits teams that need a business sign-off or a maintenance window.
Deployment removes the human, which suits teams that trust their tests and their automated rollback.
Neither is better in the abstract.
The right choice depends on how much risk the team can absorb if a bad change ships, and on how fast it can detect and reverse one.
Claiming full auto-deploy without naming those safety nets is a red flag.
Using the two terms interchangeably, or claiming full auto-deploy without naming the safety nets it requires.
15. How do you deploy a new version without dropping a single request?
Keep the old version and the new version running side by side.
Traffic only reaches pods that report themselves ready, through a readiness probe.
A pod that has started but is not ready yet receives no traffic, so slow startup harms nobody.
When a pod is told to stop, it gets a grace period to finish the requests it already holds.
A pre-stop hook tells the load balancer to stop sending it new work before the process exits.
The database change matters just as much as the traffic handling.
A migration that renames a column will break the old pods still serving traffic, so the schema change must stay backward-compatible until the rollout finishes.
Assuming a rolling update alone is enough. Without readiness probes and graceful shutdown, in-flight requests still die.
spec:
terminationGracePeriodSeconds: 30
template:
spec:
containers:
- name: web
image: app:abc1234
lifecycle:
preStop:
exec:
command: ["sleep", "5"]
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 516. Blue-green or canary β which one, and what decides it?
Blue-green runs two full copies of the environment and swaps all traffic from one to the other at once.
The swap is instant, and the rollback is just as instant, because the old copy is still standing.
The price is double infrastructure for the duration of the switch.
Canary exposes the new version to a small slice of users first, then widens the slice while watching real error rates.
The price is time and measurement, because a canary is useless without a clear signal.
Pick blue-green when the change is risky but the budget allows two environments, and when instant rollback matters most.
Pick canary when you want real-user evidence before committing, and you can measure error rate and latency for the canary slice.
What decides it is how much risk you can afford to expose, and how much you are willing to pay to limit it.
Picking canary without naming how you measure it, such as error rate and latency over a set window, or picking blue-green without counting the doubled infrastructure.
deploy-canary:
needs: build-push
runs-on: ubuntu-latest
environment: production
steps:
# Second release, 10% of traffic, same image as staging.
- run: helm upgrade --install app-canary ./chart
--set image.tag=${{ github.sha }}
--set trafficWeight=10
# Watch the canary error rate, then promote or remove it.
- run: ./check-canary.sh
- run: helm upgrade --install app ./chart
--set image.tag=${{ github.sha }}17. A database change has to ship with the code change. How do you do it without downtime?
Expand first, then contract, across two separate releases.
In the first release, add the new column or table while the old code still works.
Nothing is removed, so old and new code can run side by side.
In the second release, ship the code that uses the new shape.
Only in a third release, after the old code is gone, remove the old column or table.
A destructive migration must never run in the same deploy as the code that depends on the new shape.
The migration should also run as its own pipeline job, before the deploy job starts.
That way a failed migration stops the deploy, instead of leaving the database half-changed under new code.
Running a drop-column or rename migration in the same deploy as the code that depends on the new shape.
migrate:
runs-on: ubuntu-latest
environment: staging
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npx prisma migrate deploy
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
deploy:
needs: migrate
runs-on: ubuntu-latest
environment: staging
steps:
- run: kubectl set image deployment/web web=ghcr.io/example/app:${{ github.sha }}18. Your workflow passes on a contributor's fork but fails in the main repo. What is wrong?
Fork pull requests do not receive the repository's secrets.
That is a deliberate safety rule, so a stranger's code cannot print out a credential.
The workflow that passes on the fork may be skipping the step that needs a secret, or failing only where the secret is required.
Branch protection and environment rules also differ between the fork and the main repo.
An environment gate that requires a reviewer in main may not exist on the fork at all.
Compare the failing step in both runs, line by line.
Then check the secrets list, the workflow permissions, and the environment gates in the main repo.
The fix is never to paste a secret into the workflow file.
Assuming the code is broken, or fixing the failure by copying a secret into the workflow file.
# This block exists in main. A fork PR never sees these secrets,
# so any step using them fails there and only there.
permissions:
contents: read
packages: write
jobs:
deploy:
runs-on: ubuntu-latest
environment: production # approval gate: a reviewer must approve
steps:
- run: kubectl set image deployment/web web=ghcr.io/example/app:${{ github.sha }}19. What is the difference between an image and a container β and why does it matter for rollbacks?
An image is the frozen, versioned artifact that holds the code, its dependencies, and its configuration.
A container is a running instance of that image, with its own processes and its own writable layer.
One image can produce many containers, and each container starts from exactly the same files.
Images are immutable, so an image built from a commit never changes afterwards.
That immutability is what makes rollbacks simple.
Rolling back means running the previous image again, with the tag that points at the earlier commit.
The tag is the link between a running container and the code that built it.
Break that link, and nobody can say which code is actually running in production.
Tagging everything `latest`, which destroys the one-to-one link between a running container and the code that built it.
docker build -t app:abc1234 . docker images app docker run -d --name web app:abc1234 docker ps
20. How do you shrink a Docker image and make it safer at the same time?
Build in one stage and ship in another.
The build stage carries the full toolchain: the compiler, the test runner, and every build-time dependency.
The final stage copies only the built output into a minimal base image, such as a slim or Alpine variant.
Build tools never reach production, so the image is smaller and the attack surface shrinks with it.
Run the container as a non-root user, so a compromise inside the container buys less.
Leave no secrets in any layer, because every layer is stored in the image history forever.
A `.dockerignore` file keeps stray files, such as local credentials and test data, out of the build context.
Finish with an image scan in the pipeline, so a vulnerable dependency fails the build instead of shipping.
Putting the build tools in the final image, running as root, or baking a credential into a layer where it stays in history forever.
FROM node:22 AS build WORKDIR /app COPY package*.json ./ RUN npm ci COPY . . RUN npm run build FROM node:22-alpine WORKDIR /app COPY --from=build /app/dist ./dist COPY package*.json ./ RUN npm ci --omit=dev USER node CMD ["node", "dist/index.js"]
21. A container keeps crashing on start. What do you check, in order?
Check the exit code and the logs first, before changing anything.
The exit code tells you whether the process was killed, crashed, or exited on its own.
The logs usually name the failure directly, such as a missing file or a refused connection.
Next check the start command and the environment variables.
A wrong entrypoint or a missing variable is the most common cause of a start loop.
Then check the mounts and the resource limits.
A missing config file mount or a memory limit below what the app needs will kill a container at the same point every time.
Rebuilding the image before reading the logs only hides the evidence and wastes a cycle.
Rebuilding the image before reading the logs, or changing the application when the real fault is a missing environment variable or a bad entrypoint.
docker ps -a docker logs web docker inspect web
22. How do containers on the same host talk to each other β and how do you keep them apart?
A user-defined network gives containers DNS names for each other.
A web container can reach the database as `db`, with no IP address written anywhere.
Separate networks isolate containers from each other.
A database on its own network cannot be reached by a container that is not on that network.
Published ports are the only door to the outside world.
A port that is not published is invisible from the host and from other networks.
Hardcoded IP addresses break this whole model, because container addresses change on every restart.
Linking containers by hardcoded IP addresses, or exposing every container's port on the host.
docker network create app-net docker network create db-net docker run -d --name web --network app-net app:abc1234 docker run -d --name db --network db-net postgres:16 docker network inspect app-net
23. What actually happens when you run `kubectl apply`?
The client sends the desired state to the API server as a single request.
The API server authenticates the request and checks that the caller is allowed to make it.
Then it validates the object against the schema for that resource type.
If the object is valid, the API server stores it as the new desired state.
Storing the object does not create a pod by itself.
Controllers watch for the gap between desired state and actual state and work to close it.
The Deployment controller creates a ReplicaSet, the ReplicaSet controller creates Pod objects, and the scheduler picks a node for each pod.
Finally the kubelet on that node starts the containers.
Saying "Kubernetes creates the pod" as one step. The interviewer wants the control-plane chain, not the command.
24. Deployment, StatefulSet, or DaemonSet β how do you choose?
A Deployment fits interchangeable stateless replicas, such as a web tier.
Every replica is identical, and any one of them can be replaced by another without anyone noticing.
A StatefulSet fits workloads where each pod needs its own identity.
A database is the classic case: each pod needs a stable name, an ordered startup, and its own persistent volume that follows it across restarts.
A DaemonSet fits work that must run exactly once on every node, such as a log collector or a monitoring agent.
Adding a node automatically adds a pod, and removing a node removes it.
Putting a database on a plain Deployment is the common mistake.
A reschedule gives it a new name and no guarantee of its old volume.
Putting a database on a plain Deployment and losing its identity and volume on reschedule, or using a StatefulSet for a stateless web tier.
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
replicas: 3
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: app:abc1234
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: db
spec:
serviceName: db
replicas: 3
selector:
matchLabels:
app: db
template:
metadata:
labels:
app: db
spec:
containers:
- name: db
image: postgres:16
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 10Gi25. A pod is stuck in CrashLoopBackOff. Walk through your diagnosis.
Describe the pod first, because the events list the reason for each restart.
The description shows the exit code, the restart count, and the last state change.
Next read the logs, including the logs of the previous crashed container.
The previous container's output is where the fatal error usually lives.
Then check the probes.
A liveness probe that fails on a slow-starting app will kill the container before it ever gets going.
Then check the image, the mounts, and the secrets.
A wrong image tag, a missing config mount, or a secret that does not exist will crash a pod at the same point every time.
Finally check the resource limits, since a memory limit below the app's needs kills it with an out-of-memory error.
Change one thing at a time, so you know which fix actually worked.
Deleting the pod and hoping, or editing the deployment before knowing whether the fault is the app, the image, the config, or the probes.
kubectl describe pod <pod-name> kubectl logs <pod-name> --previous kubectl get events --sort-by=.metadata.creationTimestamp
26. The app answers on its pod IP but not through its Service. Where is the break?
A Service is a stable front door for a set of pods.
The pod IP works, so the app itself is running and listening.
The Service routes only to pods its selector matches.
A label spelled differently on the pod and on the selector breaks the match silently.
The endpoints list is the proof of that match.
An empty endpoints list means no pod was selected, even though the pods exist.
Readiness also matters here.
A pod that fails its readiness check is removed from the endpoints list, so traffic never reaches it.
The port mapping is the last link in the chain.
A Service port that points at the wrong targetPort sends traffic to a port where nothing listens.
Recreating the Service or redeploying the app before checking whether any endpoints exist at all wastes the one check that names the fault.
Look for the endpoints list: it should name the pod IPs and the target port. If the list is empty, compare the Service selector in the describe output with the labels on the pods. A mismatch there is the break.
kubectl get endpoints web --namespace production kubectl get pods --show-labels --namespace production kubectl describe svc web --namespace production kubectl get endpoints web --namespace production -o yaml
27. Liveness probe or readiness probe β and what goes wrong when you mix them up?
A liveness probe asks whether a container is stuck badly enough to need a restart.
A readiness probe asks whether a pod should receive traffic right now.
The two probes answer different questions, so they need different settings.
A liveness probe that is too eager restarts a container that was only starting slowly.
A readiness probe that is too strict keeps a healthy pod out of rotation for no reason.
The classic mistake is pointing a liveness probe at a dependency.
A database that answers slowly then kills every pod in turn, because each pod is restarted for a fault that is not its own.
Slow-starting apps need a generous initial delay on liveness.
Readiness can stay strict, because removing a pod from traffic is cheap and safe.
Pointing both probes at the same heavy endpoint, or using a liveness probe on a dependency, turns a slow dependency into a restart loop across the whole Deployment.
Look for pods staying in Running without repeated restarts, and for the readiness gate holding traffic back until `/ready` returns success. Frequent restarts with a healthy app point at the liveness probe, not the app.
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 3
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
failureThreshold: 228. How do you scale a Kubernetes workload β and what breaks first when traffic spikes?
Horizontal scaling adds pods when demand rises.
The HorizontalPodAutoscaler watches a metric, such as CPU use, and changes the replica count between a floor and a ceiling.
Node scaling is the second layer.
Pods cannot be scheduled when no node has room for them, so the cluster autoscaler adds nodes.
The real limit is often neither pods nor nodes.
A database connection pool fills up long before the pods run out of CPU.
Downstream services also have their own rate limits, and a flood of new pods can trip them.
Pod startup time is the hidden delay in the whole chain.
A pod that takes a minute to become ready cannot absorb a spike that arrives in seconds.
A PodDisruptionBudget protects capacity during rollouts and maintenance.
It guarantees a minimum number of pods stays available while the rest are replaced.
Adding replicas while the database connection pool or a single-threaded dependency is the actual bottleneck leaves the spike unhandled and the database worse off.
Look for the replica count rising as CPU crosses the target, and for at least the budgeted minimum staying available during a rollout. If replicas rise but errors stay high, check database connections and downstream limits next.
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: web-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: web
minReplicas: 3
maxReplicas: 20
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: web-pdb
spec:
minAvailable: 2
selector:
matchLabels:
app: web29. What happens when you run `terraform apply` β and what is the state file for?
Terraform is a tool that builds infrastructure from written configuration.
An apply starts by reading the configuration and the current state file.
It compares the two and works out the difference between what exists and what is wanted.
That difference is shown as a plan before anything changes.
The plan is the safety net.
It lists every resource to be created, changed, or destroyed, so a bad change can be caught before it runs.
The plan below ran with the backend block left out and local state, and with the provider's credential checks skipped, so it needs no AWS account. The backend block above is the production shape. The plan output is the same either way, because the backend only changes where state lives.
Only after approval does Terraform call the provider APIs to close the gap.
The state file is the map between the configuration and the real world.
It records which real resource corresponds to each block in the configuration, so the next plan knows what already exists.
Without state, Terraform would try to create everything again on every run.
Calling the state file a backup or a config file, or saying apply edits resources directly without a plan, misses the whole point of the tool.
terraform {
required_version = ">= 1.5"
backend "s3" {
bucket = "acme-terraform-state"
key = "web/terraform.tfstate"
region = "us-west-2"
dynamodb_table = "acme-terraform-locks"
encrypt = true
}
}
provider "aws" {
region = "us-west-2"
}
resource "aws_s3_bucket" "logs" {
bucket = "acme-app-logs"
}
Output:
Terraform will perform the following actions:
# aws_s3_bucket.logs will be created
+ resource "aws_s3_bucket" "logs" {
+ acceleration_status = (known after apply)
+ acl = (known after apply)
+ arn = (known after apply)
+ bucket = "acme-app-logs"
+ bucket_domain_name = (known after apply)
+ bucket_namespace = (known after apply)
+ bucket_prefix = (known after apply)
+ bucket_region = (known after apply)
+ bucket_regional_domain_name = (known after apply)
+ force_destroy = false
+ hosted_zone_id = (known after apply)
+ id = (known after apply)
+ object_lock_enabled = (known after apply)
+ policy = (known after apply)
+ region = "us-west-2"
+ request_payer = (known after apply)
+ tags_all = (known after apply)
+ website_domain = (known after apply)
+ website_endpoint = (known after apply)
+ cors_rule (known after apply)
+ grant (known after apply)
+ lifecycle_rule (known after apply)
+ logging (known after apply)
+ object_lock_configuration (known after apply)
+ replication_configuration (known after apply)
+ server_side_encryption_configuration (known after apply)
+ versioning (known after apply)
+ website (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.30. Two engineers run `terraform apply` at the same time. What goes wrong, and how do you prevent it?
State locking is the mechanism that stops two applies from writing the same state file at once.
Both engineers start from the same state, so each plan looks correct on its own.
Each apply then writes its own version of the state back.
The second write overwrites the first, and Terraform loses track of what the first apply created.
The result is orphaned resources that exist in the cloud but not in state, and a next plan that tries to recreate them.
A remote backend with locking prevents this entirely.
The first apply takes the lock, and the second apply waits or fails with a clear lock message instead of corrupting state.
Git is not a lock and not a backend.
Storing state in Git, or in a local file on a shared drive, gives no locking at all.
The fix is structural, not social.
Coordination by chat message fails the first time someone forgets to send it.
Storing state in Git, or in a local file shared over a drive, and assuming the team will coordinate is how state corruption happens.
Look for the second apply failing fast with a lock message naming who holds the lock, instead of running. If an apply is genuinely stuck, `terraform force-unlock` with the lock ID releases it, but only after confirming no apply is actually running.
terraform {
backend "s3" {
bucket = "acme-terraform-state"
key = "web/terraform.tfstate"
region = "us-west-2"
dynamodb_table = "acme-terraform-locks"
encrypt = true
}
}31. An apply dies halfway through. How do you recover without making it worse?
A failed apply leaves the infrastructure half built.
The first move is to stop and read the state, not to start deleting things.
State records exactly which resources were created before the failure and which were not.
Fix the cause of the failure first, whether it is a bad value, a missing permission, or a quota limit.
Then run apply again.
Terraform reconciles from state, so the second run finishes what the first started instead of duplicating it.
Resources already created are left alone, and only the missing ones are built.
The state commands need a state file to exist first. In a fresh directory with no state yet, `terraform state list` fails, so run an apply before listing state.
Hand-deleting a resource that state still tracks makes the problem worse.
The next plan then sees a resource that should exist but does not, and may recreate it in a surprising way.
Editing the state file by hand is the last resort, not the first step.
The `import` command is the safe route for anything created outside Terraform, because it records the real resource in state without touching the cloud.
Hand-deleting resources the state still tracks, or editing the state file by hand to fix it, turns a recoverable failure into a corrupted one.
Look for the plan showing only the missing resources to add, with the already-created ones unchanged. If the plan proposes recreating something that exists, check state before applying.
terraform plan terraform state list terraform import aws_s3_bucket.logs acme-app-logs terraform apply
32. Your plan takes twelve minutes and the state file is huge. What do you do?
A huge state file means one plan is responsible for too much infrastructure.
The fix is to split the blast radius.
Break the single root into smaller roots, one per service or layer, each with its own state file.
Each plan then looks at a fraction of the resources and finishes in a fraction of the time.
A smaller root also limits the damage of a bad apply.
Dead resources make the problem worse, so prune anything the plan shows that no longer exists or is no longer used.
Refreshing state on every plan is another drag.
Terraform contacts the provider for every resource by default, so a targeted plan or a skipped refresh speeds up the common case.
Adding parallelism or a bigger machine does not fix the root cause.
It papers over a plan that is simply looking at too much.
Adding more parallelism or a bigger machine instead of shrinking what one plan has to look at leaves the slow plan slow and the blast radius just as wide.
Look for the split roots each planning in seconds rather than minutes, and for the targeted plan touching only the named resource. The `moved` block keeps the resource tracked under its new address without recreating it.
# Before: one root holds web and billing together.
# After: billing moves into its own module, keeping its state.
module "billing" {
source = "./modules/billing"
}
moved {
from = aws_s3_bucket.billing_logs
to = module.billing.aws_s3_bucket.logs
}
terraform plan -refresh=false
terraform plan -target=aws_s3_bucket.logs33. How do you keep infrastructure changes reviewable and safe?
Reviewable infrastructure starts with pull requests.
Every change goes through a pull request, and the plan for that change is posted on it for reviewers to read.
A plan nobody reads is not a review.
Modules keep the change small and consistent.
A reusable module hides the repeated detail, so a pull request shows the few values that actually changed.
Variables and outputs are the contract of a module.
They say what goes in and what comes out, so callers do not need to know the internals.
Policy checks run before apply, not after.
They catch a public bucket or an unencrypted volume while the change is still a pull request.
Manual console changes break the whole model.
A change made by hand in the console drifts from the configuration, and the next plan either overwrites it or fails on it.
Applying from a laptop, or merging a plan nobody read because the diff was 2,000 lines of generated noise, is how unreviewed infrastructure reaches production.
Look for the plan comment on the PR showing resources to add, change, or destroy, and for reviewers approving that plan before any apply runs. A PR with no plan comment has not been reviewed.
# modules/s3-logs/main.tf
variable "bucket_name" {
type = string
}
resource "aws_s3_bucket" "this" {
bucket = var.bucket_name
}
output "bucket_arn" {
value = aws_s3_bucket.this.arn
}
- name: Terraform plan
run: terraform plan -no-color
- name: Post plan on PR
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: "Terraform plan posted for review."
})34. What does GitOps actually change about how you deploy?
GitOps is a deployment model where Git is the single source of truth for the desired state of a system.
An operator runs inside the cluster and watches that Git repository.
It compares the live cluster with the desired state in Git, and syncs the cluster toward Git when they differ.
A deploy becomes a pull request.
The change is reviewed, merged, and then the operator picks it up without anyone running a deploy command.
A rollback becomes a revert.
Reverting the commit in Git returns the cluster to the previous state through the same loop.
Drift gets detected automatically.
A hand edit in the cluster shows up as a difference from Git, instead of sitting unnoticed until the next deploy.
Running `kubectl apply` from a pipeline is not GitOps.
That is a push model, where the pipeline writes to the cluster and nothing reconciles afterwards.
Calling any pipeline that runs `kubectl apply` GitOps misses the reconcile loop: if the cluster is pushed to, rather than pulled toward Git, drift goes undetected.
35. Argo CD says your app is OutOfSync. What do you do?
OutOfSync is a report that Git and the cluster disagree.
The first step is to see the exact difference.
The diff names which fields differ, on which resources, and in which direction.
That diff decides the next move.
If Git is right, sync the app and the operator applies the Git state to the cluster.
If the cluster was hand-edited, the fix is to revert that edit, not to sync a broken state into Git.
Either way, find out who changed the cluster outside Git.
A hand edit that goes unrecorded will happen again, and the next OutOfSync will look the same.
Blind syncing is the dangerous option.
It applies a difference nobody has read, and it can overwrite a deliberate emergency fix.
Hitting sync blindly, or editing the cluster by hand again to fix the diff, repeats the exact drift that caused the warning.
Look for the diff naming the changed fields, then for the sync reporting the app as Synced and Healthy. If the diff shows a field nobody recognises, trace it to the hand edit before syncing.
argocd app diff web --namespace argocd argocd app sync web --namespace argocd kubectl get deployment web --namespace production -o yaml
36. A Helm upgrade times out and the release is stuck. How do you get out?
A Helm release is a versioned install of a chart, with a history of every revision.
A timeout usually means the new pods never became ready.
Check the probes first, then the image tag, then resources, then missing Secrets or ConfigMaps.
One of those four is almost always the cause.
Helm keeps the history, so rollback is the safe exit.
Rolling back returns the release to the last good revision, with its old pods and old values.
Re-running the upgrade without fixing the cause repeats the timeout.
Deleting the release is worse, because it destroys the rollback history along with the release.
The safe retry uses atomic mode with a wait and a timeout.
If the upgrade fails again, Helm rolls back automatically instead of leaving a half-upgraded release behind.
Re-running the upgrade repeatedly, or deleting the release and losing the rollback history, turns a stuck release into an unrecoverable one.
Look for the history listing revisions with their status, for the rollback naming the revision it returns to, and for the atomic upgrade either succeeding or rolling back on its own. A release that stays pending after a rollback needs the pod events checked, not another upgrade.
helm history web --namespace production helm rollback web 4 --namespace production helm upgrade web ./web --atomic --wait --timeout 5m --namespace production
37. Prometheus pulls metrics; most systems push them. Why pull, and when do you push instead?
Prometheus is a monitoring system that collects metrics by scraping targets on a schedule.
Pulling puts the monitoring system in control of timing.
It decides when to scrape, how often, and what to do when a target is slow.
A failed scrape is itself a signal.
The `up` metric drops to zero for a target that stops answering, so a dead service is visible even when it sends nothing.
A target cannot flood the monitoring system with a pull model.
It only answers when asked, so a runaway service cannot bury the collector in data.
Short-lived jobs break the pull model.
A batch job or cron job that finishes in seconds may exit before the next scrape arrives, so its metrics are never collected.
Those jobs push instead, through a push gateway that holds their metrics until Prometheus scrapes it.
The choice is about lifetime, not preference.
Long-lived services are scraped, short-lived jobs push, and both end up in the same store.
Saying pull is better without naming the failure mode it creates for batch and cron jobs leaves the short-lived case unmonitored.
38. Counter, gauge, histogram β which one, and what query do you write?
A counter is a metric that only goes up.
Requests served, errors seen, and bytes sent are counters.
A raw counter value is meaningless on its own, because it grows forever.
The useful question is how fast it is growing, so counters are always read with a rate over a time window.
A gauge is a metric that moves both ways.
Memory in use, queue depth, and active connections are gauges.
A gauge is read as it is, at a point in time, with no rate applied.
A histogram is a metric that records a distribution.
Request latency is the classic histogram, because one average hides the slow tail.
Histograms are read with quantiles, so the p99 shows what the slowest one percent of users experienced.
Averaging latency as if it were a gauge hides exactly the users who suffered most.
Averaging a gauge of latency, or reading a raw counter as if it were a rate, gives a number that looks precise and means nothing.
Look for the error rate returning a small fraction (for example 0.02 for 2%) and the p99 returning a duration in seconds. A counter that resets to zero, after a restart, is handled by `rate()` automatically and is not an error.
# Error rate over the last 5 minutes
sum(rate(http_requests_total{status=~"5.."}[5m]))
/
sum(rate(http_requests_total[5m]))
# p99 latency over the last 5 minutes
histogram_quantile(0.99,
sum(rate(http_request_duration_seconds_bucket[5m])) by (le))39. How do you build an alert that wakes someone up only when users are actually hurting?
An alert is a rule that fires when a measured signal crosses a threshold.
The signal that matters is the symptom users feel.
Error rate and latency are symptoms, while CPU percentage and disk use are causes.
Alerting on a cause pages people for problems users never notice.
A target makes the alert objective.
The error rate is measured against the target the service promised, over a rolling window, so the alert fires on sustained harm rather than a single bad minute.
A `for` duration adds the same patience at the rule level.
The alert stays pending for that long, and only fires if the problem is still there.
Grouping and deduplication keep one incident to one page.
Alertmanager groups alerts by service, so fifty firing pods become a single notification.
Silencing and inhibition handle the rest.
A silence pauses a known alert during maintenance, and an inhibition suppresses the noise that a bigger alert already covers.
Every alert carries a runbook link, so the person paged at 3 a.m. knows the first step without searching.
Alerting on CPU percentage or disk usage with no link to user impact, and paging on every threshold crossing, trains the team to ignore pages.
groups:
- name: web-availability
rules:
- alert: HighErrorRate
expr: |
sum(rate(http_requests_total{status=~"5.."}[5m]))
/
sum(rate(http_requests_total[5m])) > 0.05
for: 10m
labels:
severity: page
annotations:
summary: "Error rate above 5% for 10 minutes"
runbook_url: "https://wiki.example.com/runbooks/high-error-rate"
route:
group_by: ["service", "alertname"]
group_wait: 30s
group_interval: 5m
receiver: on-call
Output:
Checking web-availability.yaml
SUCCESS: 1 rules found40. Monitoring tells you something is wrong. Observability tells you why. What is the difference in practice?
Monitoring is watching for known failure modes.
Dashboards and alerts cover the failures the team already expects, such as a disk filling up or an error rate rising.
Observability is the ability to ask new questions about a failure nobody predicted.
It comes from high-cardinality data that can be sliced in ways the dashboard author never planned.
Traces and structured logs are the tools for that second case.
A trace follows one request across services, so a slow checkout can be pinned to the exact service and the exact call that stalled.
Structured logs add the context around it, with fields that can be filtered rather than lines that must be read.
A metrics dashboard on its own is not observability.
It can show that errors rose, but it cannot show which user, which request, or which code path caused them.
Tracing without sampling and retention decisions is also a trap.
Unbounded traces fill storage fast, so the team must choose what to keep and for how long.
Claiming a metrics dashboard is observability, or adding tracing without sampling and retention decisions, confuses the symptom with the investigation.
41. How do you decide what "good enough" reliability means β and what happens when you miss it?
A service level indicator is the number users actually feel.
Successful requests over total requests is one such indicator, and latency under a threshold is another.
A service level objective is a target for that indicator over a window.
Ninety-nine point nine percent of requests succeeding over thirty days is a typical objective, and the window matters as much as the number.
The gap between the target and perfection is the error budget.
A 99.9% target leaves 0.1% of requests as budget, and that budget is spent on shipping changes.
Feature work pauses when the budget runs out.
That is the enforcement mechanism, not a punishment.
The team fixes reliability first, because there is no budget left to spend on risk.
A target nobody measures and nobody acts on is not an objective.
It is a wish, and it changes no decision when it is missed.
Promising 100% uptime, or setting a target nobody measures and nobody acts on, leaves reliability with no number and no consequence.
Look for a value close to the target, such as 0.999 for a 99.9% objective. The burn-rate alert from Q39 is the enforcement: when the error rate consumes the budget faster than the window allows, it pages before the objective is breached.
# SLI: share of successful requests over 30 days
sum(rate(http_requests_total{status!~"5.."}[30d]))
/
sum(rate(http_requests_total[30d]))42. EKS or ECS β how do you choose?
EKS is the managed Kubernetes service on AWS.
It gives the team Kubernetes itself, with its API, its ecosystem, and its portability to other clouds.
ECS is the managed container orchestrator built by AWS.
It gives the team container scheduling without running Kubernetes, and with far less YAML to write and maintain.
Existing Kubernetes investment is the strongest reason to choose EKS.
A team that already runs operators, custom networking, and Helm charts keeps that investment instead of rebuilding it.
Operational overhead is the strongest reason to choose ECS.
A small team that wants containers running with minimal platform work gets there faster on ECS.
Choosing EKS for the resume is a real failure mode.
The team pays the Kubernetes learning curve and the upgrade burden without needing what Kubernetes offers.
Choosing ECS and then rebuilding Kubernetes features by hand is the mirror image.
A service mesh and custom operators built on top of ECS cost more than the Kubernetes they were meant to avoid.
Choosing EKS for the resume, or ECS and then rebuilding Kubernetes features on top of it by hand, pays the cost of both choices and gains neither.
43. How do you design a VPC so a bad deploy cannot take down the whole system?
A VPC is a private network inside AWS, divided into subnets across availability zones.
Public subnets hold only the load balancer.
Nothing else in the system needs a public address, so nothing else gets one.
Private subnets hold the workloads.
Application servers and workers run there, reaching the internet only through a NAT gateway for outbound traffic.
The database sits in isolated subnets with no internet route at all.
It can be reached only from the private subnets, and only on its database port.
Security groups allow only the traffic each tier needs.
The load balancer talks to the app tier on its port, the app tier talks to the database on its port, and nothing else is open.
A wide-open security group shared by everything defeats the whole design.
One bad rule then exposes every tier at once.
Spreading subnets across two availability zones keeps one zone failure from taking the system down.
Putting app servers and the database in public subnets, or one wide-open security group shared by everything, leaves a bad deploy one rule away from exposing the whole system.
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
}
resource "aws_subnet" "public_a" {
vpc_id = aws_vpc.main.id
cidr_block = "10.0.1.0/24"
availability_zone = "us-west-2a"
}
resource "aws_subnet" "private_a" {
vpc_id = aws_vpc.main.id
cidr_block = "10.0.11.0/24"
availability_zone = "us-west-2a"
}
resource "aws_security_group" "lb" {
vpc_id = aws_vpc.main.id
ingress {
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_security_group" "app" {
vpc_id = aws_vpc.main.id
ingress {
from_port = 8080
to_port = 8080
protocol = "tcp"
security_groups = [aws_security_group.lb.id]
}
}
Output:
Plan: 5 to add, 0 to change, 0 to destroy.44. Your AWS bill jumped 40% this month. How do you find out why?
A bill jump is an investigation, not a cutting exercise.
The cost breakdown by service and by tag comes first.
It names the single line that moved, instead of guessing across the whole account.
The next step is to find what changed inside that line.
A new resource, a bigger instance, or a traffic increase each leaves a different trace.
Utilisation checks separate waste from real growth.
An idle instance, an oversized volume, and a forgotten test environment are waste, and they show low utilisation against high cost.
Data transfer is the line most teams miss.
Traffic between regions, and traffic out to the internet, is billed separately from the resources that sent it.
Cutting instance sizes across the board without knowing which service grew is the wrong move.
It slows the service that is actually growing and leaves the waste untouched.
Deleting resources before checking what depends on them is worse.
A volume or snapshot that looks idle may be the only copy of something the team still needs.
Cutting instance sizes across the board without knowing which service actually grew, or deleting resources before checking what depends on them, trades one bill problem for an outage.
Look for one service whose cost moved far more than the others, then for the tagged resources behind that line. Check CloudWatch utilisation on those resources before changing or deleting anything.
aws ce get-cost-and-usage \ --time-period Start=2026-10-01,End=2026-11-01 \ --granularity MONTHLY \ --metrics BlendedCost \ --group-by Type=SERVICE aws ec2 describe-instances \ --query "Reservations[].Instances[].[InstanceId, InstanceType, State.Name]"
45. The pipeline is green, but production is broken. Where do you look first?
A green pipeline proves the code passed its tests.
It proves nothing about the configuration production actually runs with.
The first check is the difference between what CI tested and what production runs.
Configuration, secrets, traffic levels, resource limits, network policy, database state, and external dependencies can all differ.
The deployed image digest is the concrete version of that check.
A digest that does not match the tested build means production is running something CI never saw.
Production telemetry comes next, not the pipeline logs.
Pod status, events, and application logs in production show what is failing right now.
Re-running the pipeline and declaring it fixed is the trap.
A second green run changes nothing about the production configuration that is actually broken.
Re-running the pipeline and declaring it fixed, or assuming a green build means the artifact and its config are the same ones CI validated, leaves the real difference untouched.
Look for pods that are not ready, events naming a failed pull or a missing ConfigMap, and an image digest that differs from the one CI built and tested. A digest mismatch is the break; a matching digest points at config, secrets, or traffic instead.
kubectl get pods --namespace production
kubectl describe pod web-abc123 --namespace production
kubectl logs web-abc123 --namespace production --tail=100
kubectl get deployment web --namespace production \
-o jsonpath='{.spec.template.spec.containers[0].image}'46. Errors spike to 5% right after a deploy, then settle. Roll back or ride it out?
A short error spike after a deploy has two possible causes.
The first is the deploy itself: cold caches, new connections warming up, and readiness timing as pods come into rotation.
The second is the new code, and that one does not settle on its own.
The error rate over the deploy window separates them.
A spike that falls back to baseline within minutes, with no sustained elevation, points at the deploy mechanics.
A rate that stays above baseline after the rollout finishes points at the code.
The error budget is the decision rule.
A brief spike inside the budget is absorbed, and the team investigates the warm-up afterwards.
A spike that keeps burning budget past the window means users are still hurting, and the rollback happens then.
Rolling back on every transient spike means nothing ever ships.
Riding out a real regression because it might settle means users pay for the investigation.
Rolling back on every transient spike and never shipping, or riding out a real regression because it will settle, both treat the spike as a guess instead of measuring it against the budget.
Look for the shape, not a single number: a sharp rise at the deploy timestamp that falls back to baseline is a warm-up spike, while a rate that stays elevated after the rollout finishes is a regression. Roll back on the second shape, not the first.
# Error rate over the deploy window; annotate with the deploy timestamp
sum(rate(http_requests_total{status=~"5.."}[5m]))
/
sum(rate(http_requests_total[5m]))47. You are the first DevOps hire at a five-person startup that deploys by SSH. What do you build first?
The first DevOps hire at a small startup inherits a manual deploy.
The job is to replace it in phases, earning trust at each step.
Phase one is continuous integration on every pull request.
Lint and tests run automatically, so broken code is caught before it reaches anyone's server.
Phase two is containerising the app.
One image replaces the snowflake server, and the same image runs in development and in production.
Phase three is a staging deploy.
The image deploys to staging automatically, so the team sees the pipeline work before production depends on it.
Phase four is a gated production deploy.
An approval step stands between staging and production, and the deploy itself is a command, not a person with an SSH key.
Only then does SSH access go away.
Removing it first, before the pipeline proves itself, leaves the team with no way to ship at all.
Building the full platform in week one is the opposite mistake.
It delivers nothing usable for a month, while the manual deploy keeps breaking in the meantime.
Building the full platform in week one, or automating the SSH deploy instead of replacing it, keeps the manual process alive under a new name.
Look for the CI check appearing on the pull request and turning green on passing code and red on failing code. That check is the foundation the later phases build on, and it must be trusted before staging is added.
name: CI
on:
pull_request:
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint
run: npm run lint
- name: Test
run: npm test48. A regional outage takes down one availability zone. How does your system respond?
An availability zone is one isolated datacentre inside a cloud region.
A zone failure should be a capacity event, not an outage.
Traffic shifts to the healthy zones automatically when the load balancer stops sending requests to the failed zone.
Pods in the failed zone are rescheduled onto nodes in the surviving zones, if capacity allows.
The database is the harder half of the answer.
It fails over to a replica in a healthy zone, or serves reads from a replica while the primary recovers.
The deploy pipeline pauses during the event.
Shipping a change while capacity is reduced risks turning a zone failure into a full outage.
Recovery is declared only after capacity is verified.
The surviving zones must be able to take the full load, not just the load they had before the failure.
Assuming multi-AZ means automatic recovery without checking failover, connection draining, and whether the surviving zones can take the full load, leaves the system one zone short of the capacity it needs.
Look for pods spread across at least two zones before the event, for the failed zone's nodes marked NotReady, and for the surviving zones taking the rescheduled pods. If all pods sit in one zone, the system was never multi-AZ in practice.
kubectl get nodes --show-labels | grep topology.kubernetes.io/zone
kubectl get pods --namespace production -o wide
kubectl get pods --namespace production \
-o jsonpath='{range .items[*]}{.metadata.name} {.spec.nodeName}{"\n"}{end}'49. A production secret was just pushed to a public repo. What do you do in the first hour?
A pushed secret is a stolen secret.
The first hour is about limiting damage, not about cleaning the repository.
Revoke and rotate the secret immediately.
The old value must stop working, because anyone who saw the repository may already have copied it.
Check the audit logs for use of the old secret.
Unusual calls, new sessions, or access from unfamiliar addresses show whether the secret was used before it was revoked.
Only then does the history get purged.
The secret must be removed from every commit in the history, not just from the current files, because the history still holds it.
Deleting the line from the repository and calling it fixed is the common mistake.
The secret is already copied, and the history still contains it for anyone who clones an old commit.
The last step is prevention.
A secret scanner runs on every pull request, so the next secret is caught before it merges.
Deleting the line from the repo and calling it fixed leaves the secret in history and in every copy already made, while the old value still works.
Look for the rewrite reporting the secret replaced in every commit, for the force-push succeeding, and for the scanner passing on the cleaned history. Confirm in the provider console that the old secret is revoked before treating the incident as closed.
git filter-repo --replace-text <(echo "AKIAEXAMPLE==>***REMOVED***") git push --force --all - name: Scan for secrets uses: gitleaks/gitleaks-action@v2
50. Tell me about a production incident you handled β and what you changed afterwards.
A behavioural answer is a story with a structure.
The situation sets the scene in one or two sentences: what broke, who was affected, and when.
The task names what was yours to do, not what the whole team did.
The action is the restore, told in order.
What you checked first, what you ruled out, and what brought the service back are the parts the interviewer listens for.
The result is measured, not vague.
How long the outage lasted, how many users were affected, and what the numbers looked like after the fix all count.
The change afterwards is the part that matters most.
An automation, a guardrail, an alert, or a test that stops the same failure from repeating is the proof the incident taught something.
A hero story with no follow-up change is a warning sign.
It says the same failure can happen again tomorrow, with the same person needed to fix it.
Blaming another team is the other failure mode.
The interviewer wants to hear what you owned, even when the root cause sat elsewhere.
Telling a hero story with no follow-up change, or blaming another team instead of naming what you owned, leaves the interviewer with a rescue and no lesson.
Questions readers ask
How should I work through this sheet?
Work through one group a day, in the order the groups appear, across five days. Give your own answer first, before you read the one on the page, then run the snippet beside it. Save the production scenarios and any questions that caught you out for the day before the interview. Steady daily work beats one big night before the interview.
Do I need a Kubernetes cluster or an AWS account?
You need nothing installed to read it. The Terraform plans here ran offline with dummy credentials, and the Prometheus rules were checked with promtool, which installs as one binary. A local cluster covers the kubectl questions, and a scratch Git repository covers the Git ones. The AWS and Argo CD questions are explained, not run, and say so.
How does preparation differ for freshers and experienced engineers?
Freshers should focus on the fundamentals, Linux, Git, and Docker, and be honest about what they have only read about. Experienced engineers are expected to go deeper on Kubernetes, Terraform failure modes, and production scenarios, with real incidents to draw on. Both groups are judged on clear reasoning, not on pretending to know what they do not.
What should I study after this sheet?
The Git Beginner, Linux Beginner, and Bash Beginner courses build the hands-on skills behind the answers. The Top 50 System Design sheet covers the design half of the senior questions. No DevOps course exists yet. This sheet is where that course begins.