Enable maintenance mode on a cluster and machine using CLI¶
You can use the instructions below to enable maintenance mode on a cluster and machine using the MOSK management API. To enable maintenance mode using the MOSK management console, refer to Enable maintenance mode on a cluster and machine using management console.
Caution
To enable maintenance mode on a machine, first enable maintenance mode on the related cluster.
To disable maintenance mode on a cluster, first disable maintenance mode on all machines of the cluster.
Warning
During cluster and machine maintenance:
Cluster upgrades and configuration changes (except of the SSH keys setting) are unavailable. Make sure you disable maintenance mode on the cluster after maintenance is complete.
Data load balancing is disabled while Ceph is in maintenance mode.
Workloads are not affected.
Enable maintenance mode on a cluster and machine¶
Log in to the host where your management cluster
kubeconfigis located and where kubectl is installed.Enable maintenance mode on the cluster:
In the
valuesection ofproviderSpecof theClusterobject, setmaintenancetotrue:kubectl patch clusters.cluster.k8s.io -n <projectName> <clusterName> --type=merge -p '{"spec":{"providerSpec":{"value":{"maintenance":true}}}}'
Replace the parameters enclosed in angle brackets with the corresponding values.
Wait until the
maintenancestatus istrue:kubectl get clusters.cluster.k8s.io -n <projectName> <clusterName> -o jsonpath='{.status.providerStatus.maintenance}'
Enable maintenance mode on the required machine:
In the
valuesection ofproviderSpecof theMachineobject, setmaintenancetotrue:kubectl patch machines.cluster.k8s.io -n <projectName> <machineName> --type=merge -p '{"spec":{"providerSpec":{"value":{"maintenance":true}}}}'
Wait until the
maintenancestatus istrue:kubectl get machines.cluster.k8s.io -n <projectName> <machineName> -o jsonpath='{.status.providerStatus.maintenance}'
Once done, the node of the selected machine is cordoned, drained, and prepared for maintenance operations.
Disable maintenance mode on a cluster and machine¶
Log in to the host where your management cluster
kubeconfigis located and where kubectl is installed.Disable maintenance mode on the machine:
In the
valuesection ofproviderSpecof theClusterobject, setmaintenancetofalse:kubectl patch machines.cluster.k8s.io -n <projectName> <machineName> --type=merge -p '{"spec":{"providerSpec":{"value":{"maintenance":false}}}}'
Wait until the machine maintenance mode disables:
kubectl get machines.cluster.k8s.io -n <projectName> <machineName> -o jsonpath='{.status.providerStatus.maintenance}'
Verify that the system output is
falseor empty.
Repeat the above steps for all machines that are in maintenance mode.
Disable maintenance mode on the cluster:
In the
valuesection ofproviderSpecof theClusterobject, setmaintenancetofalse:kubectl patch clusters.cluster.k8s.io -n <projectName> <clusterName> --type=merge -p '{"spec":{"providerSpec":{"value":{"maintenance":false}}}}'
Wait until the cluster maintenance mode disables:
kubectl get clusters.cluster.k8s.io -n <projectName> <clusterName> -o jsonpath='{.status.providerStatus.maintenance}'
Verify that the system output is
falseor empty.