DevOps Interview Questions
Linux::
• Command to get list of all files and folders
• ls command options
• What columns you see when you run ls -l
• Why some entries in ls -l start with l
• Commands to create files/directories in Linux
• Commands to remove files, directories, and directory content
• Command to create a directory within another directory
• What are all the file modes
• grep, sed, awk, cut – usage and examples
• top command usage
• kill command usage
• Command to remove 30+ days old log files
• Command to check file existence
• Command to give read & write permission to owner, and read-only to group &
others
• Command to change owner
• Commands to check CPU, memory, disk space
• Command to start a service
• Difference between apt, yum, and dnf
• Command to check open port
• Command to show all running processes
Git & GitHub::
• Git vs GitHub
• git pull vs git fetch
• git clone vs git fork
• git reflogs
• git stash
• git merge vs git rebase
• git revert vs git reset
• git push vs git cherry-pick
• Git command to clone a specific branch
• Branching strategy in your project
• How you secure credentials
• How you resolve merge conflicts
Shell/Python Scripts::
• Is it mandatory to add shebang (#!/bin/bash) at the beginning of scripts?
• Script to get 30+ day old directories and remove them if 90%+ disk usage
• Script to check if file exists – if not, create it
• Script to check if a number is even or odd
• Script to find the maximum of 3 numbers
• Script to automate start, restart, and shutdown of Azure VMs
• Script to find and remove files older than 30 days
• Script to reverse a string
Ansible::
• Why Ansible?
• What are Ansible roles?
• What are Ansible handlers?
• What is inventory file in Ansible?
• Types of inventories
• How to use conditions in Ansible playbooks
Docker::
• What is Docker?
• Docker vs Kubernetes
• Command to build a Dockerfile
• Difference between image and container
• How to write a Dockerfile
• CMD vs ENTRYPOINT
• COPY vs ADD
• Command to get list of all containers
• Command to view docker logs
• What is Docker Compose?
• What are multi-stage builds in Docker?
Terraform::
• What is Terraform?
• What are providers in Terraform?
• How to create infra in multiple regions with multiple providers?
• How to use different .tfvar files for different environments?
• What happens if infra is removed manually and you run terraform apply?
• What happens if someone deletes the statefile?
• Write a Terraform file to create a Virtual Machine
• What are Terraform modules?
• Write a simple Terraform module
• Difference between variables.tf and var.tfvars
• count vs for_each
• Dynamic block usage
• Workspaces in Terraform
• Locals in Terraform
• Terraform lifecycle explained
Jenkins::
• Write a sample cicd.yaml file
• What are the different types of pipelines?
• How to integrate SonarQube with Jenkins
• How Jenkins automatically triggers pipeline on GitHub push
• Why use SonarQube?
Azure & Azure DevOps::
• What is a Service Connection and how to implement it?
• How to store secrets/confidential info in Azure securely?
• Different types of data storage options in Azure
• Logic Apps, Gateways, Load Balancing, Event Hub, etc.
• Why Azure DevOps?
• How to connect Azure DevOps with Azure
• What is Environment in Azure DevOps?
• What is Scope in Azure DevOps?
• Write a YAML pipeline for deployment
• Creating secrets in Azure Key Vault vs Azure DevOps portal – differences and
when to use which
• VM failure – what could be the reasons?
• What is a VM Scale Set?
• If a CI/CD YAML pipeline has 5 stages and fails at a specific one in production –
what’s your immediate action plan?