Skip to content

Commit 1b70f6b

Browse files
authored
Merge pull request #36290 from xenolinux/bug1867750
BZ1867750: Replace the "ssh core@" command to shut down nodes
2 parents defd8ac + 10dfe75 commit 1b70f6b

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

modules/graceful-shutdown.adoc

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,23 @@ $ oc -n openshift-kube-apiserver-operator get secret kube-apiserver-to-kubelet-s
3737
----
3838
<1> To ensure that the cluster can restart gracefully, plan to restart it on or before the specified date. As the cluster restarts, the process might require you to manually approve the pending certificate signing requests (CSRs) to recover kubelet certificates.
3939

40-
. Shut down all of the nodes in the cluster. You can do this from your cloud provider's web console, or you can use the below commands:
41-
42-
.. Obtain the list of nodes:
40+
. Shut down all of the nodes in the cluster. You can do this from your cloud provider's web console, or run the following loop:
4341
+
4442
[source,terminal]
4543
----
46-
$ nodes=$(oc get nodes -o jsonpath='{.items[*].metadata.name}')
44+
$ for node in $(oc get nodes -o jsonpath='{.items[*].metadata.name}'); do oc debug node/${node} -- chroot /host shutdown -h 1; done
4745
----
48-
49-
.. Shut down all of the nodes:
5046
+
51-
[source,terminal]
47+
.Example output
5248
----
53-
$ for node in ${nodes[@]}
54-
do
55-
echo "==== Shut down $node ===="
56-
ssh core@$node sudo shutdown -h 1
57-
done
49+
Starting pod/ip-10-0-130-169us-east-2computeinternal-debug ...
50+
To use host binaries, run `chroot /host`
51+
Shutdown scheduled for Mon 2021-09-13 09:36:17 UTC, use 'shutdown -c' to cancel.
52+
53+
Removing debug pod ...
54+
Starting pod/ip-10-0-150-116us-east-2computeinternal-debug ...
55+
To use host binaries, run `chroot /host`
56+
Shutdown scheduled for Mon 2021-09-13 09:36:29 UTC, use 'shutdown -c' to cancel.
5857
----
5958
+
6059
Shutting down the nodes using one of these methods allows pods to terminate gracefully, which reduces the chance for data corruption.

0 commit comments

Comments
 (0)