Complete DevOps Interview Guide
1. Docker - Basics
Q1: What is Docker?
A1: Docker is a containerization platform that packages applications with dependencies, ensuring
consistency across environments.
Q2: How does Docker differ from a virtual machine?
A2: Unlike VMs, Docker containers share the host OS kernel, making them lightweight and faster.
Q3: What is the difference between a Docker image and a container?
A3: A Docker image is a read-only template, while a container is a running instance of an image.
Q4: How do you build a Docker image?
A4: Use a Dockerfile and run `docker build -t myimage .`.
2. Docker - Advanced
Q1: What is the purpose of Docker Compose?
A1: Docker Compose is used to define and run multi-container Docker applications using a YAML
file.
Q2: How do you persist data in Docker?
A2: Use Docker volumes (`docker volume create myvolume`) or bind mounts.
Q3: How do you reduce Docker image size?
A3: Use smaller base images (`alpine`), multi-stage builds, and minimize unnecessary files.
Q4: How do you troubleshoot a failed container?
A4: Use `docker logs <container_id>`, `docker inspect`, and `docker ps -a`.
3. Kubernetes - Basics
Q1: What is Kubernetes?
A1: Kubernetes is an orchestration tool for managing containerized applications.
Q2: What is a Kubernetes Pod?
A2: A Pod is the smallest deployable unit in Kubernetes and can contain multiple containers.
Q3: What is the difference between a Deployment and a StatefulSet?
A3: A Deployment manages stateless applications, while a StatefulSet is used for stateful
applications.
Q4: What are ConfigMaps and Secrets in Kubernetes?
A4: ConfigMaps store configuration data, while Secrets store sensitive information like passwords.
4. Kubernetes - Advanced
Q1: How does Kubernetes handle service discovery?
A1: Kubernetes uses DNS-based service discovery to allow Pods to communicate.
Q2: What is Ingress in Kubernetes?
A2: Ingress manages HTTP/HTTPS routing in Kubernetes.
Q3: How do you scale a Kubernetes Deployment?
A3: Use `kubectl scale deployment myapp --replicas=3`.
Q4: What is the purpose of Horizontal Pod Autoscaler (HPA)?
A4: HPA automatically scales Pods based on CPU/memory usage.
5. Jenkins & CI/CD
Q1: What is CI/CD?
A1: CI/CD automates the integration, testing, and deployment of applications.
Q2: What is a Jenkins Pipeline?
A2: A Pipeline is a sequence of steps for automating software delivery.
Q3: How do you trigger a Jenkins job automatically?
A3: Use Git webhooks or Jenkins polling mechanisms.
Q4: How do you secure Jenkins credentials?
A4: Use Jenkins' built-in credentials manager or integrate with Vault.
6. Linux Commands
Q1: How do you check disk usage in Linux?
A1: Use `df -h` for disk space and `du -sh folder` for folder size.
Q2: How do you find and kill a process?
A2: Use `ps aux | grep <process>` to find it and `kill -9 <PID>` to terminate it.
Q3: What is the difference between `grep`, `sed`, and `awk`?
A3: `grep` searches, `sed` modifies, and `awk` processes text.
7. AWS
Q1: What are the core AWS services?
A1: EC2 (compute), S3 (storage), RDS (database), VPC (networking).
Q2: How do you secure an S3 bucket?
A2: Use IAM policies, S3 bucket policies, and encryption.
Q3: What is the difference between a Security Group and NACL?
A3: Security Groups control inbound/outbound traffic at the instance level, while NACLs work at the
subnet level.
Q4: How does AWS Auto Scaling work?
A4: Auto Scaling adjusts the number of EC2 instances based on demand.
8. Git
Q1: What is Git?
A1: Git is a version control system that tracks changes in code.
Q2: How do you resolve merge conflicts?
A2: Use `git status`, manually edit conflicts, and `git commit`.
Q3: What is the difference between `git merge` and `git rebase`?
A3: Merge creates a new commit combining branches; rebase moves commits on top of another
branch.
Q4: How do you revert a commit in Git?
A4: Use `git revert <commit_id>` to undo a commit without changing history.
9. Scenario-Based Questions
Q1: A Docker container is restarting continuously. How do you troubleshoot it?
A1: Check logs (`docker logs`), inspect the container, check dependencies.
Q2: A Kubernetes Pod is in a `CrashLoopBackOff` state. What do you do?
A2: Use `kubectl logs` and `kubectl describe pod` to diagnose the issue.
Q3: Your Jenkins build fails due to permission issues. How do you fix it?
A3: Check file permissions, ensure correct Jenkins user access, and adjust security settings.
Q4: An AWS EC2 instance is unreachable. What steps do you take?
A4: Check security groups, route tables, instance health, and network connectivity.
Q5: You accidentally pushed credentials to a Git repository. What do you do?
A5: Remove them from Git history using `git rebase`, invalidate keys, and update `.gitignore`.