@@ -164,7 +164,7 @@ Follow the steps given below to update your Deployment:
164
164
1 . Let's update the nginx Pods to use the ` nginx:1.16.1 ` image instead of the ` nginx:1.14.2 ` image.
165
165
166
166
``` shell
167
- kubectl deployment.apps/nginx-deployment set image deployment.v1.apps /nginx-deployment nginx=nginx:1.16.1
167
+ kubectl deployment.apps/nginx-deployment set image deployment/nginx-deployment nginx=nginx:1.16.1
168
168
```
169
169
170
170
or use the following command:
@@ -182,7 +182,7 @@ Follow the steps given below to update your Deployment:
182
182
Alternatively, you can ` edit` the Deployment and change ` .spec.template.spec.containers[0].image` from ` nginx:1.14.2` to ` nginx:1.16.1` :
183
183
184
184
` ` ` shell
185
- kubectl edit deployment.v1.apps /nginx-deployment
185
+ kubectl edit deployment/nginx-deployment
186
186
` ` `
187
187
188
188
The output is similar to:
@@ -365,7 +365,7 @@ rolled back.
365
365
* Suppose that you made a typo while updating the Deployment, by putting the image name as ` nginx:1.161` instead of ` nginx:1.16.1` :
366
366
367
367
` ` ` shell
368
- kubectl set image deployment.v1.apps /nginx-deployment nginx=nginx:1.161
368
+ kubectl set image deployment/nginx-deployment nginx=nginx:1.161
369
369
` ` `
370
370
371
371
The output is similar to this:
@@ -474,33 +474,33 @@ Follow the steps given below to check the rollout history:
474
474
475
475
1. First, check the revisions of this Deployment:
476
476
` ` ` shell
477
- kubectl rollout history deployment.v1.apps /nginx-deployment
477
+ kubectl rollout history deployment/nginx-deployment
478
478
` ` `
479
479
The output is similar to this:
480
480
` ` `
481
481
deployments " nginx-deployment"
482
482
REVISION CHANGE-CAUSE
483
483
1 kubectl apply --filename=https://k8s.io/examples/controllers/nginx-deployment.yaml
484
- 2 kubectl set image deployment.v1.apps /nginx-deployment nginx=nginx:1.16.1
485
- 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
486
486
` ` `
487
487
488
488
` CHANGE-CAUSE` is copied from the Deployment annotation ` kubernetes.io/change-cause` to its revisions upon creation. You can specify the` CHANGE-CAUSE` message by:
489
489
490
- * Annotating the Deployment with ` kubectl annotate deployment.v1.apps /nginx-deployment kubernetes.io/change-cause=" image updated to 1.16.1" `
490
+ * Annotating the Deployment with ` kubectl annotate deployment/nginx-deployment kubernetes.io/change-cause=" image updated to 1.16.1" `
491
491
* Manually editing the manifest of the resource.
492
492
493
493
2. To see the details of each revision, run:
494
494
` ` ` shell
495
- kubectl rollout history deployment.v1.apps /nginx-deployment --revision=2
495
+ kubectl rollout history deployment/nginx-deployment --revision=2
496
496
` ` `
497
497
498
498
The output is similar to this:
499
499
` ` `
500
500
deployments " nginx-deployment" revision 2
501
501
Labels: app=nginx
502
502
pod-template-hash=1159050644
503
- 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
504
504
Containers:
505
505
nginx:
506
506
Image: nginx:1.16.1
@@ -517,7 +517,7 @@ Follow the steps given below to rollback the Deployment from the current version
517
517
518
518
1. Now you' ve decided to undo the current rollout and rollback to the previous revision:
519
519
```shell
520
- kubectl rollout undo deployment.v1.apps /nginx-deployment
520
+ kubectl rollout undo deployment/nginx-deployment
521
521
```
522
522
523
523
The output is similar to this:
@@ -527,7 +527,7 @@ Follow the steps given below to rollback the Deployment from the current version
527
527
Alternatively, you can rollback to a specific revision by specifying it with `--to-revision`:
528
528
529
529
```shell
530
- kubectl rollout undo deployment.v1.apps /nginx-deployment --to-revision=2
530
+ kubectl rollout undo deployment/nginx-deployment --to-revision=2
531
531
```
532
532
533
533
The output is similar to this:
@@ -561,7 +561,7 @@ Follow the steps given below to rollback the Deployment from the current version
561
561
CreationTimestamp: Sun, 02 Sep 2018 18:17:55 -0500
562
562
Labels: app=nginx
563
563
Annotations: deployment.kubernetes.io/revision=4
564
- 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
565
565
Selector: app=nginx
566
566
Replicas: 3 desired | 3 updated | 3 total | 3 available | 0 unavailable
567
567
StrategyType: RollingUpdate
@@ -604,7 +604,7 @@ Follow the steps given below to rollback the Deployment from the current version
604
604
You can scale a Deployment by using the following command:
605
605
606
606
```shell
607
- kubectl scale deployment.v1.apps /nginx-deployment --replicas=10
607
+ kubectl scale deployment/nginx-deployment --replicas=10
608
608
```
609
609
The output is similar to this:
610
610
```
@@ -616,7 +616,7 @@ in your cluster, you can setup an autoscaler for your Deployment and choose the
616
616
Pods you want to run based on the CPU utilization of your existing Pods.
617
617
618
618
```shell
619
- 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
620
620
```
621
621
The output is similar to this:
622
622
```
@@ -645,7 +645,7 @@ For example, you are running a Deployment with 10 replicas, [maxSurge](#max-surg
645
645
646
646
* You update to a new image which happens to be unresolvable from inside the cluster.
647
647
```shell
648
- kubectl set image deployment.v1.apps /nginx-deployment nginx=nginx:sometag
648
+ kubectl set image deployment/nginx-deployment nginx=nginx:sometag
649
649
```
650
650
651
651
The output is similar to this:
@@ -724,7 +724,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess
724
724
725
725
* Pause by running the following command:
726
726
```shell
727
- kubectl rollout pause deployment.v1.apps /nginx-deployment
727
+ kubectl rollout pause deployment/nginx-deployment
728
728
```
729
729
730
730
The output is similar to this:
@@ -734,7 +734,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess
734
734
735
735
* Then update the image of the Deployment:
736
736
```shell
737
- 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
738
738
```
739
739
740
740
The output is similar to this:
@@ -744,7 +744,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess
744
744
745
745
* Notice that no new rollout started:
746
746
```shell
747
- kubectl rollout history deployment.v1.apps /nginx-deployment
747
+ kubectl rollout history deployment/nginx-deployment
748
748
```
749
749
750
750
The output is similar to this:
@@ -766,7 +766,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess
766
766
767
767
* You can make as many updates as you wish, for example, update the resources that will be used:
768
768
```shell
769
- 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
770
770
```
771
771
772
772
The output is similar to this:
@@ -779,7 +779,7 @@ apply multiple fixes in between pausing and resuming without triggering unnecess
779
779
780
780
* Eventually, resume the Deployment and observe a new ReplicaSet coming up with all the new updates:
781
781
```shell
782
- kubectl rollout resume deployment.v1.apps /nginx-deployment
782
+ kubectl rollout resume deployment/nginx-deployment
783
783
```
784
784
785
785
The output is similar to this:
@@ -889,7 +889,7 @@ The following `kubectl` command sets the spec with `progressDeadlineSeconds` to
889
889
lack of progress for a Deployment after 10 minutes:
890
890
891
891
` ` ` shell
892
- kubectl patch deployment.v1.apps /nginx-deployment -p ' {"spec":{"progressDeadlineSeconds":600}}'
892
+ kubectl patch deployment/nginx-deployment -p ' {"spec":{"progressDeadlineSeconds":600}}'
893
893
` ` `
894
894
The output is similar to this:
895
895
` ` `
0 commit comments