Tutorial: Restarting a Worker Node
In certain scenarios, you might want to manually restart one or multiple worker nodes without deleting and recreating them. For example, you can restart you worker nodes before a scheduled IaaS maintenance to migrate your worker nodes to a different hypervisor.
To stop and start a worker node, you need to annotate the concerned nodes with the nplc.oks.outscale.com/mark-for-stop-start annotation.
|
To ensure that your cluster works properly, we recommend you restart your worker nodes one by one. You should also make sure that the workloads of your clusters are running correctly before restarting the next node. |
Listing Your Worker Nodes
Before you begin:
|
To list the worker nodes of a cluster, use the following command:
$ kubectl get nodes -L nplc.oks.outscale.com/instance-id
NAME STATUS ROLES AGE VERSION INSTANCE-ID
ip-12-34-56-789 Ready <none> 10m v1.35.1 i-12345678
ip-23-45-67-8 Ready <none> 10m v1.35.1 i-23456789
ip-34-56-78-91 Ready <none> 10m v1.35.1 i-34567890
ip-56-78-90-12 Ready <none> 10m v1.35.1 i-45678901
This command returns information about your worker nodes, including their name and instance-id which corresponds to the VM ID.
Annotating a Worker Node
Available Annotations
When you annotate a worker node to restart it, you can specify different tasks to customize the restart process. The supported tasks and annotations are:
-
(optional)
drain: Drains the worker node. -
(optional)
update: Updates the internal configuration of the worker node. -
force: Stops and starts the node. This task is enabled by default for thedrainandupdatetasks.
To indicate the task(s) to execute, specify them as a comma-separated list in your annotation:
# drains the node, stops it, updates its configuration and starts it again
nplc.oks.outscale.com/mark-for-stop-start: drain,update
# drains the node, stops it and starts it again
nplc.oks.outscale.com/mark-for-stop-start: drain
# stops, updates its configuration and starts it again
nplc.oks.outscale.com/mark-for-stop-start: update
# stops the node and starts it again
nplc.oks.outscale.com/mark-for-stop-start: force
|
We recommend you drain your nodes to ensure a smooth restart process. |
Applying an Annotation to Restart a Worker Node
To restart a worker node, apply the desired annotation to it using the following command:
$ kubectl annotate node NAME_OF_NODE "nplc.oks.outscale.com/mark-for-stop-start=<ANNOTATION_VALUE>"
node/ip-12-34-56-789 annotated
This command annotates your node, and starts the restart process with the different tasks that you specified in your annotation.
|
You can check that the annotation has been correctly applied using the following command: Request sample
Result sample
|
|
The annotation disappears once your node has properly restarted. |
Related Pages