Whether the node is gracefully shut down or experiences an abnormal crash, the virtual machine Pods running on that node will not automatically migrate to other healthy nodes.
The platform implements a virtual machine solution based on the open-source component KubeVirt. However, from the perspective of KubeVirt, it cannot differentiate between an actual virtual machine crash and a connection failure caused by network or other issues. If virtual machines are migrated to other nodes indiscriminately, it may lead to multiple instances of the same virtual machine existing concurrently.
When maintaining virtual machine nodes, manual actions are required according to this document. For both graceful shutdown and abnormal crash situations, virtual machine Pods must be manually evicted or forcibly deleted.
Note: The following commands must be executed on the Master node of the corresponding cluster.
In the CLI tool, execute the following command to obtain node information. The NAME
field in the returned information is the Node-Name
.
Output:
(Optional) Execute the following command to view the virtual machine instances under the node.
Output:
Before the graceful shutdown, execute the following command to evict all virtual machine Pods on the node to be shut down. If the output appears as follows, it indicates that the eviction was successful.
Output:
After all virtual machines are started on other nodes, shut down the node.
After the node is shut down and rebooted, execute the following command to mark the node as schedulable.
Output:
At this point, the original virtual machine instances on that node have been migrated to other healthy nodes, and this node is now available for new Pod scheduling after rebooting.
In the CLI tool, execute the following command to obtain node information. The NAME
field in the returned information is the Node-Name
.
Output:
Execute the following command to forcibly delete all virtual machine Pods on the node.
Execute the following command to delete the volume attachments on that node.
Execute the following command to query if there are Pods with the label kubevirt.io=virt-api on the node that crashed abnormally.
If they exist, execute the following command to delete the Pods.
Execute the following command to query if there are Pods with the label kubevirt.io=virt-controller on the node that crashed abnormally.
If they exist, execute the following command to delete the Pods.
At this point, the virtual machine instances will be migrated to other healthy nodes after the node experiences an abnormal shutdown.