Stop and restart an Azure Kubernetes Service cluster
Applies to: AKS on Azure Stack HCI 22H2, AKS on Windows Server
In AKS enabled by Azure Arc, your workloads might not need to run continuously. To save resource costs, you can stop (or shut down) your Azure Kubernetes Service (AKS) cluster. To stop a cluster, run the commands described in this article from your Hyper-V host to power down the different components. This article also describes how to restart a stopped cluster, and how to verify that the control plane nodes are running after a restart.
Before you begin
This article assumes you have an existing Kubernetes cluster installed and configured on your machine. If you need to install a cluster, see the AKS Arc quickstart to set up an AKS host and deploy a workload cluster.
Stop a cluster
To stop (or shut down) a cluster, you must stop the cluster service and then stop the local and/or remote computers.
Stop the cluster service
Use the Stop-Cluster PowerShell command to shut down a cluster and stop the cluster service on all nodes in the cluster. Running this command stops all services and applications configured in the cluster.
Important
When you run Stop-Cluster
, all other nodes and VM-based applications in the cluster are affected.
To stop the cluster service on all nodes of the local cluster, open PowerShell as an administrator and run the following command on one of the machines in the cluster:
Stop-Cluster
After you run the command, type Y (Yes) to confirm that you want to stop the cluster.
Note
If you run Stop-Cluster
twice on the same machine, or on more than one machine in the cluster, you receive a message that says "No cluster service running."
Stop local and remote computers
To shut down the local and remote computers, use the Stop-Computer PowerShell command:
Stop-Computer
Start a cluster
To restart a stopped cluster, you first restart the operating system on the local and/or remote computers, and then restart the cluster.
To restart the operating system on your local and remote computers, use the following Restart-Computer PowerShell command:
Restart-Computer
To restart all the nodes of the cluster, use the Start-Cluster PowerShell command:
Start-Cluster
A node can only function as part of a cluster when the cluster service is running.
Note
You cannot remotely run Start-Cluster
without CredSSP authentication on the server machine.
To verify that your cluster started, use the Get-ClusterNode PowerShell command as shown in the following example:
Get-ClusterNode -ErrorAction SilentlyContinue | foreach-object {
$node = $_.Name
$state = $_.State
Write-Host "$node State = $state"
}
The output is similar to the following list of cluster nodes:
TK5-3WP15R1625 State = Up
TK5-3WP15R1627 State = Up
TK5-3WP15R1629 State = Up
TK5-3WP15R1631 State = Up
Verify the control plane nodes are running
To verify that the control plane nodes are running, enumerate the VMs, and make sure their state is running.
To view the status of your control plane VM from your Hyper-V host, run the following PowerShell command on a physical machine that contains the management cluster control plane VM:
$controlPlanes = Get-VM | ? { $_.Name -like '*-control-plane-*' -and $_.State -eq 'Running' } | % { $_.Name }
The example output is shown here. If you run this command on a machine other than the one with the control plane VM, you receive a null output:
c8bf39ad-67bd-4a7d-ac77-638be6eecf46-control-plane-0-d38498de
my-cluster-control-plane-q9mbp-ae97a3e5
If the control plane node isn't running, restart the VM by running the following PowerShell command:
Restart-VM -name $vmName -force