How to Configure GKE ComputeClass for Node Pool Auto-Creation
Set spec.nodePoolAutoCreation.enabled: true in your ComputeClass manifest and use the cloud.google.com/compute-class node selector in your pod specs to enable automatic node pool provisioning without requiring cluster-wide Node Auto Provisioning.
GKE ComputeClasses provide a declarative abstraction for binding node-pool-creation rules to logical class names. When you configure GKE ComputeClass for node pool auto-creation, the system automatically manages node pool lifecycle operations based on workload demands, available starting with GKE version 1.33.3-gke.1136000 according to the google/skills source code.
Enable Node Pool Auto-Creation
To activate automatic node pool management, set the nodePoolAutoCreation field in your ComputeClass specification. According to skills/cloud/gke-compute-classes/SKILL.md (lines 50-54), this feature operates independently of the cluster-wide Node Auto Provisioning setting.
apiVersion: gke.googleapis.com/v1
kind: ComputeClass
metadata:
name: auto-provisioned-class
spec:
nodePoolAutoCreation:
enabled: true
priorities:
- machineFamily: n4
machineType: n4-standard-2
Critical distinction: Do not enable the cluster-wide Node Auto Provisioning flag when using this feature. The ComputeClass handles pool creation autonomously (SKILL.md lines 49-54).
Configure Priority Rules for Machine Selection
Define a priorities[] list to establish a fallback ladder for machine family selection. The auto-scaler attempts each priority in sequence, respecting committed use discounts (CUDs) and reservations. As documented in skills/cloud/gke-compute-classes/SKILL.md (lines 31-34 and 84-88), this configuration ensures cost-effective scaling from Spot instances to On-Demand and finally to reserved capacity.
spec:
priorities:
- machineFamily: n4
machineType: n4-standard-2
spot: true
- machineFamily: n2
machineType: n2-standard-4
- machineFamily: c3
machineType: c3-standard-8
Schedule Workloads on Auto-Created Pools
Pods must explicitly target the ComputeClass using node selection criteria. The cloud.google.com/compute-class label directs the scheduler to pools managed by that specific class (SKILL.md lines 46-48).
apiVersion: v1
kind: Pod
metadata:
name: workload-pod
spec:
containers:
- name: app
image: gcr.io/project/app:latest
nodeSelector:
cloud.google.com/compute-class: auto-provisioned-class
Handle Taints and Tolerations Correctly
Auto-created node pools automatically receive the cloud.google.com/compute-class toleration. Do not duplicate this taint in your pod specifications, as this breaks scheduling (SKILL.md lines 55-58). Manual pools still require both label and taint configuration.
For specialized hardware, add specific tolerations:
- GPU nodes: Require
nvidia.com/gpu:NoScheduletoleration - Spot nodes: Require
cloud.google.com/gke-spot=true:NoScheduletoleration
These requirements are documented in skills/cloud/gke-compute-classes/SKILL.md (lines 71-82).
tolerations:
- key: cloud.google.com/gke-spot
operator: Equal
value: "true"
effect: NoSchedule
Complete Implementation Example
The following configuration demonstrates a production-ready ComputeClass with node pool auto-creation enabled, referencing the templates in skills/cloud/gke-compute-classes/assets/system-pool-compute-class.yaml.
apiVersion: gke.googleapis.com/v1
kind: ComputeClass
metadata:
name: spot-fallback
spec:
nodePoolAutoCreation:
enabled: true
priorities:
- machineFamily: n4
machineType: n4-standard-2
spot: true
- machineFamily: n2
machineType: n2-standard-4
- machineFamily: c3
machineType: c3-standard-8
Target this class with a pod specification that includes the appropriate tolerations for Spot instances:
apiVersion: v1
kind: Pod
metadata:
name: example-pod
spec:
containers:
- name: app
image: gcr.io/my-project/my-app:latest
resources:
requests:
cpu: "2"
memory: "4Gi"
nodeSelector:
cloud.google.com/compute-class: spot-fallback
tolerations:
- key: cloud.google.com/gke-spot
operator: Equal
value: "true"
effect: NoSchedule
Summary
- Enable auto-creation by setting
spec.nodePoolAutoCreation.enabled: truein the ComputeClass manifest. - Avoid cluster-level NAP—Node Auto Provisioning is not required and should remain disabled.
- Define priorities to cascade from Spot → On-Demand → Reservations for cost optimization.
- Use node selectors with the key
cloud.google.com/compute-classto bind pods to specific classes. - Skip redundant taints—auto-created pools already carry the
cloud.google.com/compute-classtoleration. - Add hardware tolerations for GPU (
nvidia.com/gpu) or Spot (cloud.google.com/gke-spot) workloads only when targeting those specific node types.
Frequently Asked Questions
What GKE version supports ComputeClass node pool auto-creation?
Node pool auto-creation for ComputeClasses requires GKE version 1.33.3-gke.1136000 or later. This version introduces the nodePoolAutoCreation API field that allows ComputeClasses to manage node pools independently of the cluster-wide Node Auto Provisioning feature.
Do I need to enable Node Auto Provisioning on my cluster to use ComputeClass auto-creation?
No. The ComputeClass nodePoolAutoCreation feature operates independently of cluster-wide Node Auto Provisioning. According to skills/cloud/gke-compute-classes/SKILL.md (lines 49-54), enabling the cluster-wide NAP flag is unnecessary and potentially conflicting when using ComputeClass-scoped auto-creation.
Why are my pods stuck pending when targeting an auto-created ComputeClass pool?
Pending pods usually indicate a missing node selector or an incorrect toleration configuration. Ensure your pod spec includes nodeSelector: cloud.google.com/compute-class: <NAME> (SKILL.md lines 46-48). Additionally, verify you have not manually added the cloud.google.com/compute-class taint to your pods, as auto-created pools already include this toleration internally (SKILL.md lines 55-58).
How do I schedule GPU workloads on auto-created node pools?
When your ComputeClass targets GPU machine families, add the nvidia.com/gpu:NoSchedule toleration to your pod spec. The auto-created node pools will automatically apply the corresponding taint. This pattern is documented in skills/cloud/gke-compute-classes/SKILL.md (lines 71-82) alongside Spot instance toleration requirements.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →