DevOps Interview Questions & Answers
(Topic-wise)
DevOps Basics & Culture
Q: What is DevOps?
A: DevOps is a culture and set of practices combining development (Dev) and operations (Ops) to
deliver applications faster and more reliably.
Q: Difference between Agile and DevOps?
A: Agile focuses on software development methodology. DevOps extends Agile to include
operations, ensuring faster delivery and feedback loops.
Q: What is the DevOps lifecycle?
A: Plan → Code → Build → Test → Release → Deploy → Operate → Monitor.
Q: Explain Shift Left testing.
A: It means moving testing earlier in the lifecycle to identify and fix bugs sooner.
Q: Benefits of DevOps?
A: Faster delivery, better collaboration, automation, improved reliability, and continuous
improvement.
Version Control (Git)
Q: What is Git?
A: A distributed version control system.
Q: Difference between Git and GitHub?
A: Git is the VCS, GitHub is a platform to host Git repositories and collaborate.
Q: What are Git branches?
A: Separate lines of development allowing parallel work.
Q: Difference between merge and rebase?
A: Merge combines branches, rebase rewrites history by placing commits on top.
Q: How to resolve merge conflicts?
A: Manually edit conflicting files, stage changes, and commit.
Q: What is GitFlow strategy?
A: A branching model with master, develop, feature, release, and hotfix branches.
CI/CD
Q: What is CI/CD?
A: CI integrates code frequently with automated builds/tests. CD automates releasing to production.
Q: Tools used in CI/CD?
A: Jenkins, GitHub Actions, GitLab CI, CircleCI, Azure DevOps.
Q: Difference between Continuous Delivery & Deployment?
A: Delivery requires manual approval to release; Deployment is fully automated.
Q: What are artifacts in CI/CD?
A: Build outputs stored for deployment (e.g., jar, docker image).
Q: What is blue-green deployment?
A: Two environments (blue and green) where traffic switches to new version after testing.
Q: What is canary deployment?
A: Gradually rolling out new version to a subset of users.
Containers (Docker)
Q: What is Docker?
A: A containerization platform to run apps in isolated environments.
Q: Difference between VMs and Containers?
A: VMs virtualize hardware; containers share the host OS kernel.
Q: What is a Dockerfile?
A: A script with instructions to build Docker images.
Q: What are Docker images and containers?
A: Images are templates; containers are running instances of images.
Q: Difference between COPY and ADD?
A: COPY copies files; ADD can also fetch URLs and extract archives.
Q: What is Docker Compose?
A: Tool to define and run multi-container apps with YAML.
Q: How do you persist data in Docker?
A: Using Docker volumes.
Orchestration (Kubernetes)
Q: What is Kubernetes?
A: An orchestration tool for managing containerized apps.
Q: Key components?
A: Pod, Node, Deployment, Service, Ingress, ConfigMap, Secret.
Q: ReplicaSet vs Deployment?
A: ReplicaSet ensures pod count; Deployment manages ReplicaSets with rolling updates.
Q: StatefulSet vs Deployment?
A: StatefulSet is for stateful apps with stable identities; Deployment is stateless.
Q: ConfigMap vs Secret?
A: ConfigMap stores non-sensitive config; Secret stores sensitive data.
Q: How do you scale apps?
A: kubectl scale command or HPA (Horizontal Pod Autoscaler).
Q: What is Helm?
A: A package manager for Kubernetes.
Cloud
Q: What services in cloud are used in DevOps?
A: Compute (EC2), Storage (S3), Networking, IAM, CI/CD, Monitoring.
Q: Difference between IaaS, PaaS, SaaS?
A: IaaS: infra; PaaS: platform; SaaS: ready-to-use apps.
Q: What is AWS EC2?
A: Elastic Compute Cloud - virtual servers.
Q: What is AWS S3?
A: Simple Storage Service - object storage.
Q: What is IAM?
A: Identity and Access Management for user/role permissions.
Q: What is serverless?
A: Execution model like AWS Lambda with no server management.
Q: What is autoscaling?
A: Automatically adjusting compute resources based on demand.
Infrastructure as Code
Q: What is IaC?
A: Managing infrastructure using code instead of manual setup.
Q: Terraform vs Ansible?
A: Terraform is declarative and manages infra; Ansible is configuration management and
provisioning.
Q: Terraform basics?
A: Providers, resources, variables, and state files.
Q: Ansible basics?
A: Playbooks, inventory, roles, and modules.
Q: What is idempotency?
A: Running same playbook multiple times gives same result.
Q: What is CloudFormation?
A: AWS service for IaC using JSON/YAML templates.
Monitoring & Logging
Q: Why monitoring?
A: To ensure uptime, performance, and reliability.
Q: Tools?
A: Prometheus, Grafana, ELK, CloudWatch.
Q: What is centralized logging?
A: Aggregating logs from multiple sources in one place.
Q: Proactive vs reactive monitoring?
A: Proactive detects issues before impact; reactive after impact.
Q: What are alerts and thresholds?
A: Alerts are notifications when thresholds (limits) are crossed.
Linux & Scripting
Q: Common commands?
A: ls, grep, find, chmod, ps, top, df, du.
Q: Absolute vs relative paths?
A: Absolute starts from root (/); relative is based on current dir.
Q: How to check running processes?
A: ps aux or top/htop.
Q: How to check disk usage?
A: df -h for disk space, du -sh for folder size.
Q: Shell script to print 1-10?
A: for i in {1..10}; do echo $i; done
Q: How to schedule a cron job?
A: Use crontab -e with schedule expression.
Security & Networking
Q: What is DevSecOps?
A: Integrating security into DevOps practices.
Q: How to secure CI/CD pipelines?
A: Use secrets management, role-based access, and scanning tools.
Q: What is SSL/TLS?
A: Protocols for secure communication over HTTP.
Q: Difference between HTTP and HTTPS?
A: HTTPS is secure using SSL/TLS encryption.
Q: What is a firewall?
A: A network security device that filters traffic.
Q: What is zero-trust security?
A: No implicit trust, always verify access.
Q: Public vs private subnets?
A: Public accessible via internet, private only internal.
Q: What is a load balancer?
A: Distributes traffic across servers for reliability.
Real-time Scenarios
Q: Deployment failed, what do you do?
A: Check logs, rollback, fix errors, redeploy.
Q: Server is slow?
A: Check CPU, memory, disk, logs, network usage.
Q: Container keeps restarting?
A: Check logs, image, resources, config, liveness probes.
Q: Logs not showing in monitoring?
A: Check log agent config, permissions, connectivity.
Q: How to handle secrets?
A: Use tools like HashiCorp Vault, Kubernetes Secrets, AWS Secrets Manager.