DevOps Interview

DevOps Interview Questions & Answers

Practical interview questions covering Linux, Git, Docker, Kubernetes, AWS, Terraform, Jenkins, Ansible, Prometheus and SRE.

34 interview questions

Linux Interview Questions

How do you find the process using the most CPU?

Use top or ps aux --sort=-%cpu. Start by identifying the process, then inspect its logs, workload and recent changes before deciding whether it should be stopped or restarted.

How do you check memory usage on Linux?

Use free -h for a high-level view and ps aux --sort=-%mem to identify processes consuming memory. vmstat can help investigate memory pressure and swapping.

How do you troubleshoot a service that is not starting?

Check systemctl status for the service, inspect journalctl -u for logs, validate configuration and dependencies, then verify ports, permissions and environment variables.

What is the difference between a process and a thread?

A process has its own address space and resources. Threads are execution units within a process and generally share the process memory and resources.

Git Interview Questions

What is the difference between git merge and git rebase?

Merge combines histories with a merge commit when needed. Rebase moves commits onto another base and creates a more linear history. Rebasing shared commits requires care because it rewrites commit history.

How do you undo the last commit?

git reset --soft HEAD~1 keeps changes staged, while git reset --mixed HEAD~1 keeps the changes in the working tree. For a pushed commit, git revert is generally used to create a new reversing commit.

How do you resolve a merge conflict?

Inspect conflicted files, choose the desired changes, remove conflict markers, stage the resolved files and complete the merge or rebase. Test the resulting code before pushing.

Docker Interview Questions

What is the difference between an image and a container?

An image is an immutable template containing application files and metadata. A container is a running or stopped instance created from an image.

How do you troubleshoot a Docker container that exits immediately?

Check docker ps -a, then inspect docker logs <container> and docker inspect <container>. Verify the entrypoint, command, environment variables, mounted files and application exit code.

What is a Docker volume?

A volume is Docker-managed persistent storage that can survive container recreation. It is commonly used for databases and application data that should not live only in the container writable layer.

Kubernetes Interview Questions

What is a Pod in Kubernetes?

A Pod is the smallest deployable unit in Kubernetes. It contains one or more containers that share networking and storage contexts.

What causes CrashLoopBackOff?

It indicates that a container repeatedly starts and exits. Common causes include application errors, invalid configuration, missing environment variables, failed dependencies and incorrect commands. kubectl logs and kubectl describe pod are key investigation commands.

What is the difference between Deployment and StatefulSet?

Deployment is commonly used for stateless replicated workloads. StatefulSet provides stable identities and ordered behavior useful for stateful workloads such as databases and clustered systems.

What is a Kubernetes Service?

A Service provides a stable network endpoint for a group of Pods selected by labels. Common service types include ClusterIP, NodePort and LoadBalancer.

How do you troubleshoot a Pod stuck in Pending?

Use kubectl describe pod to inspect scheduler events. Check node capacity, resource requests, taints, tolerations, affinity rules and whether suitable nodes are available.

AWS Interview Questions

What is the difference between an IAM user and IAM role?

An IAM user represents a long-term identity. A role is an identity that can be assumed and is commonly used by AWS services, workloads and users who need temporary credentials.

What is an Availability Zone?

An Availability Zone is an isolated location within an AWS Region. Deploying across multiple Availability Zones can improve application resilience against an issue affecting one zone.

What is the difference between Security Groups and Network ACLs?

Security Groups are stateful controls associated with network interfaces. Network ACLs operate at the subnet boundary and are stateless, requiring explicit inbound and outbound rules.

Terraform Interview Questions

What is Terraform state?

Terraform state maps configuration resources to real infrastructure objects and stores information Terraform uses to determine planned changes.

Why use remote Terraform state?

Remote state allows teams and automation systems to share state from a controlled backend. Many remote backends also provide locking or coordination capabilities.

What is terraform plan?

terraform plan compares the desired configuration with Terraform's state and provider information and shows proposed changes without applying them.

Jenkins Interview Questions

What is a Jenkins Pipeline?

A Pipeline defines a delivery workflow as code. It can contain stages for checkout, build, testing, security scanning, packaging and deployment.

What is the difference between an agent and the Jenkins controller?

The controller coordinates Jenkins workloads and manages the system. Agents execute build and pipeline workloads, allowing jobs to run on appropriate machines or environments.

How do you troubleshoot a Jenkins build failure?

Start with console output, identify the failing stage, inspect environment variables and credentials, verify dependencies and tools, and check the agent's CPU, memory and disk.

Ansible Interview Questions

What is Ansible?

Ansible is an automation platform commonly used for configuration management, application deployment and operational tasks.

What is an Ansible inventory?

Inventory defines the hosts and groups that Ansible can manage. It can be static or dynamically generated from infrastructure sources.

What does idempotent mean in Ansible?

An idempotent task can be executed repeatedly while converging the system toward the desired state without making unnecessary changes once that state has been reached.

Prometheus Interview Questions

What is Prometheus?

Prometheus is a monitoring and alerting system that collects time-series metrics, commonly through a pull-based scraping model.

What is PromQL?

PromQL is Prometheus Query Language. It is used to select, aggregate and calculate values from Prometheus time-series data.

What should you check when a Prometheus target is down?

Check the target address, network connectivity, exporter availability, service discovery, scrape configuration and Prometheus target status.

SRE Interview Questions

What is an SLI?

A Service Level Indicator is a measured signal representing a service characteristic such as availability, latency or successful request rate.

What is an SLO?

A Service Level Objective defines a target level of service performance or reliability over a specified measurement period.

What is an error budget?

An error budget represents the amount of unreliability permitted by an SLO. Teams can use it to balance reliability work against feature delivery.

What should happen during a production incident?

Establish the impact, assign roles, stabilize the service, communicate clearly, preserve useful evidence, investigate systematically and conduct a blameless review afterward.