


































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



































1.1 What is DevOps?
1.2 The DevOps lifecycle
flowchart LR P[Plan] --> C[Code] C --> B[Build] B --> T[Test] T --> R[Release] R --> D[Deploy] D --> O[Operate] O --> M[Monitor] M --> P
Stage What happens Common tools
Plan Track tasks and features Jira, GitHub Issues
Code Write and version code Git, GitHub, GitLab
Build Compile and package the app
Maven, npm, Docker
1.3 What does a fresher DevOps engineer actually do?
Stage What happens Common tools
Test Run automated tests JUnit, pytest, Selenium, SonarQube
Release / Deploy
Ship to servers or clusters Jenkins, GitHub Actions, Argo CD, Kubernetes
Operate Manage infrastructure AWS, Terraform, Ansible
Monitor Watch health, logs and alerts
Prometheus, Grafana, ELK, CloudWatch
1.6 How to use this handbook
flowchart TD A[Linux + Networking] --> B[Git + Scripting] B --> C[CI/CD] C --> D[Docker] D --> E[Kubernetes] E --> F[Cloud: AWS] F --> G[IaC: Terraform + Ansible] G --> H[Monitoring & Logging] H --> I[End-to-end project]
2.1 Skills checklist
Round What happens Duration
Take-home (some companies)
Build a small pipeline or deploy an app 1โ3 days
Managerial Situations, on-call pressure, teamwork 20โ min
HR Background, motivation, shifts, salary 15โ30 min
2.2 8-week roadmap
Week Focus What to do Done when you canโฆ
1 Linux Daily use of terminal: files, permissions, users, processes, services, logs, SSH
Set up a web server (Nginx) on a Linux VM from scratch
2 Networking + Bash IP, DNS, ports, HTTP, curl, netstat/ss; write 5 Bash scripts
Explain what happens when you open a website; automate a backup
3 Git + CI/CD Git workflows, branching, PRs; build a pipeline in GitHub Actions or Jenkins
Push code and see it auto- build and test
4 Docker Images, Dockerfile, Compose, volumes, networks; containerise a web app
Run a 2-container app (app
3.1 Must-know Linux commands
Task Commands
Navigate & files pwd , ls -la , cd , mkdir -p , cp -r , mv , rm -rf , touch , find / -name app.log
View files (^) cat , (^) less , (^) head -n 20 , (^) tail -f app.log , (^) wc - l
Search text grep -i "error" app.log , grep -r "TODO".
Permissions chmod 755 script.sh , chown user:group file , ls -l
Users (^) whoami , (^) useradd , (^) passwd , (^) sudo , (^) id
Processes ps aux , top / htop , kill -9 , pgrep nginx
Services (^) systemctl status nginx , (^) systemctl restart nginx , systemctl enable nginx
Disk & memory df -h , du -sh * , free -h
Packages (^) apt install nginx (Ubuntu), (^) yum install nginx (^) (RHEL/CentOS)
Logs (^) journalctl -u nginx , (^) /var/log/syslog , /var/log/messages
Networking ip a , ping , curl -I , wget , ss -tulnp / netstat -tulnp ,^ nslookup ,^ dig ,^ traceroute
Remote ssh user@host^ , scp file user@host:/path^ , rsync
Archives tar -czvf backup.tar.gz folder/ , tar -xzvf backup.tar.gz
3.2 Linux interview questions
3.3 Networking essentials
Question Short model answer
How do you check disk space? df -h for each file system; du -sh * to find which folders use the most space.
How do you find which process uses port 8080?
ss -tulnp | grep 8080 or^ lsof -i :.
How do you check running processes and kill one?
ps aux | grep appname to find the PID, then kill ; use kill -9 only if it doesn't stop.
What does chmod 755 mean? Owner: read, write, execute. Group and others: read and execute.
How do you watch a log file live? tail -f /var/log/app.log.
Soft link vs hard link? A soft link points to a file path (breaks if the file is deleted). A hard link points to the same data on disk (still works if the original name is deleted).
What is a cron job? A scheduled task. Example: 0 2 * * * /home/user/backup.sh runs a backup every day at 2 AM.
How do you check memory and CPU usage?
free -h for memory, top or htop for CPU and processes.
What is SSH and how do key-based logins work?
SSH is a secure remote login. You keep a private key; the server has your public key in ~/.ssh/authorized_keys.
What is the difference between a process and a thread?
A process is a running program with its own memory. Threads are smaller units inside a process that share its memory.
Concept Simple explanation
IP address The address of a machine on a network (e.g. 192.168.1.10)
3.4 Favourite question: "What happens when you type a URL in the browser?"
sequenceDiagram participant U as Browser participant D as DNS Server participant L as Load Balancer participant W as Web Server participant DB as Database U->>D: What is the IP of example.com? D-->>U: 93.184.216. U->>L: TCP handshake + TLS (HTTPS) U->>L: HTTP GET / L->>W: Forward request W->>DB: Fetch data DB-->>W: Data W-->>L: HTML response L-->>U: 200 OK + page
4.1 How Git works
flowchart LR W[WorkingDirectory] -- git add --> S[StagingArea] S -- git commit --> L[LocalRepository] L -- git push --> R[Remote RepoGitHub / GitLab] R -- git pull / fetch --> L
4.2 Must-know commands
git clone https://github.com/user/app.git # copy a repo git status # see changed files git add. # stage all changes git commit -m "Add health check endpoint" # save a snapshot git push origin main # upload to remote git pull origin main # fetch + merge latest
git branch feature/login # create a branch git checkout -b feature/login # create and switch git merge feature/login # merge into current branch git log --oneline --graph # view history git diff # see unstaged changes git stash / git stash pop # save work temporarily git revert # undo a commit safely git reset --hard # move back (dangerous on shared branches)
4.3 A typical team workflow
flowchart LR A[Create featurebranch] --> B[Commitchanges] B --> C[Push &open PR] C --> D[CI runsbuild + tests] D --> E[Codereview] E --> F[Merge tomain] F --> G[CD deploys]
4.4 Git interview questions
Question Short model answer
Git vs GitHub? Git is the version control tool. GitHub is a website that hosts Git repositories and adds PRs, issues and Actions.
git fetch vs git pull? Fetch downloads changes but doesn't merge. Pull = fetch + merge.
Merge vs rebase? Merge joins branches with a merge commit and keeps full history. Rebase replays your commits on top of another branch for a straight history. Don't rebase shared branches.
5.1 A typical CI/CD pipeline
flowchart LR A[Developerpushes code] --> B[Checkout] B --> C[Build] C --> D[Unit tests] D --> E[Code quality &security scan] E --> F[Build Dockerimage] F --> G[Push toregistry] G --> H[Deploy tostaging] H --> I{Approval} I --> J[Deploy toproduction]
5.2 GitHub Actions example
name: CI-CD Pipeline
on: push: branches: [ main ] pull_request: branches: [ main ]
jobs: build-test-push: runs-on: ubuntu-latest steps:
with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }}
5.3 Jenkins declarative pipeline example
pipeline { agent any environment { IMAGE = "myuser/myapp:${BUILD_NUMBER}" } stages { stage('Checkout') { steps { git branch: 'main', url: 'https://github.com/myuser/myapp.git' } } stage('Build & Test') { steps { sh 'mvn clean package' } } stage('Docker Build') { steps { sh 'docker build -t $IMAGE .' } } stage('Push Image') { steps { withCredentials([usernamePassword(credentialsId: 'dockerhub', usernameVariable: 'USER', passwordVariable: 'PASS')]) { sh 'echo $PASS | docker login -u $USER --password-stdin' sh 'docker push $IMAGE' } } } stage('Deploy') { steps { sh 'kubectl set image deployment/myapp myapp=$IMAGE' } } }
flowchart LR subgraph BG["Blue-Green"] LB1[Load Balancer] --> B1[Blue v1 - live] LB1 -. switch .-> G1[Green v2 - new] end subgraph CN["Canary"] LB2[Load Balancer] -- 90% --> V1[v1] LB2 -- 10% --> V2[v2] end
6.1 Key concepts
flowchart LR DF[Dockerfilerecipe] -- docker build --> IMG[Imagetemplate] IMG -- docker push --> REG[(RegistryDocker Hub / ECR)] REG -- docker pull --> IMG2[Image onserver] IMG2 -- docker run --> C[Containerrunning app]
Term Simple meaning
Image A read-only template with the app and its dependencies
Container A running instance of an image
Dockerfile Text file with instructions to build an image
Registry A place to store and share images (Docker Hub, AWS ECR)
Volume Storage that keeps data even when the container is deleted
Network Lets containers talk to each other
Docker Compose Runs multi-container apps from one YAML file
6.2 Sample Dockerfile (Python web app)
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt. RUN pip install --no-cache-dir -r requirements.txt
COPY..
RUN useradd -m appuser USER appuser
EXPOSE 5000 CMD ["python", "app.py"]
Virtual machine Container
Includes Full guest OS Only the app and its libraries; shares host kernel
Size GBs MBs
Start time Minutes Seconds
Isolation Stronger Lighter, process-level
7.1 Kubernetes architecture
flowchart TB subgraph CP["Control Plane"] API[API Server] ETCD[(etcd)] SCH[Scheduler]
Question Short model answer
Image vs container? An image is the template; a container is a running copy of it. One image can run many containers.
CMD vs ENTRYPOINT? CMD gives default arguments that can be overridden easily. ENTRYPOINT sets the main command that always runs.
COPY vs ADD? COPY just copies files. ADD can also extract tar files and download URLs. Prefer COPY.
What is a multi-stage build? Using one stage to build the app and a smaller final stage with only the output, which makes images much smaller.
How do you persist data? Use volumes ( -v db-data:/var/lib/mysql ) or bind mounts.
How do containers talk to each other? Through Docker networks; on a user-defined network or in Compose they use each other's service names.
How do you reduce image size? Slim/alpine base, multi-stage builds, fewer layers, .dockerignore^ , remove caches.
Container keeps exiting. How do you debug?
docker ps -a to see exit code,^ docker logs for the error, check CMD and env variables, run it with -it and a shell.
What does (^) -p 8080:5000 mean? Host port 8080 forwards to container port 5000.
CM[Controller Manager] end subgraph N1["Worker Node 1"] K1[kubelet] P1[Pods] KP1[kube-proxy] end subgraph N2["Worker Node 2"] K2[kubelet] P2[Pods] KP2[kube-proxy] end U[kubectl] --> API API --> ETCD API --> SCH API --> CM API --> K API --> K
7.2 Core objects
Component Job
API Server Front door of the cluster; every command goes through it
etcd Key-value store that holds the whole cluster state
Scheduler Decides which node a new pod runs on
Controller Manager Keeps the actual state equal to the desired state (e.g. 3 replicas)
kubelet Agent on each node that runs and watches pods
kube-proxy Handles networking rules so services can reach pods
Object Simple meaning
Pod Smallest unit; one or more containers sharing network and storage
Deployment Manages replicas of pods, rolling updates and rollbacks