< img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=3131724&fmt=gif" />

Cluster Shutdown and Restart

This document describes the process of gracefully shutting down your Kubernetes cluster and how to restart it. You might need to temporarily shut down your cluster for maintenance reasons.


Shutting down a cluster is very dangerous. You must fully understand the operation and its consequences. Please make an etcd backup before you proceed. Usually, it is recommended to maintain your nodes one by one instead of restarting the whole cluster.


Shut Down a Kubernetes Cluster


  • You must back up your etcd data before you shut down the cluster as your cluster can be restored if you encounter any issues when restarting the cluster.
  • Using the method in this tutorial can shut down a cluster gracefully, while the possibility of data corruption still exists.

Step 1: Get the node list

nodes=$(kubectl get nodes -o name)

Step 2: Shut down all nodes

for node in ${nodes[@]}
    echo "==== Shut down $node ===="
    ssh $node sudo shutdown -h 1

Then you can shut down other cluster dependencies, such as external storage.

Restart a Cluster Gracefully

You can restart a cluster gracefully after shutting down the cluster gracefully.


You have shut down your cluster gracefully.


Usually, a cluster can be used after restarting, but the cluster may be unavailable due to unexpected conditions. For example:

  • etcd data corruption during the shutdown.
  • Node failures.
  • Unexpected network errors.

Step 1: Check all cluster dependencies' status

Ensure all cluster dependencies are ready, such as external storage.

Step 2: Power on cluster machines

Wait for the cluster to be up and running, which may take about 10 minutes.

Step 3: Check the status of all control plane components

Check the status of core components, such as etcd services, and make sure everything is ready.

kubectl get nodes -l node-role.kubernetes.io/master

Step 4: Check all worker nodes' status

kubectl get nodes -l node-role.kubernetes.io/worker

If your cluster fails to restart, please try to restore the etcd cluster.

Receive the latest news, articles and updates from KubeSphere

Thanks for the feedback. If you have a specific question about how to use KubeSphere, ask it on Slack. Open an issue in the GitHub repo if you want to report a problem or suggest an improvement.