DEV Community

Er. Bhupendra
Er. Bhupendra

Posted on

devops part 2

Achha — ab complete production DevOps pipeline ko start → end samjhte hain, jisme GitHub → Jenkins → Docker → Kubernetes → AWS → Users, saath me IP, ports, load balancer, security groups sab include hote hain. Ye hi architecture zyada tar companies use karti hain.


1️⃣ Developer → Code Repository

Image

Image

Image

Image

Developer apna code version control system me push karta hai, jaise GitHub.

Example:

git add .
git commit -m "new feature"
git push origin main
Enter fullscreen mode Exit fullscreen mode

📌 Yaha se CI pipeline trigger hoti hai.


2️⃣ CI Pipeline (Jenkins Build & Test)

Image

Image

Image

Image

Code push hote hi Jenkins webhook se trigger hota hai.

Typical steps:

GitHub
↓
Jenkins
↓
Code checkout
↓
Build
↓
Unit tests
↓
Artifact create
Enter fullscreen mode Exit fullscreen mode

Example commands:

npm install
npm test
npm build
Enter fullscreen mode Exit fullscreen mode

Jenkins server usually port par run karta hai:

8080
Enter fullscreen mode Exit fullscreen mode

Example access:

http://Jenkins-IP:8080
Enter fullscreen mode Exit fullscreen mode

3️⃣ Docker Pipeline (Container Build)

Image

Image

Image

Image

Build hone ke baad Jenkins Docker image create karta hai using Docker.

Steps:

Application code
↓
Dockerfile
↓
Docker build
↓
Docker image
↓
Push to registry
Enter fullscreen mode Exit fullscreen mode

Example:

docker build -t myapp:v1 .
docker push myrepo/myapp:v1
Enter fullscreen mode Exit fullscreen mode

Image store hoti hai registry me:

  • Docker Hub
  • Amazon Elastic Container Registry

Connection usually:

Port 443 (HTTPS)
Enter fullscreen mode Exit fullscreen mode

4️⃣ CD Pipeline (Deploy to Kubernetes)

Image

Image

Image

Image

Deployment hota hai Kubernetes cluster me.

Flow:

Docker image
↓
Kubernetes deployment
↓
Pods
↓
Service
↓
Ingress / Load Balancer
Enter fullscreen mode Exit fullscreen mode

Example command:

kubectl apply -f deployment.yaml
Enter fullscreen mode Exit fullscreen mode

Deployment example:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: app
spec:
  replicas: 3
Enter fullscreen mode Exit fullscreen mode

Kubernetes automatically:

  • containers run karega
  • scaling karega
  • crash hone par restart karega
  • rolling updates karega

5️⃣ AWS Infrastructure

Image

Image

Image

Image

Cloud infrastructure commonly Amazon Web Services par hota hai.

Typical architecture:

VPC
↓
Public Subnet
↓
Load Balancer
↓
Kubernetes Nodes / EC2
↓
Pods
↓
Database
Enter fullscreen mode Exit fullscreen mode

Components:

  • VPC
  • EC2 / EKS
  • Load Balancer
  • RDS database
  • Security Groups

6️⃣ Ports in Production

Important ports:

Service Port
SSH 22
HTTP 80
HTTPS 443
Jenkins 8080
Application 3000
MySQL 3306

Example request flow:

User
↓
https://domain.com
↓
Port 443
↓
Load Balancer
↓
Port 3000
↓
Application Pod
Enter fullscreen mode Exit fullscreen mode

7️⃣ Security Groups (Firewall)

AWS me firewall ko Security Group bolte hain.

Example rules:

22 → DevOps SSH access
80 → HTTP
443 → HTTPS
3000 → Application port
Enter fullscreen mode Exit fullscreen mode

Example:

0.0.0.0/0 → 443
Enter fullscreen mode Exit fullscreen mode

Matlab internet se HTTPS allowed.


8️⃣ Monitoring & Logs

Production systems monitoring ke bina incomplete hote hain.

Tools:

  • Prometheus
  • Grafana

Flow:

Application
↓
Metrics
↓
Prometheus
↓
Grafana Dashboard
↓
Alerts
Enter fullscreen mode Exit fullscreen mode

🔥 Final Production DevOps Architecture

Complete pipeline:

Developer
↓
GitHub
↓
Jenkins CI Pipeline
↓
Build + Test
↓
Docker Build
↓
Docker Registry
↓
Kubernetes Deployment
↓
Pods
↓
Load Balancer
↓
Users
↓
Monitoring
Enter fullscreen mode Exit fullscreen mode

Important concept

Layer Tool
Code GitHub
CI/CD Jenkins
Container Docker
Orchestration Kubernetes
Cloud AWS
Monitoring Prometheus

Top comments (0)