"애플리케이션 카나리 롤아웃 수행"의 두 판 사이의 차이

71번째 줄: 71번째 줄:
   type: NodePort
   type: NodePort
</syntaxhighlight>
</syntaxhighlight>
 
<syntaxhighlight lang='console'>
$ k apply -f /wonderful/v2.yaml
Warning: resource deployments/wonderful-v1 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.
deployment.apps/wonderful-v1 configured
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
</syntaxhighlight>


[[분류: killer-shell-ckad]]
[[분류: killer-shell-ckad]]

2024년 6월 6일 (목) 15:27 판

1 개요

애플리케이션의 카나리 롤아웃 수행

2 시나리오

  • "wonderful" 애플리케이션이 default 네임스페이스에서 실행중이고, 애플리케이션 YAML은 /wonderful/init.yaml에 있음
  • 기존 애플리케이션을 바탕으로 이미지 nginx:alpine 를 사용하는 새 Deployment wonderful-v2 생성
  • 단, 카나리 접근방식 적용
    • 요청의 20%는 새 이미지, 80%는 예전 이미지를 히트하도록 설정

3 실습

$ cp /wonderful/init.yaml /wonderful/v2.yaml
$ vi /wonderful/v2.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: wonderful
  name: wonderful-v1
spec:
  replicas: 8
  selector:
    matchLabels:
      app: wonderful
  template:
    metadata:
      labels:
        app: wonderful
    spec:
      containers:
      - image: httpd:alpine
        name: httpd
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: wonderful
  name: wonderful-v2
spec:
  replicas: 2
  selector:
    matchLabels:
      app: wonderful
  template:
    metadata:
      labels:
        app: wonderful
    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
  type: NodePort
$ k apply -f /wonderful/v2.yaml 
Warning: resource deployments/wonderful-v1 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.
deployment.apps/wonderful-v1 configured
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
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}