Delete nodes from a cluster
You can delete a node from a OpenShift Container Platform cluster by scaling down the appropriate MachineSet object.
|
|
When a cluster is integrated with a cloud provider, you must delete the corresponding machine to delete a node. Do not try to use the |
When you delete a node by using the CLI, the node object is deleted in Kubernetes, but the pods that exist on the node are not deleted. Any bare pods that are not backed by a replication controller become inaccessible to OpenShift Container Platform. Pods backed by replication controllers are rescheduled to other available nodes. You must delete local manifest pods.
|
|
If you are running cluster on bare metal, you cannot delete a node by editing |
-
View the compute machine sets that are in the cluster by running the following command:
$ oc get machinesets -n openshift-machine-apiThe compute machine sets are listed in the form of
<cluster-id>-worker-<aws-region-az>. -
Scale down the compute machine set by using one of the following methods:
-
Specify the number of replicas to scale down to by running the following command:
$ oc scale --replicas=2 machineset <machine-set-name> -n openshift-machine-api -
Edit the compute machine set custom resource by running the following command:
$ oc edit machineset <machine-set-name> -n openshift-machine-apiExample outputapiVersion: machine.openshift.io/v1beta1 kind: MachineSet metadata: # ... name: <machine-set-name> namespace: openshift-machine-api # ... spec: replicas: 2 # ...where:
spec.replicas-
Specifies the number of replicas to scale down to.
-