๐ Kubernetes ์ค์ต: Blue/Green Deployment (with LoadBalancer Service)
๋์ผํ ์๋น์ค๋ฅผ ๋ ๊ฐ์ ๋ฒ์ (Blue, Green)์ผ๋ก ๊ตฌ์ฑํ๊ณ , ์ค์๊ฐ ํธ๋ํฝ์ ์ด๋ ์ชฝ์ ๋ณด๋ผ์ง Service์ selector๋ฅผ ํตํด ์ ์ดํ๋ ์ ๋ต์ ๋๋ค.
bluegreen-deploy-svc.yml
---
apiVersion: v1
kind: Service
metadata:
name: aws9-service
spec:
selector:
color: blue # ์ฒ์์๋ blue ๋ฐฐํฌ๋ฅผ ๋ฐ๋ผ๋ด
๋๋ค.
ports:
- protocol: TCP
port: 80
targetPort: 80
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: aws9-deploy-blue
spec:
replicas: 3
selector:
matchLabels:
color: blue
template:
metadata:
labels:
color: blue
spec:
containers:
- name: aws9-ctn-blue
image: brian24/aws9:blue
ports:
- containerPort: 80
resources:
limits:
memory: "64Mi"
cpu: "500m"
requests:
memory: "32Mi"
cpu: "250m"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: aws9-deploy-green
spec:
replicas: 3
selector:
matchLabels:
color: green
template:
metadata:
labels:
color: green
spec:
containers:
- name: aws9-ctn-green
image: brian24/aws9:green
ports:
- containerPort: 80
resources:
limits:
memory: "64Mi"
cpu: "500m"
requests:
memory: "32Mi"
cpu: "250m"
kubectl apply -f bluegreen-deploy-svc.yml
kubectl get svc
curl http://<EXTERNAL-IP>
์ฒ์์๋ blue ํ์ด์ง๊ฐ ์ถ๋ ฅ๋ฉ๋๋ค.
kubectl edit svc aws9-service
# selector:
# color: green ← ์ด ๋ถ๋ถ์ผ๋ก ๋ณ๊ฒฝ
๋ณ๊ฒฝ ํ ์ ์ฅ → ๋ค์ curl ์์ฒญ ์ green ํ์ด์ง๊ฐ ๋ํ๋ฉ๋๋ค.
๐งญ NGINX Ingress Controller + Ingress Routing ์ค์ต ์ ๋ฆฌ (0) | 2025.04.15 |
---|---|
๐ Kubernetes HPA ์ค์ต: Horizontal Pod Autoscaler (0) | 2025.04.15 |
Kubernetes ๋ฐฐํฌ ๊ธฐ๋ณธ ๊ฐ๋ ๋ฐ ์ค์ต ์ ๋ฆฌ (1) | 2025.04.15 |
25.04.14. ์ฟ ๋ฒ๋คํฐ์ค Deployment ์ค์ต ์ ๋ฆฌ ๐ (0) | 2025.04.14 |
25.04.14. ์ฟ ๋ฒ๋คํฐ์ค ์ค์ต ์ ๋ฆฌ (1) | 2025.04.14 |