This document explains the lifecycle of a cluster node in Cluster Director. A
node in a cluster transitions through various states from its creation to its
deletion. Understanding these states lets you do the following:

- **Manage resources and costs**: understand when Cluster Director
  provisions and stops dynamic nodes to run queued jobs and reduce unnecessary
  charges.

- **Minimize disruptions**: anticipate planned host maintenance events.

- **Troubleshoot errors**: identify why a node fails to boot, restart, or
  resume.

TPU nodes in a slice share the same lifecycle. If a TPU node undergoes
maintenance, encounters a host error, or is deleted, then all other TPU nodes in
that slice undergo the same lifecycle event. This behavior doesn't apply to GPU
or CPU nodes. To check the current state of a node,
[view the details of your cluster](https://docs.cloud.google.com/cluster-director/docs/manage/view-clusters.md.txt#describe).

## Node states

The following diagram shows the different states that Cluster Director can
set a node to:

[![State diagram for Cluster Director nodes across the
UNPROVISIONED, CREATING, ACTIVE, SUSPENDING, SUSPENDED, REPAIRING,
FAILED, and DELETING states.](https://docs.cloud.google.com/static/cluster-director/images/node-states-lifecycle.png)](https://docs.cloud.google.com/static/cluster-director/images/node-states-lifecycle.png)

The states shown in the preceding diagram are as follows:

- [Unprovisioned state](https://docs.cloud.google.com/cluster-director/docs/manage/node-lifecycle.md.txt#unprovisioned-state)

- [Creating state](https://docs.cloud.google.com/cluster-director/docs/manage/node-lifecycle.md.txt#creating-state)

- [Active state](https://docs.cloud.google.com/cluster-director/docs/manage/node-lifecycle.md.txt#active-state)

- [Suspending state](https://docs.cloud.google.com/cluster-director/docs/manage/node-lifecycle.md.txt#suspending-state)

- [Suspended state](https://docs.cloud.google.com/cluster-director/docs/manage/node-lifecycle.md.txt#suspended-state)

- [Repairing state](https://docs.cloud.google.com/cluster-director/docs/manage/node-lifecycle.md.txt#repairing-state)

- [Failed state](https://docs.cloud.google.com/cluster-director/docs/manage/node-lifecycle.md.txt#failed-state)

- [Deleting state](https://docs.cloud.google.com/cluster-director/docs/manage/node-lifecycle.md.txt#deleting-state)

### Unprovisioned state

When a node is in the `UNPROVISIONED` state, no Compute Engine instance is
assigned to the node. A node starts in the `UNPROVISIONED` state in the
following situations:

- **Slurm cluster**: Cluster Director creates a dynamic node in a
  nodeset, and the node waits until a queued job requires additional compute
  capacity.

- **Managed compute cluster**: a managed instance group (MIG) queues a node
  before Compute Engine assigns a compute instance to the node.

From the `UNPROVISIONED` state, a node can transition to one of the following
states:

- **`CREATING`**: based on the cluster type, the following occurs to the node:

  - In a Slurm cluster, you submit a job that requires more compute
    resources than the ones available in your static nodes, and
    Cluster Director attempts to allocate resources to create the
    dynamic node.

  - In a managed compute cluster, Compute Engine starts to provision
    a compute instance in the MIG.

- **`DELETING`** : you reduce the maximum dynamic node count
  (`maxDynamicNodeCount`) in a Slurm nodeset, reduce the `targetSize` of a MIG
  in a managed compute cluster, or delete the cluster.

### Creating state

When a node is in the `CREATING` state, Cluster Director attempts to
allocate resources to create and boot your node.

From this state, the node can transition to one of the following states:

- **`ACTIVE`**: when Cluster Director allocates resources for your node,
  the node boots up and starts running.

- **`FAILED`**: the node encounters a host error.

### Active state

When a node is in the `ACTIVE` state, the node is healthy, running, and ready to
run workloads.

From this state, the node can transition to one of the following states:

- **`SUSPENDING`** : you stop or suspend the node, or Cluster Director
  stops the node after it preempts a Spot VM that is configured
  to be stopped (`TERMINATE`) on preemption.

- **`REPAIRING`**: planned or unplanned host maintenance for the node starts.

- **`UNPROVISIONED`** : in a Slurm cluster, for a dynamic GPU or CPU node,
  Slurm deletes the compute instance after the node remains in the `idle`
  state for five minutes. For a dynamic TPU node, Slurm deletes the compute
  instance when the job finishes.

- **`DELETING`**: a delete operation starts after one of the following events
  occurs:

  - A Flex-start VM reaches the end of its run duration, or
    the reservation that you used to create the node reaches its end time.

  - Cluster Director preempts a Spot VM that is
    configured to be deleted (`DELETE`) on preemption.

  - You delete the node.

  - You reduce the static node count (`staticNodeCount`) or maximum dynamic
    node count (`maxDynamicNodeCount`) in a Slurm nodeset, or you reduce the
    target size (`targetSize`) of a MIG in a managed compute cluster.

  - You delete the cluster.

- **`FAILED`**: the node encounters a host error.

### Suspending state

When a node is in the `SUSPENDING` state, Cluster Director stops or
suspends the node. You can only stop GPU or CPU nodes, and you can only suspend
CPU nodes. For more information, see
[Suspend, stop, or reset Compute Engine instances](https://docs.cloud.google.com/compute/docs/instances/suspend-stop-reset-instances-overview.md.txt).

> [!CAUTION]
> **Caution:** If you stop or suspend a node, then you can only restart or resume it if you have a reservation, or if the zone has available resources when you submit your request. Stop or suspend a node only if you have reserved capacity or your workload can resume at a flexible time.

From this state, when the stop or suspend operation completes, the node
transitions to the `SUSPENDED` state.

### Suspended state

When a node is in the `SUSPENDED` state, the stop or suspend operation
completes.

From this state, the node transitions to one of the following states:

- **`ACTIVE`**: you resume or restart the node. You can only resume or restart
  a node if the zone has available resources or you have a reservation.
  Otherwise, the operation fails and the node remains stopped or suspended.

- **`DELETING`**: you delete the node or the cluster.

### Repairing state

When a node is in the `REPAIRING` state, Cluster Director stops the node
to perform host maintenance on the node's underlying Compute Engine
infrastructure. Only GPU, H4D, and TPU nodes enter this state during host
maintenance. Nodes that use N4, N4D, C4, N2D, E2, C4A, or N2 machine types,
except Spot VMs, keep running during maintenance because
Cluster Director
[*live migrates* them](https://docs.cloud.google.com/compute/docs/instances/live-migration-process.md.txt).

From this state, the node transitions to one of the following states:

- **`ACTIVE`**: when host maintenance completes, the node restarts.
  Cluster Director helps ensure that the resources needed to restart the
  node are available.

- **`FAILED`**: the node encounters a host error.

### Failed state

When a node is in the `FAILED` state, the node is unhealthy or encountered a
host error. To help you troubleshoot the issue, Cluster Director provides
details about the error in
[Logs Explorer](https://docs.cloud.google.com/cluster-director/docs/monitor/view-audit-logs.md.txt#custom-logs),
or in the `stateMessage` field when you use the Google Cloud CLI or REST API.

> [!NOTE]
> **Note:** If your node encounters an unexpected error, then contact your account team or support for help.

From this state, when you delete the node or cluster, the node transitions to
the `DELETING` state.

### Deleting state

When a node is in the `DELETING` state, Cluster Director deletes the node
and releases its resources. A node enters the `DELETING` state after one of the
following events occurs:

- A Flex-start VM reaches the end of its run duration, or the
  reservation that you used to create the node reaches its end time.

- Cluster Director preempts a Spot VM that is configured
  to be deleted (`DELETE`) on preemption.

- You delete the node.

- You reduce the static node count (`staticNodeCount`) or maximum dynamic node
  count (`maxDynamicNodeCount`) in a Slurm nodeset, or you reduce the target
  size (`targetSize`) of a MIG in a managed compute cluster.

- You delete the cluster.

When the delete operation finishes, Cluster Director deletes the node and
all of its attached resources.

## Pricing for clusters and nodes

When you create a cluster, you incur charges for the underlying Google Cloud
resources that your cluster uses:

- **Nodes** : when a node is in the `ACTIVE` state, you incur charges for
  vCPUs, memory, and any attached GPUs or TPUs. For any disks and external IP
  addresses that are attached to a node's compute instance, you incur charges
  as long as the compute instance exists, including in the `SUSPENDED` state.
  Nodes in the `UNPROVISIONED` state have no compute instance and don't incur
  charges. For more information, see the following:

  - [Virtual machines pricing](https://cloud.google.com/compute/pricing)

  - [Cloud TPU pricing](https://cloud.google.com/tpu/pricing)

- **Networking resources** : you incur charges for data transfer (*egress* ) and
  any additional networking features that your cluster uses. For more
  information, see [All networking pricing](https://cloud.google.com/vpc/network-pricing).

- **Storage resources**: you incur charges for the storage resources that your
  cluster uses, as long as those resources exist. For more information, see
  the following:

  - [Cloud Storage pricing](https://cloud.google.com/storage/pricing)

  - [Filestore pricing](https://cloud.google.com/filestore/pricing)

  - [Google Cloud Managed Lustre pricing](https://cloud.google.com/products/managed-lustre/pricing)

For more information, review the
[pricing for Cluster Director](https://cloud.google.com/products/cluster-director#pricing).

## What's next

- [Modify a cluster](https://docs.cloud.google.com/cluster-director/docs/manage/modify-cluster.md.txt)

- [Delete a cluster](https://docs.cloud.google.com/cluster-director/docs/manage/delete-cluster.md.txt)