애플리케이션 그린-블루 롤아웃 수행

1 개요[ | ]

애플리케이션의 그린-블루 롤아웃 수행

2 시나리오[ | ]

  • "wonderful" 애플리케이션이 default 네임스페이스에서 실행중이고, 애플리케이션 YAML은 /wonderful/init.yaml에 있음
  • 기존 애플리케이션을 바탕으로 새 Deployment wonderful-v2 생성
  • 단, 이미지는 nginx:alpine 사용, Pod에는 app: wonderfulversion: v2 레이블
  • 새 Pod이 실행되면, Service wonderfulversion: v2 레이블
  • Deployment wonderful-v1을 replicas 0으로 스케일 다운

3 실습[ | ]

$ cp /wonderful/init.yaml /wonderful/v2.yaml
$ vi /wonderful/v2.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: wonderful
  name: wonderful-v2
spec:
  replicas: 4
  selector:
    matchLabels:
      app: wonderful
      version: v2
  template:
    metadata:
      labels:
        app: wonderful
        version: v2
    spec:
      containers:
      - image: nginx:alpine
        name: httpd
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: wonderful
  name: wonderful
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80
    nodePort: 30080
  selector:
    app: wonderful
    version: v2
  type: NodePort
$ k apply -f /wonderful/v2.yaml 
deployment.apps/wonderful-v2 created
Warning: resource services/wonderful is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
service/wonderful configured
$ kubectl scale deploy wonderful-v1 --replicas 0
deployment.apps/wonderful-v1 scaled

4 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}