DevOps Engineer interview questions
100 real questions with model answers and explanations for Junior candidates.
See a DevOps Engineer resume example →Practice with flashcards
Spaced repetition · Hunter Pass
Questions
Linux permissions define read, write, and execute access separately for the owner, group, and others.
- Numeric permissions use read = 4, write = 2, and execute = 1, with values added for each access class.
- chmod 755 gives the owner 7, or full access, while the group and others get 5, or read and execute without write.
- A directory needs execute permission to be entered, even when it has read permission.
Why interviewers ask this: The digit arithmetic plus the execute-on-directories nuance shows practiced rather than memorized knowledge.
root has unrestricted system access, while sudo grants a regular user elevated rights for a specific command.
- sudo records who ran the privileged command, providing an audit trail that shared root access does not.
- Working as root makes every mistake fully privileged, so a mistyped rm command or faulty script can damage the system without a safety barrier.
- The safer practice is to use a personal account and invoke sudo only for commands that require elevated rights.
Why interviewers ask this: The blast-radius and audit arguments are what the interviewer wants beyond the definitions.
Linux process inspection starts by finding the process and its PID, then stopping it with the least disruptive signal.
- ps aux and top show running processes, PIDs, CPU, and memory usage, while pgrep searches by process name.
- kill PID sends SIGTERM, allowing the process to shut down cleanly and release resources.
- kill -9 sends uncatchable SIGKILL and is a last resort because immediate termination can skip cleanup, corrupt data, or leave locks behind.
Why interviewers ask this: Knowing why SIGKILL is the last resort, not the default, is the judgment being checked.
systemd services are managed with systemctl, and their logs are read through journalctl.
- systemctl status nginx shows whether nginx is running, along with its PID and recent log lines; start, stop, and restart control its current state.
- systemctl enable nginx configures startup at boot, but enabling a service is separate from starting it now.
- journalctl -u nginx shows service history, and journalctl -u nginx -f follows new entries live; a manually started but disabled service will not return after reboot.
Why interviewers ask this: The started-but-not-enabled trap after reboot is the practical detail that betrays real server experience.
grep searches text, find locates files, and shell pipes combine them into practical log-analysis commands.
- grep -i error app.log searches without regard to case, -r searches directories recursively, and -C 3 includes three context lines around each match.
- find can filter by name, age, or size; find /var/log -name '*.log' -mtime -1 lists log files modified within the last day.
- Piping find into grep searches selected files, while piping grep into wc -l counts matching log lines.
Why interviewers ask this: Context flags and combining tools through pipes show fluency beyond single memorized commands.
Shell pipes connect commands, while redirection sends their output and error streams to files.
- A pipe passes stdout from one command to the next, so cat app.log | grep error | wc -l counts lines containing error.
- The > operator overwrites a file, while >> appends to it.
- 2>&1 merges stderr into stdout so errors are captured with normal output, which prevents silent failures in cron jobs and CI scripts.
Why interviewers ask this: Understanding 2>&1 and where lost stderr bites is the mark of someone who has debugged silent failures.
The Linux filesystem hierarchy gives standard locations to configuration, changing data, user files, temporary data, and programs.
- /etc stores configuration, while /var stores changing data and /var/log specifically stores logs.
- /home contains user directories, and /tmp provides temporary scratch space that may be cleared on reboot.
- /usr and /bin contain programs; knowing these locations makes /etc and /var/log the first places to check for service configuration and failures on an unfamiliar server.
Why interviewers ask this: Quick orientation on an unfamiliar server is the practical skill this vocabulary check stands for.
A full disk incident requires locating the affected filesystem, removing data safely, and preventing recurrence.
- df -h identifies the full filesystem, and commands such as du -sh /var/* combined with sort locate the largest directories.
- Common causes are runaway logs, old backups, and Docker artifacts; rotate or truncate logs and clean package or container caches with their own tools.
- Do not blindly delete a file still held open by a running process, because its space remains allocated until the process releases it.
- Configure log rotation and disk-usage alerts so the team can act before usage reaches 100 percent.
Why interviewers ask this: The open-file-handle subtlety and the prevention follow-up elevate this beyond command recitation.
Environment variables are process-level key-value settings, and PATH controls where the shell looks for commands.
- Processes inherit environment variables at startup, commonly using them for database URLs, API keys, and mode switches instead of hardcoding configuration.
- PATH lists command directories, so an installed executable outside those directories can still produce command not found.
- Exporting a variable in one terminal does not update an already running service, because its environment was fixed when that process started.
Why interviewers ask this: The process-scope insight, why a running service does not see your export, is the depth marker here.
SSH is an encrypted protocol for remote shell access, and key authentication is safer than password authentication.
- A private key stays on the client machine, while its matching public key is placed on the server.
- Keys resist password brute force and are not repeatedly typed where they could be observed; disabling password login removes a common attack path on internet-facing servers.
- The private key never leaves the client and should itself be protected with a passphrase.
Why interviewers ask this: The private-key-never-travels point confirms actual understanding of the key model rather than ritual usage.
scp is convenient for simple copies over SSH, while rsync is better for efficient or repeatable synchronization.
- scp uses cp-like syntax, for example scp app.tar.gz user@server:/opt/, and works well for a single small file.
- rsync transfers only differences, shows progress, resumes interrupted transfers, and can mirror directory trees, including deleting files removed at the source.
- Repeated syncs, large trees, and unreliable connections favor rsync, which is why it has often been used in deployment scripts.
Why interviewers ask this: Knowing rsync's delta transfer as the reason it exists shows tool choice by mechanism, not habit.
A slow server is diagnosed by measuring which resource class is saturated before changing anything.
- top or htop shows load average relative to CPU count, CPU-heavy processes, and memory pressure; free -h confirms RAM and swap usage, and heavy swapping can cause severe slowdown.
- df -h checks for full filesystems, while iostat or iotop reveals saturated disk I/O when CPU is idle but the system remains slow.
- Classify the bottleneck as CPU, memory, disk, or network, then investigate that resource instead of guessing.
Why interviewers ask this: Classifying the bottleneck before acting is the systematic triage habit the interviewer listens for.
DNS resolves names such as api.example.com to IP addresses and caches the results.
- A resolver checks available caches first, then follows the chain through root, TLD, and the domain's authoritative DNS servers.
- An A record maps a name to an IPv4 address, while a CNAME makes one name an alias of another.
- Each answer is cached for its TTL, so old values can remain visible until caches expire and DNS changes therefore do not propagate instantly.
Why interviewers ask this: Caching and TTL as the reason changes are not instant is the practically important part of the answer.
TCP favors reliable delivery, while UDP favors low overhead and latency.
- TCP establishes a connection and uses acknowledgments and retransmissions to deliver complete data in order, which suits HTTP, databases, and SSH.
- UDP sends packets without a connection or delivery guarantee, which suits DNS queries, video streaming, and metrics where speed matters more than completeness.
- Their failures differ: TCP can stall and retry when data is lost, while UDP may silently lose packets.
Why interviewers ask this: Linking each protocol to its failure mode shows understanding beyond the textbook comparison.
A port identifies the service process that should receive traffic sent to an IP address.
- The operating system routes incoming traffic to the process listening on the destination port, allowing one IP to host many services.
- Common ports are 22 for SSH, 80 for HTTP, 443 for HTTPS, 53 for DNS, 5432 for PostgreSQL, 3306 for MySQL, and 6379 for Redis.
- ss -tlnp or netstat shows actual listeners, helping distinguish a stopped service from one listening on the wrong port.
Why interviewers ask this: The listening-check reflex with ss or netstat turns port knowledge into a debugging tool.
HTTPS is HTTP protected by TLS encryption and server identity verification.
- The server presents a certificate issued by a trusted certificate authority to prove its identity.
- During the TLS handshake, the client verifies the certificate chain and both sides establish session keys used to encrypt subsequent traffic.
- Certificates expire, so automated renewal such as Let's Encrypt is essential; browsers can reject a service with an expired certificate just as users would experience an outage.
Why interviewers ask this: Mentioning expiry and renewal automation connects the theory to the incidents ops teams actually face.
A load balancer distributes incoming requests across multiple instances of a service.
- Sharing traffic across instances increases total capacity.
- Health checks remove failed instances from rotation, improving availability.
- A stable frontend address allows instances to be added, removed, or updated behind it, enabling rolling deployments without downtime.
Why interviewers ask this: Naming health checks and the stable-address property shows understanding of why LBs enable zero-downtime operations.
curl can isolate DNS, TLS, connection, and application problems by showing exactly how a web endpoint responds.
- curl -I https://api.example.com/health quickly returns the status and headers, while -v shows the full exchange, including TLS and request details.
- The -w option with timing variables reveals where latency occurs, and -H with -d can reproduce an authenticated POST request sent by a client.
- Comparing these results from different points helps determine whether the service itself is broken or the network path from the user is failing.
Why interviewers ask this: Using curl to separate network, TLS, and application layers is the debugging skill under test.
A firewall limits network exposure by allowing only traffic that matches explicit rules.
- Rules filter by source address, protocol, and port, dropping traffic that is not allowed.
- Cloud security groups perform this role for attached instances and are usually stateful, so return traffic for an allowed connection passes automatically.
- A default-deny setup can expose 443 publicly, restrict 22 to trusted addresses, and allow database ports only from the application group; every open rule needs a clear reason because it adds attack surface.
Why interviewers ask this: The default-deny mindset with concrete rule examples is what distinguishes security awareness from theory.
A reverse proxy accepts client requests and forwards them to backend applications behind one entry point.
- nginx can terminate TLS so applications do not manage certificates, and it can efficiently serve static files and compress responses.
- It can add headers, apply rate limits, and route different paths to different services.
- Request buffering absorbs slow clients so application workers are not occupied by poor client connections.
Why interviewers ask this: Listing concrete responsibilities like TLS termination and buffering shows the candidate knows why the layer exists.
Locked questions
- 21
A service on another host is unreachable. How do you localize the problem with network tools?
- 22
What is the difference between 127.0.0.1 and 0.0.0.0?
networking - 23
What is the difference between private and public IP addresses, and what does NAT do?
networking - 24
Users report errors and the load balancer returns 502 and 504. What do these codes tell you?
load-balancing - 25
Walk through what happens when a user opens https://app.example.com.
https - 26
What problem does git solve, and what does your basic workflow look like?
git - 27
Why do teams use branches and pull requests instead of pushing to main?
code-review - 28
You pull the latest changes and get a merge conflict. What do you do?
git - 29
Why should infrastructure configuration live in git?
gitconfig - 30
What belongs in .gitignore, and what do you do if a secret was committed?
secretsgit - 31
What is continuous integration?
ci-cd - 32
What is the difference between continuous delivery and continuous deployment?
deploymentci-cd - 33
What stages does a typical CI/CD pipeline have, and what happens in each?
ci-cd - 34
How would you write a basic pipeline in GitHub Actions?
ci-cd - 35
What can trigger a pipeline besides a push?
ci-cd - 36
The pipeline is red. How do you investigate a failing build?
ci-cd - 37
What is a build artifact, and how should artifacts be versioned?
ci-cdartifacts - 38
How do you handle secrets in CI/CD pipelines?
ci-cdsecretssoft-skills - 39
Why do pipeline speeds matter, and what makes builds faster?
ci-cd - 40
Why is YAML everywhere in DevOps, and what are its syntax essentials?
yaml - 41
What YAML gotchas have bitten people in configs?
configyaml - 42
How should configuration differ between environments, and where do the values live?
config - 43
What is idempotency, and why does it matter in automation?
idempotency - 44
What does a solid bash script start with, and why set -e and exit codes?
solidbash - 45
Give a practical example of a loop and a condition in a bash script.
bash - 46
How does cron work, and what should a scheduled job always take care of?
cron - 47
What is Infrastructure as Code, and what are its benefits?
iac - 48
How does Terraform work at a basic level, and what is state?
terraform - 49
Why is changing infrastructure manually in the console a problem when Terraform manages it?
terraform - 50
What is configuration management, and where does a tool like Ansible fit next to Terraform?
terraformconfigansible - 51
What is the difference between containers and virtual machines?
containers - 52
What is the difference between a Docker image and a container?
dockercontainers - 53
What do the core Dockerfile instructions do?
docker - 54
How do Docker layers and build cache work, and why does instruction order matter?
cachingdocker - 55
Which Docker commands cover daily work with containers?
dockercontainers - 56
How do image tags and registries work?
containers - 57
How does Docker networking work at a basic level?
docker - 58
How do you persist data in Docker, and what is the difference between volumes and bind mounts?
docker - 59
How do configuration and secrets get into containers?
containersconfigsecrets - 60
What is docker-compose, and when is it the right tool?
docker - 61
Why do small images matter, and what makes an image smaller?
- 62
A container keeps restarting or exits immediately. How do you debug it?
containers - 63
What is Kubernetes, and what problems does it solve beyond plain Docker?
dockerkubernetes - 64
What are a Pod, a Deployment, and a Service in Kubernetes?
kubernetesdeployment - 65
Describe the process of deploying an application to Kubernetes.
kubernetesdeploymentconcurrency - 66
Which kubectl commands do you use to inspect and debug workloads?
kubernetes - 67
What is Helm, and what problem does it solve?
helm - 68
What is GitOps, and what does a tool like ArgoCD do?
gitops - 69
What is the difference between IaaS, PaaS, and SaaS?
cloud - 70
What is EC2, and what basic decisions come with running an instance?
aws - 71
What is S3, and what is it used for?
aws - 72
Why use a managed database like RDS instead of running a database on your own VM?
database - 73
What are regions and availability zones, and why deploy across multiple AZs?
availabilitydeployment - 74
What are IAM basics every junior must respect in the cloud?
- 75
What makes cloud bills explode, and what habits keep costs sane?
- 76
Why does centralized logging exist, and what makes a log entry useful?
logging - 77
What are metrics, and which ones matter for a typical service?
monitoring - 78
What makes a good alert, and what makes a noisy one?
alerting - 79
What belongs on a service dashboard in Grafana?
monitoring - 80
What are health checks, and how do liveness and readiness differ?
health-checks - 81
What do SLA and uptime percentages actually mean in practice?
- 82
The service is down. What are your first steps?
- 83
What is a rollback, and what has to be true for it to be fast?
rollback - 84
Why do dev, staging, and production environments exist, and what should staging be?
- 85
What deployment strategies exist beyond stopping and restarting everything?
deployment - 86
The deploy finished successfully. How do you know the release actually works?
deployment - 87
Why are database migrations dangerous during deploys, and what makes them safer?
databasemigrationsdeployment - 88
What makes a backup strategy trustworthy?
backups - 89
What basic security hygiene is expected from a junior DevOps engineer?
- 90
The TLS certificate expired and users see browser errors. What do you do now and forever after?
tls - 91
What does the works-on-my-machine problem mean, and how do containers address it?
containers - 92
Why write runbooks, and what does a good one contain?
runbooks - 93
Your config change broke production. Walk through what you do.
config - 94
An alert fires and you are the one looking at it. What is your process?
alertingconcurrency - 95
A colleague asks you to quickly change something by hand on a production server. How do you respond?
- 96
How do you grow as a junior DevOps engineer?
- 97
A developer asks you to open a port or grant broad access to speed things up. What do you do?
- 98
You receive a vague ticket: make the deployment better. What do you do?
deployment - 99
The CI pipeline is broken for the whole team, and you also have your own task due. What do you prioritize?
ci-cdprioritization - 100
A senior engineer proposes a solution you believe is wrong. How do you handle it?
soft-skills