728x90
- 레플리카세트처럼 파드들을 유지하고 관리하는 점에서 유사하지만 한 가지 추가된다.
- 바로 롤링 업데이트가 가능하다. 즉, 레플리카세트 기준으로 안전하게 배포하거나 이전 상태로 롤백하는 게 가능하다.
apiVersion: apps/v1
kind: Deployment
metadata:
name: webapp
spec:
replicas: 2
minReadySeconds: 30
selector:
matchLabels:
app: webapp
template:
metadata:
labels:
app: webapp
spec:
containers:
- name: webapp
image: richardchesterwood/k8s-fleetman-webapp-angular:release0-5
---
apiVersion: v1
kind: Pod
metadata:
name: queue
labels:
app: queue
release: "1"
spec:
containers:
- name: queue
image: richardchesterwood/k8s-fleetman-queue:release1
- 지연시간을 30초로 해서 이전에 했던 레플리카 세트를 디플로이먼트로 배포했다.
- 이전의 레플리카 세트는 현재 2개의 레플리카 세트가 다 배포되고 죽게 된다.
C:\Users\tmddn\OneDrive\바탕 화면\kubernetes\replicaset>kubectl rollout status deploy webapp
Waiting for deployment "webapp" rollout to finish: 1 out of 2 new replicas have been updated...
Waiting for deployment "webapp" rollout to finish: 1 out of 2 new replicas have been updated...
Waiting for deployment "webapp" rollout to finish: 1 out of 2 new replicas have been updated...
Waiting for deployment "webapp" rollout to finish: 1 old replicas are pending termination...
Waiting for deployment "webapp" rollout to finish: 1 old replicas are pending termination...
Waiting for deployment "webapp" rollout to finish: 1 old replicas are pending termination...
deployment "webapp" successfully rolled out
- 롤아웃 되는 지 확인 가능
C:\Users\tmddn\OneDrive\바탕 화면\kubernetes\replicaset>kubectl rollout history deploy webapp
deployment.apps/webapp
REVISION CHANGE-CAUSE
4 <none>
5 <none>
- 롤아웃 리비전 확인 가능
C:\Users\tmddn\OneDrive\바탕 화면\kubernetes\replicaset>kubectl rollout undo deploy webapp --to-revision=4
deployment.apps/webapp rolled back
- 롤백도 되기는 하는데 이렇게 하면, yaml 파일이 추후에 문제 없는 지 다시 검토 해야함
- 장애 상황 시에만 사용
300x250
'Infra > 쿠버네티스 입문' 카테고리의 다른 글
쿠버네티스 입문 (8) - 퍼시스턴트 (0) | 2023.12.20 |
---|---|
쿠버네티스 입문 (7) - 네트워킹 (0) | 2023.12.13 |
쿠버네티스 입문 (5) - 레플리카세트 (0) | 2023.12.13 |
쿠버네티스 입문 (4) - 서비스 (0) | 2023.12.12 |
쿠버네티스 입문 (3) - 파드 (0) | 2023.12.11 |