DEV Community

Aisalkyn Aidarova
Aisalkyn Aidarova

Posted on

interview questions with answers

This is a very good foundation interview set. A DevOps engineer with 5–7 years of experience should be able to explain all of these clearly.

Infrastructure Fundamentals

What is Hardware?

Answer:
Hardware is the physical component of a computer system.

Examples:

  • CPU
  • RAM
  • SSD
  • Network Card (NIC)
  • Motherboard
  • Hard Drive

Without hardware, software cannot run.


What is Software?

Answer:
Software is a collection of programs and instructions that run on hardware.

Examples:

  • Linux
  • Windows
  • Docker
  • Kubernetes
  • Jenkins
  • Nginx

Hardware = Physical machine

Software = Instructions running on machine


CPU

What is CPU?

Answer:
CPU (Central Processing Unit) is the brain of the computer.

Responsibilities:

  • Execute instructions
  • Process calculations
  • Run applications
  • Manage processes

Example:

When you run:

kubectl get pods
Enter fullscreen mode Exit fullscreen mode

CPU processes that command.


How do you check CPU usage?

top
Enter fullscreen mode Exit fullscreen mode

or

htop
Enter fullscreen mode Exit fullscreen mode

or

mpstat
Enter fullscreen mode Exit fullscreen mode

RAM

What is RAM?

Answer:
RAM is temporary memory used by running applications.

Examples:

  • Kubernetes Pods
  • Docker Containers
  • Nginx
  • Java Applications

When server reboots, RAM is cleared.


How do you check memory usage?

free -h
Enter fullscreen mode Exit fullscreen mode

Example:

free -h
Enter fullscreen mode Exit fullscreen mode

Output:

Mem: 16Gi  10Gi  2Gi  4Gi
Enter fullscreen mode Exit fullscreen mode

How to check memory consumers?

top
Enter fullscreen mode Exit fullscreen mode

or

ps aux --sort=-%mem
Enter fullscreen mode Exit fullscreen mode

SSD

What is SSD?

Answer:
SSD (Solid State Drive) is permanent storage.

Used for:

  • Operating System
  • Logs
  • Databases
  • Files

Advantages:

  • Faster than HDD
  • No moving parts

IP Address

What is IP Address?

Answer:
IP Address uniquely identifies a device on a network.

Example:

192.168.1.10
Enter fullscreen mode Exit fullscreen mode

Similar to a home address.

Without IP, devices cannot communicate.


Difference between Public and Private IP

Private:

10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
Enter fullscreen mode Exit fullscreen mode

Public:

Accessible from internet.

Example:

54.12.34.56
Enter fullscreen mode Exit fullscreen mode

Port

What is Port?

Answer:
Port identifies a service running on an IP address.

Example:

192.168.1.10:80
Enter fullscreen mode Exit fullscreen mode

IP = House

Port = Apartment Number


Common Ports

Port Service
22 SSH
80 HTTP
443 HTTPS
53 DNS
3306 MySQL
5432 PostgreSQL
6379 Redis

Protocol

What is Protocol?

Answer:
Protocol is a set of communication rules.

Examples:

  • HTTP
  • HTTPS
  • TCP
  • UDP
  • SSH

Difference between TCP and UDP

TCP:

  • Reliable
  • Ordered
  • Connection oriented

Examples:

  • HTTP
  • HTTPS
  • SSH

UDP:

  • Fast
  • No delivery guarantee

Examples:

  • DNS
  • Video Streaming

OSI Model

Explain OSI Model

Layer Name
7 Application
6 Presentation
5 Session
4 Transport
3 Network
2 Data Link
1 Physical

Layer 7

Application Layer

Examples:

  • HTTP
  • HTTPS
  • FTP

Layer 4

Transport

Protocols:

  • TCP
  • UDP

Layer 3

Network

Responsible for:

  • Routing
  • IP Addressing

Devices:

  • Router

Layer 2

Data Link

Responsible for:

  • MAC Addresses

