ComputeClass
is a Kubernetes Custom Resource Definition (CRD) that lets you
define configurations and fallback priorities for GKE node scaling
decisions. To learn more, see
About custom compute classes.
apiVersion: cloud.google.com/v1 kind: ComputeClass metadata: name: my-class spec: activeMigration: optimizeRulePriority: false autoscalingPolicy: consolidationDelayMinutes: 1 consolidationThreshold: 0 gpuConsolidationThreshold: 0 nodePoolAutoCreation: enabled: false priorities: - machineFamily: n2 maxRunDurationSeconds: 360 minCores: 16 minMemoryGb: 64 reservations: affinity: Specific specific: - name: n2-shared-reservation project: reservation-project spot: true storage: bootDiskKMSKey: projects/example/locations/us-central1/keyRings/example/cryptoKeys/key-1 secondaryBootDisks: - diskImageName: pytorch-mnist project: k8s-staging-jobset mode: CONTAINER_IMAGE_CACHE - machineType: n2-standard-32 spot: true reservations: affinity: AnyBestEffort storage: bootDiskSize: 100 bootDiskType: pd-balanced localSSDCount: 1 - nodepools: ['example-first-nodepool-name', 'example-second-nodepool-name'] - gpu: count: 1 driverVersion: default type: nvidia-l4 - tpu: count: 8 topology: "2x4" type: tpu-v5-lite-device whenUnsatisfiable: ScaleUpAnyway status: conditions: - lastTransitionTime: 2024-10-10T00:00:00Z message: example-message observedGeneration: 1 reason: example-reason status: "True" type: example-type
ComputeClass specification
metadata: name: string spec: activeMigration: object(activeMigration) autoscalingPolicy: object(autoscalingPolicy) nodePoolAutoCreation: object(nodePoolAutoCreation) priorities: [ object(priorities) ] whenUnsatisfiable: string
Fields | |
---|---|
required |
A field that identifies the compute class. |
optional |
The name of the compute class. |
required |
The compute class specification, which defines how the compute class works. |
optional |
A specification that lets you choose whether GKE automatically replaces existing nodes that are lower in a compute class priority list with new nodes that are higher in that priority list. |
optional |
A specification that lets you fine-tune the timing and thresholds that cause GKE to remove underused nodes and consolidate workloads on other nodes. |
optional |
A specification that lets you choose whether GKE can create and delete node pools in Standard mode clusters based on the compute class priority rules. Requires node auto-provisioning to be enabled on the cluster. |
required |
A list of priority rules that defines how GKE configures nodes during scaling operations. When a cluster needs to scale up, GKE tries to create nodes that match the first priority rule in this field. If GKE can't create those nodes, it attempts the next rule. The process repeats until GKE successfully creates nodes or exhausts all of the rules in the list. |
optional |
A specification that lets you define what GKE does if none of the rules in the
|
activeMigration
Choose whether GKE migrates workloads to higher priority nodes for the compute class as resources become available. For details, see Configure active migration to higher priority nodes.
activeMigration: optimizeRulePriority: boolean
Fields | |
---|---|
required |
Choose whether GKE migrates workloads to higher priority
nodes when resources are available. If you omit this field, the default
value is |
autoscalingPolicy
autoscalingPolicy: consolidationDelayMinutes: integer consolidationThreshold: integer gpuConsolidationThreshold: integer
Fields | |
---|---|
optional |
The number of minutes after which GKE removes underutilized nodes.
The value must be between |
optional |
The CPU and memory utilization threshold as a percentage of the total
resources on the node. A node becomes eligible for removal only when the
resource utilization is less than this threshold. The value must be between
|
optional |
The GPU utilization threshold as a percentage of the total GPU
resources on the node. A node becomes eligible for removal only when the
resource utilization is less than this threshold. The value must be between
Consider setting this value to either |
nodePoolAutoCreation
nodePoolAutoCreation: enabled: boolean
Fields | |
---|---|
optional |
Choose whether GKE can create and delete node pools in Standard mode
clusters based on the compute class priority rules. Requires node auto-provisioning
to be enabled on the cluster. If you omit
this field, the default value is |
priorities
- gpu: object(gpu) spot: boolean - machineFamily: string maxRunDurationSeconds: integer minCores: integer minMemoryGb: integer reservations: object(reservations) spot: boolean storage: object(storage) - machineType: string maxRunDurationSeconds: integer reservations: object(reservations) spot: boolean storage: object(storage) - nodepools: []string - tpu: object(tpu) reservations: object(reservations) spot: boolean storage: object(storage)
Fields | |
---|---|
optional |
The GPU configuration. |
optional |
The Compute Engine machine series
to use, such as |
optional |
The predefined Compute Engine machine type to use, such as
|
optional |
The maximum number of Pods that GKE can place on each
node. The value must be between |
optional |
The maximum duration, in seconds, that the nodes can exist before being shut down. If you omit this field, the nodes can exist indefinitely. |
optional |
The minimum number of vCPU cores that each node can have. If you omit
this field, the default value is |
optional |
The minimum memory capacity, in GiB, that each node can have. If you omit
this field, the default value is |
optional |
A list of existing manually created node pools in Standard mode clusters. You must associate these node pools with the compute class by using node labels and node taints. GKE doesn't process the node pools in this list in any order. Example: |
optional |
The Compute Engine capacity reservations to consume during node provisioning. |
optional |
The Spot VMs configuration. If you set this field to |
optional |
The boot disk configuration of each node. |
optional |
The TPU configuration. |
gpu
gpu: count: integer driverVersion: string type: string
Fields | |
---|---|
required |
The number of GPUs to attach to each node. The value must be at
least |
optional |
Requires GKE version 1.31.1-gke.1858000 or later The NVIDIA driver version to install. The supported values are as follows:
|
required |
The GPU type to attach to each node, such as |
reservations
reservations: affinity: string specific: [ object(specific) ]
Fields | |
---|---|
required |
The type of reservation to consume when creating nodes. The following values are supported:
|
optional* |
The parameters for consuming specific reservations. If you set the
|
specific
specific: - name: string project: string
Fields | |
---|---|
required |
The name of the specific reservation to consume. |
optional |
The project ID of the Google Cloud project that contains the specific reservation. To use a shared reservation from a different project, this field is required. |
storage
storage: bootDiskKMSKey: string bootDiskSize: integer bootDiskType: string localSSDCount: integer secondaryBootDisks: [ object(secondarybootdisks) ]
Fields | |
---|---|
optional |
The path to the Cloud KMS key to use to encrypt the boot disk. |
optional |
The size, in GiB, of the boot disk for each node. The minimum value is
|
optional |
The type of disk to attach to the node. The value that you specify must be supported by the machine series or the machine type in your priority rule. The following values are supported:
For details about the disk types that specific machine series support, see the Machine series comparison table. Filter the table properties for "Hyperdisk" and "PD". |
optional |
The number of Local SSDs to attach to each node. If you specify this
field, the minimum value is |
optional |
Requires GKE version 1.31.2-gke.1105000 or later The configuration of secondary boot disks that are used to preload nodes with data, such as ML models or container images. |
secondaryBootDisks
secondaryBootDisks: - diskImageName: string mode: string project: string
Fields | |
---|---|
required |
The name of the disk image. |
optional |
The mode in which the secondary boot disk should be used. The following values are supported:
|
optional |
The project ID of the Google Cloud project that the disk image belongs to. If you omit this field, the default value is the project ID of the cluster project. |
tpu
- tpu: count: integer topology: string type: string
Fields | |
---|---|
required |
The number of TPUs to attach to the node. |
required |
The TPU topology
to use, such as |
required |
The TPU type
to use, such as |
ComputeClass status
The status
field is a list of status messages. This field is informational and
is updated by the Kubernetes API server and the kubelet on each node.
status: conditions: [ object(conditions) ]
Fields | |
---|---|
|
List of status conditions for the |
conditions
conditions: - type: string status: boolean reason: string message: string lastTransitionTime: string observedGeneration: integer
Fields | |
---|---|
|
The type of condition, which helps to organize status messages. |
|
The status of the condition. The value is one of the following:
|
|
A machine-readable reason why a specific condition type made its most recent transition. |
|
A human-readable message that provides details about the most recent transition. This field might be empty. |
|
The timestamp of the most recent change to the condition. |
|
A count of how many times the ComputeClass controller observed a change
to the |