File tree Expand file tree Collapse file tree 2 files changed +2
-37
lines changed
behavorial/SingletonService Expand file tree Collapse file tree 2 files changed +2
-37
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,6 @@ kubectl drain --ignore-daemonsets node01 >/dev/null 2>&1 &
3636
3737We do the removing of the node in the background, so that we can watch how the Pods are relocated:
3838
39-
4039[source, bash]
4140----
4241watch kubectl get pods -o=custom-columns=NAME:.metadata.name,NODE:.spec.nodeName
@@ -58,37 +57,3 @@ and restore the Deployment with
5857kubectl scale deployment random-generator --replicas 0
5958kubectl scale deployment random-generator --replicas 6
6059----
61-
62-
63-
64-
65-
66- For the rest of the example we are watching the Pods in the console by putting the following command into the background
67-
68- [source, bash]
69- ----
70- kubectl get pods -w &
71- ----
72-
73-
74- Let's switch to version 2.0:
75-
76- [source, bash]
77- ----
78- kubectl set image deployment random-generator random-generator=k8spatterns/random-generator:2.0
79- ----
80-
81- You will remark that first all 1.0 Pods are stopped before the new Pods with version 2.0 are started.
82-
83- Now let's introduce a PodDisruptionBudget with the following commands.
84-
85- This will ensure that always two Pods are running.
86- We can check this by switching back to version 1.0 of our image and watching the Pods stopping and starting
87-
88- kubectl set image deployment random-generator random-generator=k8spatterns/random-generator:1.0
89-
90-
91-
92- The PDB use Pod selector which maches on the labels `app=random-generator`
93-
94- Let's create such Pods with
Original file line number Diff line number Diff line change @@ -21,12 +21,12 @@ spec:
2121 env :
2222 # Tell random-generator to wait 5 seconds when starting up
2323 - name : DELAY_STARTUP
24- value : " 10 "
24+ value : " 5 "
2525 livenessProbe :
2626 httpGet :
2727 path : /actuator/health
2828 port : 8080
29- initialDelaySeconds : 10
29+ initialDelaySeconds : 20
3030 readinessProbe :
3131 # We are checking for a file created by our app when its ready
3232 exec :
You can’t perform that action at this time.
0 commit comments