You are viewing documentation for KubeSphere version:v3.0.0

KubeSphere v3.0.0 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date documentation, see the latest version.

Kubernetes 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 Kubernetes Cluster Gracefully

You can restart a Kubernetes 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 all master nodes’ status

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

kubectl get nodes -l

Step 4: Check all worker nodes’ status

kubectl get nodes -l

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