Top DevOps Interview Questions and Answers for 2025 (With Real-World Coding Tasks)

🔧 Shell Scripting Interview Questions and Answers

1. ✅ Check if file exists in a path and is writable
FILE=”/path/to/file”
if [ -f “$FILE” ] && [ -w “$FILE” ]; then
echo “File exists and is writable.”
else
echo “File does not exist or is not writable.”
fi

2. ✅ Print list of names from a file
!/bin/bash

while read -r name; do
echo “$name”
done < names.txt

3. ✅ Create a file with name as date (yyy-MM-dd)
!/bin/bash

filename=$(date +%Y-%m-%d).txt
touch “$filename”

4. ✅ Mount a disk on a given filesystem
sudo mount /dev/sdb1 /mnt/data

5. ✅ Word count, grep specific word, get first/last 10 lines
Word count
wc -w filename.txt
Grep specific word
grep “word” filename.txt
First 10 lines
head -n 10 filename.txt
Last 10 lines
tail -n 10 filename.txt

🛠️ Jenkins Interview Questions

Write a basic Jenkins pipeline script
pipeline {
agent any
stages {
stage(‘Build’) {
steps {
echo ‘Building…’
}
}
stage(‘Test’) {
steps {
echo ‘Running Tests…’
}
}
stage(‘Deploy’) {
steps {
echo ‘Deploying…’
}
}
}
}

🐳 Docker Interview Questions

Write a Dockerfile to create a Python app image
Use official Python image
FROM python:3.9

Set working directory
WORKDIR /app

Copy app files
COPY . /app

Install dependencies
RUN pip install -r requirements.txt

Run app
CMD [“python”, “app.py”]

☸️ Kubernetes Interview Questions
apiVersion: v1
kind: PersistentVolume
metadata:
name: my-pv
spec:
capacity:
storage: 1Gi
accessModes:
– ReadWriteOnce
hostPath:
path: “/mnt/data”

Write manifest template for Pod or Deployment
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
containers:
– name: my-container
image: nginx

🚀 Deployment Template:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-deployment
spec:
replicas: 2
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
containers:
– name: my-container
image: nginx


Engr. Abhishek Roshan

Engr. Abhishek Roshan

Leave a Reply

Your email address will not be published. Required fields are marked *

Author Info

John Deo

John Deo

Lorem ipsum dolor sit amet consectetur adipiscing elit, molestie habitasse vivamus praesent tempor a lectus mus, egestas venenatis imperdiet arcu accumsan montes. Natoque taciti congue donec eros montes at nisi posuere class sapien tristique, sociosqu

Hot Topics

View All
error: Content is protected !!