Devops+for+Developers+ +Class+Notes
Devops+for+Developers+ +Class+Notes
com
3. Intellectual Property
All course materials are protected by copyright laws and are the intellectual property of Faisal Memon and EmbarkX. Unauthorized use,
reproduction, or distribution of these materials is strictly prohibited.
4. Reporting Violations
If you become aware of any unauthorized sharing or distribution of course materials, please report it immediately to
[embarkxofficial@[Link]].
5. Legal Action
We reserve the right to take legal action against individuals or entities found to be violating this usage policy.
Thank you for respecting these guidelines and helping us maintain the integrity of our course materials.
Contact Information
embarkxofficial@[Link]
[Link]
© Faisal Memon | [Link]
🎓 Learning Roadmap
Most of the courses below are available in Udemy For Business, so if you have subscription - you can get
FREE access. Here’s a structured path to enhance your skills with detailed courses available:
1. Spring Boot Full Stack By Building eCommerce Application Step by Step (90+ Hours of Content)
2. Master Spring Boot Microservices (70+ Hours of Content)
3. Learn Java with 60+ Hours of Content (60+ Hours of Content)
4. Master Spring Security with React JS + OAuth2 (34+ Hours of Content)
5. Master IntelliJ IDEA (3+ Hours of Content)
Introduction to Docker
Shared Environment
JOHN UPDATES
A LIBRARY
SARAH JOHN
© Faisal Memon | [Link]
Welcome Docker
© Faisal Memon | [Link]
Shared Environment
CODE <>
© Faisal Memon | [Link]
Shared Environment
CODE <>
Shared Environment
CODE <>
SARAH JOHN
© Faisal Memon | [Link]
Shared Environment
SARAH JOHN
© Faisal Memon | [Link]
Docker Container
CODE <>
RUNTIME
LIBRARIES
SYSTEM TOOLS
© Faisal Memon | [Link]
Virtual Machines
→ VMs act like separate computers inside your computer
Host OS Host OS
Machine Machine
© Faisal Memon | [Link]
Docker Concepts
Dockerfile
Image Running
Docker Image
definition Container
© Faisal Memon | [Link]
Running
Container
Dockerfile
Image Running
Docker Image
definition Container
Running
Container
© Faisal Memon | [Link]
Layer 6
Layer 5
Layer 4
Docker Image
Layer 3
Layer 2
Layer 1
© Faisal Memon | [Link]
Docker Image
h
pus
Docker Image
myapp:latest
myapp:v2
myapp:prod
© Faisal Memon | [Link]
Docker Registries
Docker Architecture
Docker CLI
Docker API
Docker
Containers Docker
Registry
Docker
Daemon
Docker
Images
Host OS
© Faisal Memon | [Link]
Docker
Docker Engine
Host OS
Machine
© Faisal Memon | [Link]
Port Mapping
localhost:8080
Browser on
Nginx (port:80)
host machine
-p host-port:container-port
© Faisal Memon | [Link]
Container Lifecycle
Create
Start
Stop
Restart
Remove
© Faisal Memon | [Link]
myapp:latest
myapp:v2
myapp:prod
© Faisal Memon | [Link]
Docker Commands
Image Commands
# Pull an image from a registry (Docker Hub by default)
docker pull <image-name>
# e.g.: docker pull nginx:latest
# Restart container
docker restart <container-id-or-name>
Understanding Dockerfile
Layer 6
Layer 5
Layer 4
Docker Image
Layer 3
1 layer = 1
Layer 2 instruction
Layer 1
© Faisal Memon | [Link]
Dockerfile
FROM eclipse-temurin:21-jdk
WORKDIR /app
COPY target/*.jar [Link]
EXPOSE 8080
CMD ["java","-jar","[Link]"]
© Faisal Memon | [Link]
Dockerfile
FROM eclipse-temurin:21-jdk
WORKDIR /app
COPY target/*.jar [Link]
EXPOSE 8080
CMD ["java","-jar","[Link]"]
© Faisal Memon | [Link]
Dockerfile
FROM eclipse-temurin:21-jdk
WORKDIR /app
COPY target/*.jar [Link]
EXPOSE 8080
CMD ["java","-jar","[Link]"]
© Faisal Memon | [Link]
Dockerfile
FROM eclipse-temurin:21-jdk
WORKDIR /app
COPY target/*.jar [Link]
EXPOSE 8080
CMD ["java","-jar","[Link]"]
© Faisal Memon | [Link]
Dockerfile
FROM eclipse-temurin:21-jdk
WORKDIR /app
COPY target/*.jar [Link]
EXPOSE 8080
CMD ["java","-jar","[Link]"]
© Faisal Memon | [Link]
Dockerfile
FROM eclipse-temurin:21-jdk
WORKDIR /app
COPY target/*.jar [Link]
EXPOSE 8080
CMD ["java","-jar","[Link]"]
© Faisal Memon | [Link]
FROM eclipse-temurin:21-jdk
WORKDIR /app
COPY target/*.jar [Link]
EXPOSE 8080
Dockerfile for Spring Boot app
CMD ["java","-jar","[Link]"]
FROM python:3.10-slim
WORKDIR /app
COPY [Link] .
RUN pip install --no-cache-dir -r [Link] Dockerfile for Python app
COPY . .
EXPOSE 3000
CMD ["python", "[Link]"]
FROM node:18-slim
WORKDIR /app
COPY package*.json ./ Dockerfile for Node js app
RUN npm install --production
COPY . .
EXPOSE 3000
CMD ["node", "[Link]"]
© Faisal Memon | [Link]
.dockerignore
docker build .
→ Docker sends your entire folder (called build context) to the Docker engine.
DB_URL =
Docker Image
[Link]
© Faisal Memon | [Link]
Docker Compose
Typically
→ Frontend + API Gateway
docker compose up
© Faisal Memon | [Link]
→ Learning Docker basics, testing one service → This is how production grade apps function
[Link]
services:
app:
image: my-backend-app A compose file describes:
ports: → What containers you need
- "8080:8080" → How they talk to each other
→ What ports they expose
db:
→ What environment variables they need
image: mysql
environment:
MYSQL_ROOT_PASSWORD: root
© Faisal Memon | [Link]
docker compose up
Starts everything. Creates network, starts containers in correct order, shows logs
in terminal
docker compose ps
See running services. Which containers are running, port mappings, status.
© Faisal Memon | [Link]
Key Takeaways
→ Docker = runs one container
up → start app
down → stop app
logs → debug
ps → inspect status
© Faisal Memon | [Link]
Docker Networks
bridge
host
none
© Faisal Memon | [Link]
→ Example: When you run “docker run nginx”, it connects to this bridge network
→ Containers can talk to each other using IP addresses, but not by container
names
© Faisal Memon | [Link]
host
→ The container shares your computer's network directly
→ When you need maximum performance or want the container to act like it's
running directly on your machine
none
→ A container with no network connection at all.
→ Security testing, Batch jobs, Work that need maximum security or isolation
Understanding Our
Microservices
Service A Service B
Service A Service B
TAX_SERVICE_URL
VITE_API_URL
FRONTEND_URL
© Faisal Memon | [Link]
[Link]
WHAT HAPPENS IF?
Python
© Faisal Memon | [Link]
What is Orchestration?
Orchestration means automatically managing many containers
across machines — including running, scaling, networking, and
healing them.
Orchestration is like a
manager coordinating
workers so work continues
smoothly even when things
go wrong.
© Faisal Memon | [Link]
Kubernetes
Kubernetes is
A container orchestration platform that manages containers for you at scale.
Docker vs Kubernetes
Docker Kubernetes
Runs containers Manages containers
Single host focus Multi-node clusters
Manual scaling Auto scaling
Manual restart Self-healing
Manual networking Built-in service discovery
Without
Kubernetes
[Link] WHAT HAPPENS IF?
Spring
Boot → Ops team wakes up
Frontend
→ SSH
→ restart container 😓
Python
© Faisal Memon | [Link]
With
Kubernetes
[Link] KUBERNETES WILL
→ Detects crash
→ Restarts container
→ Maintains desired count (e.g. 3
replicas)
Spring
Boot
→ Routes traffic only to healthy pods
Frontend → Scales up/down based on load
Python
© Faisal Memon | [Link]
→ Kubernetes gives:
Reliability, Scalability, Portability (AWS, GCP, Azure, on-prem)
→ That’s why:
Startups use it, Enterprises standardize on it, DevOps engineers must know it
© Faisal Memon | [Link]
History of Kubernetes
History of Kubernetes
History of Kubernetes
History of Kubernetes
Kubernetes Today
→ Kubernetes is the industry standard
→ Almost every company uses it directly or indirectly
© Faisal Memon | [Link]
K + 8 letters + s = K8s
Kubernetes = K8s
© Faisal Memon | [Link]
Kubernetes Architecture
Controller
Scheduler etcd
Manager
API Server
Container 2 Container 2
Controller
Container kubelet
keeps
runtime runs creates the
watching &
container pod
fixing
© Faisal Memon | [Link]
Docker Desktop
Minikube
Kind
© Faisal Memon | [Link]
Pod
→ The actual running app (container wrapped in Kubernetes layer)
Deployment
→ It runs your app continuously.
Controller
Scheduler etcd
Manager
API Server
Container 2 Container 2
Services in Kubernetes
Service in k8s
Without a Service:
→ Your pod is NOT accessible
→ Your app is invisible outside the cluster
→ Every time pod restarts, new IP address is assigned & old connection breaks
👉 Service = “Give my app a stable address so browsers and other apps can
reach it.”
© Faisal Memon | [Link]
Service Types
ClusterIP
NodePort
LoadBalancer
ExternalName
© Faisal Memon | [Link]
Service Types
ClusterIP (Default)
Exposes app inside the cluster only, won’t be accessible from browser. Useful
when - backend talking to backend & Microservices communication
NodePort
Exposes app on a node’s IP + port. Makes app accessible from browser. Port range
is of 30000–32767. Used generally for local testing, demos & learning
Kubernetes
LoadBalancer
Creates a cloud load balancer and gives public IP / DNS. Works best on Cloud
Services like AWS, GCP, Azure. Used majorly for production apps with real users
© Faisal Memon | [Link]
Service Types
ExternalName
Maps Service to an external DNS. Example: [Link]
Used for external db or third party API.
© Faisal Memon | [Link]
Summary
Summary
Kubernetes in Cloud
Kubernetes on AWS
Means running Kubernetes using AWS infrastructure instead of
your own servers
© Faisal Memon | [Link]
Kubernetes on AWS
→ AWS provides a managed Kubernetes service called Amazon Elastic
Kubernetes Service (EKS)
Kubernetes on AWS
Amazon VPC
→ Private network for your cluster
AWS IAM
→ Who can access what (security)
→ and more…
© Faisal Memon | [Link]
Things to know
→ Kubernetes is not AWS-specific
Cluster
→ Cluster = control plane + one or more nodes
→ Cluster ≠ machine
→ Cluster can span 1 node or 1000 nodes
→ You deploy apps to the cluster, not to nodes directly
© Faisal Memon | [Link]
Cluster
Node
Node
Node
Full Stack
Architecture
/ Frontend
One
Browser Public URL
/api Service A Service B
© Faisal Memon | [Link]
Ingress
Ingress
Without Ingress
→ Every service needs its own LoadBalancer / NodePort
→ Expensive (cloud LB per service)
→ Hard to manage URLs
With Ingress
One Load Balancer
Smart HTTP/HTTPS routing to many services
Central place for TLS, auth, rate-limits
© Faisal Memon | [Link]
Ingress Controller
→ Running as Pods
→ Is managed by a Deployment
A web
Controller
traffic
logic
engine
© Faisal Memon | [Link]
Understanding Ingress
Configurations
Ingress Configuration
apiVersion: [Link]/v1
kind: Ingress
metadata:
name: simple-ingress
spec:
ingressClassName: nginx
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: my-app
port:
number: 80
© Faisal Memon | [Link]
Ingress
my-app
Internet LoadBalancer Controller
service
Pod
my-app Pods
© Faisal Memon | [Link]
apiVersion: [Link]/v1
kind: Ingress
metadata:
name: multi-service-ingress
spec:
ingressClassName: nginx Ingress with
rules:
- http:
paths:
Multiple
Services
# Backend API
- path: /api
pathType: Prefix
backend:
service:
name: backend
port: Example:
number: 80
GET /api/users → backend receives /api/users
# Frontend
- path: /
GET /about → frontend receives /about
pathType: Prefix
backend:
service:
name: frontend
port:
number: 80
© Faisal Memon | [Link]
apiVersion: [Link]/v1
kind: Ingress
metadata:
name: rewrite-ingress
annotations:
# REQUIRED for regex paths
[Link]/use-regex: "true"
Ingress with Multiple
# Rewrite path using capture groups
[Link]/rewrite-target: /$1
Services, Regex &
spec:
ingressClassName: nginx
Rewriting Rules
rules:
- http:
paths:
- path: /api/(.*)
pathType: Prefix
backend:
service: EXAMPLE:
name: backend 1. Receives: GET /api/users
port:
number: 80 2. Checks rules (top to bottom)
3. Matches: /api/(.*)
- path: /(.*)
pathType: Prefix
4. Captures: "users" in $1
backend: 5. Applies rewrite-target: /$1
service: 6. Transforms to: GET /users
name: frontend
port: 7. Forwards to: service-a:80
number: 80
t
© Faisal Memon | [Link]
Example Requests
User Request Matched Rule Captured ($1) Rewritten To Service
Backend
Backend Pod Service
(ClusterIP)
© Faisal Memon | [Link]
Before CI/CD
Before CI/CD
Docker Registry
Test
Build app
Production
Verify
Before CI/CD
→ Manual Workflow
Continuous Integration
Continuous Deployment
Manual vs CI/CD
In pre-CI/CD era, all these steps were:
→ Manually triggered
→ Inconsistent
→ Error-prone
This created:
→ Broken releases
→ Late feedback
→ Fear of deployments
Understanding CI/CD
Pipelines & Pipeline Engines
Pipeline = Steps +
Order + Automation
© Faisal Memon | [Link]
pipeline:
trigger: code_push
stages:
- test
- build
- docker
- deploy
- verify
© Faisal Memon | [Link]
Workflows
Jobs
Steps
Runners
© Faisal Memon | [Link]
Anatomy of a CI Pipeline
on:
push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Say Hello
run: echo "Hello from the second workflow!"
© Faisal Memon | [Link]
name → Identity
name: Demo CI
on:
push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Say Hello
run: echo "Hello from the second workflow!"
© Faisal Memon | [Link]
on → Trigger
name: Demo CI
on:
push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Say Hello
run: echo "Hello from the second workflow!"
© Faisal Memon | [Link]
jobs → Work
name: Demo CI
on:
push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Say Hello
run: echo "Hello from the second workflow!"
© Faisal Memon | [Link]
steps → Actions
name: Demo CI
on:
push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Say Hello
run: echo "Hello from the second workflow!"
© Faisal Memon | [Link]
on:
push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Say Hello
run: echo "Hello from the second workflow!"
© Faisal Memon | [Link]
on:
push:
pull_request:
on:
push:
branches: ["working"]
pull_request:
branches: ["working"]
© Faisal Memon | [Link]
Run a command
Running a command
- name: Say Hello Create a Linux machine and run this command in its
run: echo "Hello from CI" terminal.
- uses: actions/checkout@v4
- run: ls
© Faisal Memon | [Link]
A step can only do one thing: Either run commands Or execute an action
Below is valid
steps:
- uses: actions/checkout@v4
Continuous Deployment
Cluster’s Information
Context Information
© Faisal Memon | [Link]
→ Automation
→ Security
Commands
kubectl config view
Default location
Windows: %USERPROFILE%\.kube\config
© Faisal Memon | [Link]
AWS (EKS)
When you create cluster, automatically - behind the scenes
© Faisal Memon | [Link]
→ No memory
→ No files
→ No kubeconfig
© Faisal Memon | [Link]
3. Intellectual Property
All course materials are protected by copyright laws and are the intellectual property of Faisal Memon and EmbarkX. Unauthorized use,
reproduction, or distribution of these materials is strictly prohibited.
4. Reporting Violations
If you become aware of any unauthorized sharing or distribution of course materials, please report it immediately to
[embarkxofficial@[Link]].
5. Legal Action
We reserve the right to take legal action against individuals or entities found to be violating this usage policy.
Thank you for respecting these guidelines and helping us maintain the integrity of our course materials.
Contact Information
embarkxofficial@[Link]
[Link]
© Faisal Memon | [Link]
If you think this course helped you, please do help provide an honest rating and
review of the course. Your insights help us improve and provide better content
for future learners.
🎓 Learning Roadmap
Most of the courses below are available in Udemy For Business, so if you have subscription - you can get
FREE access. Here’s a structured path to enhance your skills with detailed courses available:
1. Spring Boot Full Stack By Building eCommerce Application Step by Step (90+ Hours of Content)
2. Master Spring Boot Microservices (70+ Hours of Content)
3. Learn Java with 60+ Hours of Content (60+ Hours of Content)
4. Master Spring Security with React JS + OAuth2 (34+ Hours of Content)
5. Master IntelliJ IDEA (3+ Hours of Content)