Blue·Green 배포
: Blue 리소스를 구성하고 Selector로 서비스와 맵핑한 상태에서 Green 리소스를 구성하고 서비스의 Selector를 Green으로 변경Canary 배포
: v1과 v2 리소스를 구성하고 두 리소스를 Selector로 서비스와 맵핑한 상태에서 v2의 레플리카 개수를 점진적으로 증가시킴과 동시에 v1의 개수를 감소시키다 마지막에는 v1 리소스 삭제1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | apiVersion: apps/v1 kind: Deployment metadata: name: resource-blue namespace: default spec: replicas: 5 selector: matchLabels: app: resource-blue strategy: rollingUpdate: maxSurge: 25% maxUnavailable: 25% type: RollingUpdate template: metadata: labels: app: resource-blue spec: containers: - image: nginx name: nginx restartPolicy: Always | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 | apiVersion: v1 kind: Service metadata: name: blue-green spec: ports: - name: "80" port: 80 protocol: TCP targetPort: 80 selector: app: resource-blue type: NodePort | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | apiVersion: apps/v1 kind: Deployment metadata: name: resource-green namespace: default spec: replicas: 5 selector: matchLabels: app: resource-green strategy: rollingUpdate: maxSurge: 25% maxUnavailable: 25% type: RollingUpdate template: metadata: labels: app: resource-green spec: containers: - image: httpd name: httpd restartPolicy: Always | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | apiVersion: apps/v1 kind: Deployment metadata: name: canary-v1 namespace: default spec: replicas: 5 selector: matchLabels: app: canary strategy: rollingUpdate: maxSurge: 25% maxUnavailable: 25% type: RollingUpdate template: metadata: labels: app: canary spec: containers: - image: nginx name: nginx restartPolicy: Always | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | apiVersion: apps/v1 kind: Deployment metadata: name: canary-v2 namespace: default spec: replicas: 1 selector: matchLabels: app: canary strategy: rollingUpdate: maxSurge: 25% maxUnavailable: 25% type: RollingUpdate template: metadata: labels: app: canary spec: containers: - image: httpd name: httpd restartPolicy: Always | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 | apiVersion: v1 kind: Service metadata: name: svc-canary spec: ports: - name: "80" port: 80 protocol: TCP targetPort: 80 selector: app: canary type: NodePort | cs |