@@ -81,7 +81,9 @@ You will need to use at least two terminal windows. In the first terminal, use
81
81
of the StatefulSet's Pods.
82
82
83
83
``` shell
84
- kubectl get pods -w -l app=nginx
84
+ # use this terminal to run commands that specify --watch
85
+ # end this watch when you are asked to start a new watch
86
+ kubectl get pods --watch -l app=nginx
85
87
```
86
88
87
89
In the second terminal, use
@@ -122,7 +124,9 @@ created sequentially, ordered from _{0..n-1}_. Examine the output of the
122
124
look like the example below.
123
125
124
126
``` shell
125
- kubectl get pods -w -l app=nginx
127
+ # Do not start a new watch;
128
+ # this should already be running
129
+ kubectl get pods --watch -l app=nginx
126
130
```
127
131
```
128
132
NAME READY STATUS RESTARTS AGE
@@ -221,7 +225,9 @@ contain the Pods' IP addresses.
221
225
In one terminal, watch the StatefulSet's Pods:
222
226
223
227
``` shell
224
- kubectl get pod -w -l app=nginx
228
+ # Start a new watch
229
+ # End this watch when you've seen that the delete is finished
230
+ kubectl get pod --watch -l app=nginx
225
231
```
226
232
In a second terminal, use
227
233
[ ` kubectl delete ` ] ( /docs/reference/generated/kubectl/kubectl-commands/#delete ) to delete all
@@ -239,7 +245,8 @@ Wait for the StatefulSet to restart them, and for both Pods to transition to
239
245
Running and Ready:
240
246
241
247
``` shell
242
- kubectl get pod -w -l app=nginx
248
+ # This should already be running
249
+ kubectl get pod --watch -l app=nginx
243
250
```
244
251
```
245
252
NAME READY STATUS RESTARTS AGE
@@ -364,7 +371,9 @@ before retrying the `curl` command above.
364
371
In one terminal, watch the StatefulSet's Pods:
365
372
366
373
``` shell
367
- kubectl get pod -w -l app=nginx
374
+ # End this watch when you've reached the end of the section.
375
+ # At the start of "Scaling a StatefulSet" you'll start a new watch.
376
+ kubectl get pod --watch -l app=nginx
368
377
```
369
378
370
379
In a second terminal, delete all of the StatefulSet's Pods:
@@ -380,7 +389,8 @@ Examine the output of the `kubectl get` command in the first terminal, and wait
380
389
for all of the Pods to transition to Running and Ready.
381
390
382
391
``` shell
383
- kubectl get pod -w -l app=nginx
392
+ # This should already be running
393
+ kubectl get pod --watch -l app=nginx
384
394
```
385
395
```
386
396
NAME READY STATUS RESTARTS AGE
@@ -421,7 +431,10 @@ This is accomplished by updating the `replicas` field. You can use either
421
431
In one terminal window, watch the Pods in the StatefulSet:
422
432
423
433
``` shell
424
- kubectl get pods -w -l app=nginx
434
+ # If you already have a watch running, you can continue using that.
435
+ # Otherwise, start one.
436
+ # End this watch when there are 5 healthy Pods for the StatefulSet
437
+ kubectl get pods --watch -l app=nginx
425
438
```
426
439
427
440
In another terminal window, use ` kubectl scale ` to scale the number of replicas
@@ -438,7 +451,8 @@ Examine the output of the `kubectl get` command in the first terminal, and wait
438
451
for the three additional Pods to transition to Running and Ready.
439
452
440
453
``` shell
441
- kubectl get pods -w -l app=nginx
454
+ # This should already be running
455
+ kubectl get pod --watch -l app=nginx
442
456
```
443
457
```
444
458
NAME READY STATUS RESTARTS AGE
@@ -470,7 +484,8 @@ subsequent Pod.
470
484
In one terminal, watch the StatefulSet's Pods:
471
485
472
486
``` shell
473
- kubectl get pods -w -l app=nginx
487
+ # End this watch when there are only 3 Pods for the StatefulSet
488
+ kubectl get pod --watch -l app=nginx
474
489
```
475
490
476
491
In another terminal, use ` kubectl patch ` to scale the StatefulSet back down to
@@ -486,7 +501,8 @@ statefulset.apps/web patched
486
501
Wait for ` web-4 ` and ` web-3 ` to transition to Terminating.
487
502
488
503
``` shell
489
- kubectl get pods -w -l app=nginx
504
+ # This should already be running
505
+ kubectl get pods --watch -l app=nginx
490
506
```
491
507
```
492
508
NAME READY STATUS RESTARTS AGE
@@ -565,7 +581,10 @@ statefulset.apps/web patched
565
581
In another terminal, watch the Pods in the StatefulSet:
566
582
567
583
``` shell
568
- kubectl get pod -l app=nginx -w
584
+ # End this watch when the rollout is complete
585
+ #
586
+ # If you're not sure, leave it running one more minute
587
+ kubectl get pod -l app=nginx --watch
569
588
```
570
589
The output is similar to:
571
590
```
@@ -671,7 +690,8 @@ pod "web-2" deleted
671
690
Wait for the Pod to be Running and Ready.
672
691
673
692
``` shell
674
- kubectl get pod -l app=nginx -w
693
+ # End the watch when you see that web-2 is healthy
694
+ kubectl get pod -l app=nginx --watch
675
695
```
676
696
```
677
697
NAME READY STATUS RESTARTS AGE
@@ -703,6 +723,8 @@ you specified [above](#staging-an-update).
703
723
Patch the StatefulSet to decrement the partition:
704
724
705
725
``` shell
726
+ # The value of "partition" should match the highest existing ordinal for
727
+ # the StatefulSet
706
728
kubectl patch statefulset web -p ' {"spec":{"updateStrategy":{"type":"RollingUpdate","rollingUpdate":{"partition":2}}}}'
707
729
```
708
730
```
@@ -712,7 +734,8 @@ statefulset.apps/web patched
712
734
Wait for ` web-2 ` to be Running and Ready.
713
735
714
736
``` shell
715
- kubectl get pod -l app=nginx -w
737
+ # This should already be running
738
+ kubectl get pod -l app=nginx --watch
716
739
```
717
740
```
718
741
NAME READY STATUS RESTARTS AGE
@@ -748,7 +771,8 @@ pod "web-1" deleted
748
771
Wait for the ` web-1 ` Pod to be Running and Ready.
749
772
750
773
``` shell
751
- kubectl get pod -l app=nginx -w
774
+ # This should already be running
775
+ kubectl get pod -l app=nginx --watch
752
776
```
753
777
The output is similar to:
754
778
```
@@ -801,7 +825,8 @@ statefulset.apps/web patched
801
825
Wait for all of the Pods in the StatefulSet to become Running and Ready.
802
826
803
827
``` shell
804
- kubectl get pod -l app=nginx -w
828
+ # This should already be running
829
+ kubectl get pod -l app=nginx --watch
805
830
```
806
831
The output is similar to:
807
832
```
@@ -856,7 +881,8 @@ deleted.
856
881
In one terminal window, watch the Pods in the StatefulSet.
857
882
858
883
```
859
- kubectl get pods -w -l app=nginx
884
+ # End this watch when there are no Pods for the StatefulSet
885
+ kubectl get pods --watch -l app=nginx
860
886
```
861
887
862
888
Use [ ` kubectl delete ` ] ( /docs/reference/generated/kubectl/kubectl-commands/#delete ) to delete the
@@ -909,7 +935,8 @@ As the `web` StatefulSet has been deleted, `web-0` has not been relaunched.
909
935
In one terminal, watch the StatefulSet's Pods.
910
936
911
937
``` shell
912
- kubectl get pods -w -l app=nginx
938
+ # Leave this watch running until the next time you start a watch
939
+ kubectl get pods --watch -l app=nginx
913
940
```
914
941
915
942
In a second terminal, recreate the StatefulSet. Note that, unless
@@ -930,7 +957,8 @@ headless Service even though that Service already exists.
930
957
Examine the output of the ` kubectl get ` command running in the first terminal.
931
958
932
959
``` shell
933
- kubectl get pods -w -l app=nginx
960
+ # This should already be running
961
+ kubectl get pods --watch -l app=nginx
934
962
```
935
963
```
936
964
NAME READY STATUS RESTARTS AGE
@@ -977,7 +1005,8 @@ PersistentVolume was remounted.
977
1005
In one terminal window, watch the Pods in the StatefulSet.
978
1006
979
1007
``` shell
980
- kubectl get pods -w -l app=nginx
1008
+ # Leave this running until the next page section
1009
+ kubectl get pods --watch -l app=nginx
981
1010
```
982
1011
983
1012
In another terminal, delete the StatefulSet again. This time, omit the
@@ -995,7 +1024,8 @@ Examine the output of the `kubectl get` command running in the first terminal,
995
1024
and wait for all of the Pods to transition to Terminating.
996
1025
997
1026
``` shell
998
- kubectl get pods -w -l app=nginx
1027
+ # This should already be running
1028
+ kubectl get pods --watch -l app=nginx
999
1029
```
1000
1030
1001
1031
```
@@ -1108,7 +1138,8 @@ of the `web` StatefulSet is set to `Parallel`.
1108
1138
In one terminal, watch the Pods in the StatefulSet.
1109
1139
1110
1140
``` shell
1111
- kubectl get pod -l app=nginx -w
1141
+ # Leave this watch running until the end of the section
1142
+ kubectl get pod -l app=nginx --watch
1112
1143
```
1113
1144
1114
1145
In another terminal, create the StatefulSet and Service in the manifest:
@@ -1124,7 +1155,8 @@ statefulset.apps/web created
1124
1155
Examine the output of the ` kubectl get ` command that you executed in the first terminal.
1125
1156
1126
1157
``` shell
1127
- kubectl get pod -l app=nginx -w
1158
+ # This should already be running
1159
+ kubectl get pod -l app=nginx --watch
1128
1160
```
1129
1161
```
1130
1162
NAME READY STATUS RESTARTS AGE
@@ -1177,7 +1209,8 @@ kubectl delete sts web
1177
1209
1178
1210
You can watch ` kubectl get ` to see those Pods being deleted.
1179
1211
``` shell
1180
- kubectl get pod -l app=nginx -w
1212
+ # end the watch when you've seen what you need to
1213
+ kubectl get pod -l app=nginx --watch
1181
1214
```
1182
1215
```
1183
1216
web-3 1/1 Terminating 0 9m
0 commit comments