Devices:

  • Switch

Layer 1

Physical

Examples:

  • Cables
  • Fiber
  • Ethernet

EC2

What is EC2?

Answer:
Amazon EC2 is a virtual server in AWS.

Used to run:

  • Linux
  • Applications
  • Databases
  • Docker

Example:

Launch Ubuntu server.

Install Nginx.

Access via browser.


ASG

What is Auto Scaling Group?

Answer:
ASG automatically adds or removes EC2 instances.

Benefits:

  • High Availability
  • Scalability
  • Self Healing

Example:

Traffic increases.

ASG:

2 EC2 → 4 EC2 → 8 EC2
Enter fullscreen mode Exit fullscreen mode

ALB

What is Application Load Balancer?

Answer:
ALB distributes HTTP/HTTPS traffic across multiple targets.

Works at:

OSI Layer 7
Enter fullscreen mode Exit fullscreen mode

Supports:

  • Host-based routing
  • Path-based routing

Example:

/api/users → User Service

/api/orders → Order Service
Enter fullscreen mode Exit fullscreen mode

NLB

What is Network Load Balancer?

Answer:
NLB works at:

Layer 4
Enter fullscreen mode Exit fullscreen mode

Handles:

  • TCP
  • UDP

Very fast.

Millions of connections.


Target Group

What is Target Group?

Answer:
Target Group contains backend servers.

Example:

ALB
 ↓
Target Group
 ↓
EC2 Instances
Enter fullscreen mode Exit fullscreen mode

Health checks are performed against targets.


Security Group

What is Security Group?

Answer:
Virtual firewall for AWS resources.

Controls:

  • Inbound Traffic
  • Outbound Traffic

Example:

Allow:

22 SSH
80 HTTP
443 HTTPS
Enter fullscreen mode Exit fullscreen mode

EBS

What is EBS?

Answer:
Elastic Block Store.

Persistent disk attached to EC2.

Similar to:

SSD attached to server
Enter fullscreen mode Exit fullscreen mode

Use cases:

  • Databases
  • Application storage

EFS

What is EFS?

Answer:
Elastic File System.

Shared storage.

Multiple EC2 instances can mount same filesystem.

Example:

EC2-1
EC2-2
EC2-3
   ↓
   EFS
Enter fullscreen mode Exit fullscreen mode

S3

What is S3?

Answer:
Object Storage Service.

Stores:

  • Images
  • Videos
  • Backups
  • Logs

Characteristics:

  • Durable
  • Highly Available
  • Unlimited Scale

Cookies

What are Cookies?

Answer:
Small files stored in browser.

Used for:

  • Login Sessions
  • User Preferences
  • Tracking

Example:

User logs in.

Cookie stores session identifier.


Persistent Volume (PV)

What is Persistent Volume?

Answer:
Persistent storage in Kubernetes.

Pod can restart without losing data.

Example:

Pod
 ↓
PVC
 ↓
PV
 ↓
EBS
Enter fullscreen mode Exit fullscreen mode

Linux Commands

Check Disk Usage

df -h
Enter fullscreen mode Exit fullscreen mode

Shows:

Filesystem
Size
Used
Available
Enter fullscreen mode Exit fullscreen mode

Check Filesystem Size

lsblk
Enter fullscreen mode Exit fullscreen mode

Check Memory

free -h
Enter fullscreen mode Exit fullscreen mode

Check CPU

top
Enter fullscreen mode Exit fullscreen mode

Check Processes

ps aux
Enter fullscreen mode Exit fullscreen mode

Kill Process

kill -9 PID
Enter fullscreen mode Exit fullscreen mode

Search File

find / -name nginx.conf
Enter fullscreen mode Exit fullscreen mode

Check Port

ss -tulpn
Enter fullscreen mode Exit fullscreen mode

or

netstat -tulpn
Enter fullscreen mode Exit fullscreen mode

Current Directory

pwd
Enter fullscreen mode Exit fullscreen mode

List Files

