1
1
---
2
+
3
+
2
4
title : 디플로이먼트
3
5
feature :
4
6
title : 자동화된 롤아웃과 롤백
@@ -74,7 +76,6 @@ kubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml
74
76
```
75
77
76
78
77
-
78
79
2 . ` kubectl get deployments ` 을 실행해서 디플로이먼트가 생성되었는지 확인한다.
79
80
80
81
만약 디플로이먼트가 여전히 생성 중이면, 다음과 유사하게 출력된다.
@@ -163,7 +164,7 @@ kubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml
163
164
1 . ` nginx:1.14.2 ` 이미지 대신 ` nginx:1.16.1 ` 이미지를 사용하도록 nginx 파드를 업데이트 한다.
164
165
165
166
``` shell
166
- kubectl deployment.apps/nginx-deployment set image deployment.v1.apps/nginx-deployment nginx=nginx:1.16.1
167
+ kubectl set image deployment.v1.apps/nginx-deployment nginx=nginx:1.16.1
167
168
```
168
169
169
170
또는 다음의 명령어를 사용한다.
@@ -181,7 +182,7 @@ kubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml
181
182
대안으로 디플로이먼트를 ` edit` 해서 ` .spec.template.spec.containers[0].image` 를 ` nginx:1.14.2` 에서 ` nginx:1.16.1` 로 변경한다.
182
183
183
184
` ` ` shell
184
- kubectl edit deployment.v1.apps /nginx-deployment
185
+ kubectl edit deployment/nginx-deployment
185
186
` ` `
186
187
187
188
다음과 유사하게 출력된다.
@@ -364,7 +365,7 @@ API 버전 `apps/v1` 에서 디플로이먼트의 레이블 셀렉터는 생성
364
365
* 디플로이먼트를 업데이트하는 동안 이미지 이름을 ` nginx:1.16.1 ` 이 아닌 ` nginx:1.161 ` 로 입력해서 오타를 냈다고 가정한다.
365
366
366
367
``` shell
367
- kubectl set image deployment.v1.apps /nginx-deployment nginx=nginx:1.161
368
+ kubectl set image deployment/nginx-deployment nginx=nginx:1.161
368
369
```
369
370
370
371
이와 유사하게 출력된다.
@@ -473,33 +474,33 @@ API 버전 `apps/v1` 에서 디플로이먼트의 레이블 셀렉터는 생성
473
474
474
475
1. 먼저 이 디플로이먼트의 수정 사항을 확인한다.
475
476
` ` ` shell
476
- kubectl rollout history deployment.v1.apps /nginx-deployment
477
+ kubectl rollout history deployment/nginx-deployment
477
478
` ` `
478
479
이와 유사하게 출력된다.
479
480
` ` `
480
481
deployments " nginx-deployment"
481
482
REVISION CHANGE-CAUSE
482
483
1 kubectl apply --filename=https://k8s.io/examples/controllers/nginx-deployment.yaml
483
- 2 kubectl set image deployment.v1.apps /nginx-deployment nginx=nginx:1.16.1
484
- 3 kubectl set image deployment.v1.apps /nginx-deployment nginx=nginx:1.161
484
+ 2 kubectl set image deployment/nginx-deployment nginx=nginx:1.16.1
485
+ 3 kubectl set image deployment/nginx-deployment nginx=nginx:1.161
485
486
` ` `
486
487
487
488
` CHANGE-CAUSE` 는 수정 생성시 디플로이먼트 주석인 ` kubernetes.io/change-cause` 에서 복사한다. 다음에 대해 ` CHANGE-CAUSE` 메시지를 지정할 수 있다.
488
489
489
- * 디플로이먼트에 ` kubectl annotate deployment.v1.apps /nginx-deployment kubernetes.io/change-cause=" image updated to 1.16.1" ` 로 주석을 단다.
490
+ * 디플로이먼트에 ` kubectl annotate deployment/nginx-deployment kubernetes.io/change-cause=" image updated to 1.16.1" ` 로 주석을 단다.
490
491
* 수동으로 리소스 매니페스트 편집.
491
492
492
493
2. 각 수정 버전의 세부 정보를 보려면 다음을 실행한다.
493
494
` ` ` shell
494
- kubectl rollout history deployment.v1.apps /nginx-deployment --revision=2
495
+ kubectl rollout history deployment/nginx-deployment --revision=2
495
496
` ` `
496
497
497
498
이와 유사하게 출력된다.
498
499
` ` `
499
500
deployments " nginx-deployment" revision 2
500
501
Labels: app=nginx
501
502
pod-template-hash=1159050644
502
- Annotations: kubernetes.io/change-cause=kubectl set image deployment.v1.apps /nginx-deployment nginx=nginx:1.16.1
503
+ Annotations: kubernetes.io/change-cause=kubectl set image deployment/nginx-deployment nginx=nginx:1.16.1
503
504
Containers:
504
505
nginx:
505
506
Image: nginx:1.16.1
@@ -516,7 +517,7 @@ API 버전 `apps/v1` 에서 디플로이먼트의 레이블 셀렉터는 생성
516
517
517
518
1. 이제 현재 롤아웃의 실행 취소 및 이전 수정 버전으로 롤백 하기로 결정했다.
518
519
` ` ` shell
519
- kubectl rollout undo deployment.v1.apps /nginx-deployment
520
+ kubectl rollout undo deployment/nginx-deployment
520
521
` ` `
521
522
522
523
이와 유사하게 출력된다.
@@ -526,7 +527,7 @@ API 버전 `apps/v1` 에서 디플로이먼트의 레이블 셀렉터는 생성
526
527
Alternatively, you can rollback to a specific revision by specifying it with ` --to-revision` :
527
528
528
529
` ` ` shell
529
- kubectl rollout undo deployment.v1.apps /nginx-deployment --to-revision=2
530
+ kubectl rollout undo deployment/nginx-deployment --to-revision=2
530
531
` ` `
531
532
532
533
이와 유사하게 출력된다.
@@ -560,7 +561,7 @@ API 버전 `apps/v1` 에서 디플로이먼트의 레이블 셀렉터는 생성
560
561
CreationTimestamp: Sun, 02 Sep 2018 18:17:55 -0500
561
562
Labels: app=nginx
562
563
Annotations: deployment.kubernetes.io/revision=4
563
- kubernetes.io/change-cause=kubectl set image deployment.v1.apps /nginx-deployment nginx=nginx:1.16.1
564
+ kubernetes.io/change-cause=kubectl set image deployment/nginx-deployment nginx=nginx:1.16.1
564
565
Selector: app=nginx
565
566
Replicas: 3 desired | 3 updated | 3 total | 3 available | 0 unavailable
566
567
StrategyType: RollingUpdate
@@ -603,7 +604,7 @@ API 버전 `apps/v1` 에서 디플로이먼트의 레이블 셀렉터는 생성
603
604
다음 명령어를 사용해서 디플로이먼트의 스케일을 할 수 있다.
604
605
605
606
` ` ` shell
606
- kubectl scale deployment.v1.apps /nginx-deployment --replicas=10
607
+ kubectl scale deployment/nginx-deployment --replicas=10
607
608
` ` `
608
609
이와 유사하게 출력된다.
609
610
` ` `
@@ -615,7 +616,7 @@ deployment.apps/nginx-deployment scaled
615
616
실행할 최소 파드 및 최대 파드의 수를 선택할 수 있다.
616
617
617
618
` ` ` shell
618
- kubectl autoscale deployment.v1.apps /nginx-deployment --min=10 --max=15 --cpu-percent=80
619
+ kubectl autoscale deployment/nginx-deployment --min=10 --max=15 --cpu-percent=80
619
620
` ` `
620
621
이와 유사하게 출력된다.
621
622
` ` `
@@ -644,7 +645,7 @@ deployment.apps/nginx-deployment scaled
644
645
645
646
* 클러스터 내부에서 확인할 수 없는 새 이미지로 업데이트 된다.
646
647
` ` ` shell
647
- kubectl set image deployment.v1.apps /nginx-deployment nginx=nginx:sometag
648
+ kubectl set image deployment/nginx-deployment nginx=nginx:sometag
648
649
` ` `
649
650
650
651
이와 유사하게 출력된다.
@@ -723,7 +724,7 @@ nginx-deployment-618515232 11 11 11 7m
723
724
724
725
* 다음 명령을 사용해서 일시 중지한다.
725
726
` ` ` shell
726
- kubectl rollout pause deployment.v1.apps /nginx-deployment
727
+ kubectl rollout pause deployment/nginx-deployment
727
728
` ` `
728
729
729
730
이와 유사하게 출력된다.
@@ -733,7 +734,7 @@ nginx-deployment-618515232 11 11 11 7m
733
734
734
735
* 그런 다음 디플로이먼트의 이미지를 업데이트 한다.
735
736
` ` ` shell
736
- kubectl set image deployment.v1.apps /nginx-deployment nginx=nginx:1.16.1
737
+ kubectl set image deployment/nginx-deployment nginx=nginx:1.16.1
737
738
` ` `
738
739
739
740
이와 유사하게 출력된다.
@@ -743,7 +744,7 @@ nginx-deployment-618515232 11 11 11 7m
743
744
744
745
* 새로운 롤아웃이 시작되지 않는다.
745
746
` ` ` shell
746
- kubectl rollout history deployment.v1.apps /nginx-deployment
747
+ kubectl rollout history deployment/nginx-deployment
747
748
` ` `
748
749
749
750
이와 유사하게 출력된다.
@@ -765,7 +766,7 @@ nginx-deployment-618515232 11 11 11 7m
765
766
766
767
* 예를 들어 사용할 리소스를 업데이트하는 것처럼 원하는 만큼 업데이트할 수 있다.
767
768
` ` ` shell
768
- kubectl set resources deployment.v1.apps /nginx-deployment -c=nginx --limits=cpu=200m,memory=512Mi
769
+ kubectl set resources deployment/nginx-deployment -c=nginx --limits=cpu=200m,memory=512Mi
769
770
` ` `
770
771
771
772
이와 유사하게 출력된다.
@@ -778,7 +779,7 @@ nginx-deployment-618515232 11 11 11 7m
778
779
779
780
* 결국, 디플로이먼트를 재개하고 새로운 레플리카셋이 새로운 업데이트를 제공하는 것을 관찰한다.
780
781
` ` ` shell
781
- kubectl rollout resume deployment.v1.apps /nginx-deployment
782
+ kubectl rollout resume deployment/nginx-deployment
782
783
` ` `
783
784
784
785
이와 유사하게 출력된다.
@@ -888,7 +889,7 @@ echo $?
888
889
10분 후 디플로이먼트에 대한 진행 상태의 부족에 대한 리포트를 수행하게 한다.
889
890
890
891
` ` ` shell
891
- kubectl patch deployment.v1.apps /nginx-deployment -p ' {"spec":{"progressDeadlineSeconds":600}}'
892
+ kubectl patch deployment/nginx-deployment -p ' {"spec":{"progressDeadlineSeconds":600}}'
892
893
` ` `
893
894
이와 유사하게 출력된다.
894
895
` ` `
@@ -999,7 +1000,7 @@ Conditions:
999
1000
` kubectl rollout status` 는 디플로이먼트의 진행 데드라인을 초과하면 0이 아닌 종료 코드를 반환한다.
1000
1001
1001
1002
` ` ` shell
1002
- kubectl rollout status deployment.v1.apps /nginx-deployment
1003
+ kubectl rollout status deployment/nginx-deployment
1003
1004
` ` `
1004
1005
이와 유사하게 출력된다.
1005
1006
` ` `
0 commit comments