Chapter 5. Machine phases and lifecycle
Machines move through a lifecycle that has several defined phases. Understanding the machine lifecycle and its phases can help you verify whether a procedure is complete or troubleshoot undesired behavior. In OpenShift Container Platform, the machine lifecycle is consistent across all supported cloud providers.
5.1. Machine phases
As a machine moves through its lifecycle, it passes through different phases. Each phase is a basic representation of the state of the machine.
- Provisioning
- There is a request to provision a new machine. The machine does not yet exist and does not have an instance, a provider ID, or an address.
- Provisioned
- 
							The machine exists and has a provider ID or an address. The cloud provider has created an instance for the machine. The machine has not yet become a node and the status.nodeRefsection of the machine object is not yet populated.
- Running
- 
							The machine exists and has a provider ID or address. Ignition has run successfully and the cluster machine approver has approved a certificate signing request (CSR). The machine has become a node and the status.nodeRefsection of the machine object contains node details.
- Deleting
- 
							There is a request to delete the machine. The machine object has a DeletionTimestampfield that indicates the time of the deletion request.
- Failed
- There is an unrecoverable problem with the machine. This can happen, for example, if the cloud provider deletes the instance for the machine.
5.2. The machine lifecycle
The lifecycle begins with the request to provision a machine and continues until the machine no longer exists.
The machine lifecycle proceeds in the following order. Interruptions due to errors or lifecycle hooks are not included in this overview.
- There is a request to provision a new machine for one of the following reasons: - A cluster administrator scales a machine set such that it requires additional machines.
- An autoscaling policy scales machine set such that it requires additional machines.
- A machine that is managed by a machine set fails or is deleted and the machine set creates a replacement to maintain the required number of machines.
 
- 
						The machine enters the Provisioningphase.
- The infrastructure provider creates an instance for the machine.
- 
						The machine has a provider ID or address and enters the Provisionedphase.
- The Ignition configuration file is processed.
- The kubelet issues a certificate signing request (CSR).
- The cluster machine approver approves the CSR.
- 
						The machine becomes a node and enters the Runningphase.
- An existing machine is slated for deletion for one of the following reasons: - 
								A user with cluster-adminpermissions uses theoc delete machinecommand.
- 
								The machine gets a machine.openshift.io/delete-machineannotation.
- The machine set that manages the machine marks it for deletion to reduce the replica count as part of reconciliation.
- The cluster autoscaler identifies a node that is unnecessary to meet the deployment needs of the cluster.
- A machine health check is configured to replace an unhealthy machine.
 
- 
								A user with 
- 
						The machine enters the Deletingphase, in which it is marked for deletion but is still present in the API.
- The machine controller removes the instance from the infrastructure provider.
- 
						The machine controller deletes the Nodeobject.
5.3. Determining the phase of a machine
				You can find the phase of a machine by using the OpenShift CLI (oc) or by using the web console. You can use this information to verify whether a procedure is complete or to troubleshoot undesired behavior.
			
5.3.1. Determining the phase of a machine by using the CLI
					You can find the phase of a machine by using the OpenShift CLI (oc).
				
Prerequisites
- 
							You have access to an OpenShift Container Platform cluster using an account with cluster-adminpermissions.
- 
							You have installed the ocCLI.
Procedure
- List the machines on the cluster by running the following command: - oc get machine -n openshift-machine-api - $ oc get machine -n openshift-machine-api- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - The - PHASEcolumn of the output contains the phase of each machine.
5.3.2. Determining the phase of a machine by using the web console
You can find the phase of a machine by using the OpenShift Container Platform web console.
Prerequisites
- 
							You have access to an OpenShift Container Platform cluster using an account with cluster-adminpermissions.
Procedure
- 
							Log in to the web console as a user with the cluster-adminrole.
- 
							Navigate to Compute Machines. 
- On the Machines page, select the name of the machine that you want to find the phase of.
- On the Machine details page, select the YAML tab.
- In the YAML block, find the value of the - status.phasefield.- Example YAML snippet - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - 1
- In this example, the phase isRunning.