ls -la
Enter fullscreen mode Exit fullscreen mode

Copy

cp file1 file2
Enter fullscreen mode Exit fullscreen mode

Move

mv old new
Enter fullscreen mode Exit fullscreen mode

Delete

rm -rf folder
Enter fullscreen mode Exit fullscreen mode

Change Permissions

chmod 755 file
Enter fullscreen mode Exit fullscreen mode

Change Ownership

chown ubuntu:ubuntu file
Enter fullscreen mode Exit fullscreen mode

Systemd

What is systemd?

Answer:
systemd is Linux service manager.

Manages:

  • Services
  • Boot process
  • Logs

Examples:

  • nginx
  • docker
  • kubelet

systemctl

Start Service

sudo systemctl start nginx
Enter fullscreen mode Exit fullscreen mode

Stop Service

sudo systemctl stop nginx
Enter fullscreen mode Exit fullscreen mode

Restart Service

sudo systemctl restart nginx
Enter fullscreen mode Exit fullscreen mode

Service Status

systemctl status nginx
Enter fullscreen mode Exit fullscreen mode

Enable On Boot

sudo systemctl enable nginx
Enter fullscreen mode Exit fullscreen mode

journalctl

What is journalctl?

Answer:
Reads systemd logs.


View Logs

journalctl
Enter fullscreen mode Exit fullscreen mode

Service Logs

journalctl -u nginx
Enter fullscreen mode Exit fullscreen mode

Real-Time Logs

journalctl -fu nginx
Enter fullscreen mode Exit fullscreen mode

apt

What is apt?

Answer:
Ubuntu package manager.


Install package

sudo apt install nginx -y
Enter fullscreen mode Exit fullscreen mode

Update repository

sudo apt update
Enter fullscreen mode Exit fullscreen mode

Upgrade packages

sudo apt upgrade -y
Enter fullscreen mode Exit fullscreen mode

sudo

What is sudo?

Answer:
Runs command as root.

Example:

sudo apt update
Enter fullscreen mode Exit fullscreen mode

Network Troubleshooting

Check IP Address

ip a
Enter fullscreen mode Exit fullscreen mode

Check Routing Table

ip route
Enter fullscreen mode Exit fullscreen mode

Test Connectivity

ping 8.8.8.8
Enter fullscreen mode Exit fullscreen mode

DNS Test

nslookup google.com
Enter fullscreen mode Exit fullscreen mode

or

dig google.com
Enter fullscreen mode Exit fullscreen mode

Trace Route

traceroute google.com
Enter fullscreen mode Exit fullscreen mode

Check Open Ports

ss -tulpn
Enter fullscreen mode Exit fullscreen mode

Test TCP Port

telnet hostname 80
Enter fullscreen mode Exit fullscreen mode

or

nc -zv hostname 80
Enter fullscreen mode Exit fullscreen mode

Real Interview Scenario

Question: Website is down. How do you troubleshoot?

Answer:

  1. Check process
ps aux | grep nginx
Enter fullscreen mode Exit fullscreen mode
  1. Check service
systemctl status nginx
Enter fullscreen mode Exit fullscreen mode
  1. Check logs
journalctl -u nginx
Enter fullscreen mode Exit fullscreen mode
  1. Check port
ss -tulpn | grep 80
Enter fullscreen mode Exit fullscreen mode
  1. Check disk
df -h
Enter fullscreen mode Exit fullscreen mode
  1. Check memory
free -h
Enter fullscreen mode Exit fullscreen mode
  1. Check CPU
top
Enter fullscreen mode Exit fullscreen mode
  1. Check connectivity
ping
curl
nc
Enter fullscreen mode Exit fullscreen mode
  1. Check firewall/security group

  2. Check DNS

nslookup
dig
Enter fullscreen mode Exit fullscreen mode
  1. Check load balancer health checks

  2. Verify backend application is responding

This troubleshooting flow is exactly the type of answer expected from a mid-to-senior DevOps/SRE engineer during interviews.

Top comments (0)