$npx -y skills add google/skills --skill gke-compute-classesConfigures, optimizes, and troubleshoots GKE ComputeClasses. Use when configuring Spot VMs with on-demand fallback, targeting specific accelerators (GPUs/TPUs) or machine families, restricting ComputeClass access, or debugging pending pods related to node pool auto-creation. Do n
| 1 | <!-- disableFinding(LINE_OVER_80) --> |
| 2 | |
| 3 | # GKE ComputeClasses |
| 4 | |
| 5 | Guidance on configuring, optimizing, and troubleshooting GKE ComputeClasses. |
| 6 | |
| 7 | ## When to Use |
| 8 | |
| 9 | - **Cost optimization:** Spot VMs with on-demand fallback. |
| 10 | - **GPU/TPU workloads:** Target specific accelerators (e.g., L4, H100, v5p). |
| 11 | - **Performance tuning:** Select specific machine families (c3, c4, n4). |
| 12 | - **Zone targeting:** Colocate workloads with zonal resources. |
| 13 | |
| 14 | -------------------------------------------------------------------------------- |
| 15 | |
| 16 | ## Engagement Rules: Generalized First, Refine Later |
| 17 | |
| 18 | ComputeClasses depend on zone availability, CUDs, and workload constraints. **Do |
| 19 | not block the user's initial request.** If asked for YAML/recommendations: |
| 20 | |
| 21 | 1. **Provide Generalized Answer Immediately:** Fulfill request using best |
| 22 | practices and placeholders (`<YOUR-ZONE-HERE>`). |
| 23 | * **CRITICAL CUD RULE:** You MUST state that the provided machine families |
| 24 | (e.g., N4, C4) are generic best-practice examples. You MUST explicitly |
| 25 | state that the final choice of machine family should be aligned with the |
| 26 | user's existing Committed Use Discounts (CUDs) or Reservations. |
| 27 | * **YAML REQUIREMENT:** Any generated YAML template MUST include a comment |
| 28 | near the `machineFamily` field: `# IMPORTANT: Align machineFamily with |
| 29 | your existing CUDs/Reservations`. |
| 30 | * **MUST label initial YAML as `EXAMPLE TEMPLATE - DO NOT DEPLOY`.** |
| 31 | * **STRICT SCHEMA RULE:** NEVER hallucinate fields. Do NOT use |
| 32 | `spec.description`, `gvnic`, `transparentHugepageEnabled`, or |
| 33 | `shutdownGracePeriodSeconds`. Use `bootDiskSize` (NOT `bootDiskSizeGb`). |
| 34 | * **YAML FORMATTING RULE:** NEVER quote integer or boolean values (e.g., |
| 35 | use `bootDiskSize: 50`, not `bootDiskSize: "50"`). `imageType` MUST be |
| 36 | lowercase. |
| 37 | * **CRITICAL AI/ML RULE:** DO NOT recommend Spot instances as the primary |
| 38 | priority for AI/ML Inference, *even if the workload is stateless*. |
| 39 | Accelerator node startup latency is severe. The correct priority is: |
| 40 | `Reservations -> On-Demand -> DWS FlexStart -> Spot`. |
| 41 | * **CRITICAL PROVISIONING RULE:** Do NOT confuse node pool auto-creation |
| 42 | with cluster-level Node Auto Provisioning. Starting with GKE |
| 43 | `1.33.3-gke.1136000`, `nodePoolAutoCreation.enabled: true` in the |
| 44 | ComputeClass achieves automatic node pools scoped directly to the |
| 45 | ComputeClass. **It does NOT require turning on Node Auto Provisioning at |
| 46 | the cluster level.** |
| 47 | * **CRITICAL TAINT RULE:** The ONLY redundant taint is re-adding |
| 48 | `cloud.google.com/compute-class` on **auto-created** pools — node pool |
| 49 | auto-creation already applies AND auto-tolerates that key, so |
| 50 | duplicating it breaks scheduling → REMOVE it (don't add a toleration). |
| 51 | This is NOT "never add taints": an intentional **dedication/isolation** |
| 52 | taint (e.g. `dedicated=ml:NoSchedule`) in `nodePoolConfig.taints` is |
| 53 | valid — it keeps other workloads off, and the intended workloads need a |
| 54 | matching toleration (normal K8s contract). Judge intent before deleting; |
| 55 | only the compute-class key is redundant. **Manual pools STILL require |
| 56 | `cloud.google.com/compute-class=<NAME>` as label AND taint to bind to |
| 57 | the ComputeClass — never remove that.** **Schema limit:** a |
| 58 | `nodePoolConfig.taints` key may NOT contain the reserved `kubernetes.io` |
| 59 | substring (GKE Warden rejects it) — so the Cluster-Autoscaler-ignored |
| 60 | prefixes |
| 61 | (`startup-taint.`/`status-taint.cluster-autoscaler.kubernetes.io/`) |
| 62 | cannot be set via a ComputeClass; those are node-pool-level taints. |
| 63 | * **CRITICAL GPU-TAINT RULE:** GKE auto-taints GPU nodes |
| 64 | `nvidia.com/gpu:NoSchedule` — this is separate from the |
| 65 | `cloud.google.com/compute-class` auto-toleration and is NOT covered by |
| 66 | it. A GPU Pod stuck `Pending` / `noScaleUp` is almost always missing the |
| 67 | toleration. Add to the PodSpec: `tolerations: [{key: nvidia.com/gpu, |
| 68 | operator: Exists}]`. |
| 69 | * **CRITICAL SPOT-TAINT RULE:** GKE auto-taints Spot nodes with |
| 70 | `cloud.google.com/gke-spot=true:NoSchedule`. Pods targeting a Spot |
| 71 | priority tier *must* tolerate this taint, or they will stay `Pending` / |
| 72 | `noScaleUp` with a scheduling block. Tell the user to add the matching |
| 73 | toleration to their PodSpec: `tolerations: [{key: |
| 74 | cloud.google.com/gke-spot, operator: Equal, value: "true", effe |