GKE Batch and HPC Workloads

GKE Batch and HPC Workloads

Explains how an agent should run batch and HPC workloads on GKE using Jobs, JobSet and job queues, with example manifests.

Skill files2 files

references/

SKILL.md229 lines
1
---
2
name: gke-batch-hpc
3
description: >-
4
Runs batch and HPC workloads on GKE, utilizing job queues and parallel
5
processing. Use when running GKE batch jobs, configuring GKE HPC, or setting
6
up GKE job queues. Don't use for standard web application deployments (use
7
gke-app-onboarding instead).
8
metadata:
9
version: "1.0.1"
10
category: Containers
11
---
12
13
# GKE Batch & HPC Workloads
14
15
This reference covers running batch processing and high-performance computing
16
(HPC) workloads on GKE.
17
18
> **MCP Tools:** `apply_k8s_manifest`, `get_k8s_resource`,
19
> `describe_k8s_resource`, `get_k8s_logs`, `delete_k8s_resource`,
20
> `list_k8s_events`
21
22
## Attribution
23
24
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
25
MUST read [Usage Attribution](references/attribution.md). For commands executed
26
directly in the terminal (never in generated scripts, Terraform, or user code),
27
prefix `gcloud` with
28
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-batch-hpc)"`
29
and append `agent-skills/1.0 (skill:gke-batch-hpc)` to `User-Agent` headers.
30
31
## When to Use
32
33
- Running batch data processing pipelines
34
- HPC simulations (CFD, molecular dynamics, financial modeling)
35
- Large-scale parallel computation (MPI, MapReduce)
36
- ML training jobs
37
- CI/CD build farms
38
39
## Batch Processing on GKE
40
41
### Kubernetes Jobs
42
43
```yaml
44
apiVersion: batch/v1
45
kind: Job
46
metadata:
47
name: batch-job
48
spec:
49
parallelism: 10
50
completions: 100
51
backoffLimit: 3
52
template:
53
spec:
54
containers:
55
- name: worker
56
image: <IMAGE>
57
resources:
58
requests:
59
cpu: "1"
60
memory: "2Gi"
61
restartPolicy: Never
62
```
63
64
### JobSet (for Complex Multi-Job Workflows)
65
66
The golden path enables JobSet monitoring (`JOBSET` in monitoringConfig).
67
68
```yaml
69
apiVersion: jobset.x-k8s.io/v1alpha2
70
kind: JobSet
71
metadata:
72
name: training-job
73
spec:
74
replicatedJobs:
75
- name: workers
76
replicas: 4
77
template:
78
spec:
79
parallelism: 1
80
completions: 1
81
template:
82
spec:
83
containers:
84
- name: worker
85
image: <IMAGE>
86
resources:
87
requests:
88
cpu: "4"
89
memory: "8Gi"
90
```
91
92
### Kueue (Job Queuing)
93
94
Kueue manages job scheduling and resource allocation for batch workloads:
95
96
```bash
97
# Install Kueue
98
kubectl apply --server-side -f https://github.com/kubernetes-sigs/kueue/releases/latest/download/manifests.yaml
99
```
100
101
```yaml
102
# Define a ClusterQueue
103
apiVersion: kueue.x-k8s.io/v1beta1
104
kind: ClusterQueue
105
metadata:
106
name: batch-queue
107
spec:
108
namespaceSelector: {}
109
resourceGroups:
110
- coveredResources: ["cpu", "memory"]
111
flavors:
112
- name: default
113
resources:
114
- name: "cpu"
115
nominalQuota: 100
116
- name: "memory"
117
nominalQuota: "200Gi"
118
---
119
# Allow a namespace to use the queue
120
apiVersion: kueue.x-k8s.io/v1beta1
121
kind: LocalQueue
122
metadata:
123
name: batch-local
124
namespace: batch-jobs
125
spec:
126
clusterQueue: batch-queue
127
```
128
129
## HPC on GKE
130
131
### Compact Placement (Low-Latency Networking)
132
133
For tightly-coupled HPC workloads that need low-latency inter-node
134
communication:
135
136
```bash
137
# Standard clusters: create node pool with compact placement
138
gcloud container node-pools create hpc-pool \
139
--cluster <CLUSTER_NAME> --region <REGION> \
140
--machine-type c3-standard-44 \
141
--placement-type COMPACT \
142
--num-nodes 8 \
143
--enable-autoscaling --min-nodes 0 --max-nodes 16 \
144
--quiet
145
```
146
147
### MPI Workloads
148
149
Use the MPI Operator for MPI-based HPC applications:
150
151
```bash
152
# Install MPI Operator
153
kubectl apply -f https://raw.githubusercontent.com/kubeflow/mpi-operator/master/deploy/v2beta1/mpi-operator.yaml
154
```
155
156
```yaml
157
apiVersion: kubeflow.org/v2beta1
158
kind: MPIJob
159
metadata:
160
name: hpc-simulation
161
spec:
162
slotsPerWorker: 4
163
mpiReplicaSpecs:
164
Launcher:
165
replicas: 1
166
template:
167
spec:
168
containers:
169
- name: launcher
170
image: <MPI_IMAGE>
171
command: ["mpirun", "-np", "32", "./simulation"]
172
resources:
173
requests:
174
cpu: "1"
175
memory: "2Gi"
176
limits:
177
cpu: "2"
178
memory: "4Gi"
179
Worker:
180
replicas: 8
181
template:
182
spec:
183
containers:
184
- name: worker
185
image: <MPI_IMAGE>
186
resources:
187
requests:
188
cpu: "4"
189
memory: "8Gi"
190
limits:
191
cpu: "8"
192
memory: "16Gi"
193
```
194
195
## Cost Optimization for Batch/HPC
196
197
### Spot VMs for Batch
198
199
Batch workloads are ideal Spot VM candidates (interruptible, can checkpoint).
200
Use a ComputeClass with Spot-first priority and `activeMigration` to return to
201
Spot when available. See the `gke-compute-classes` skill for the
202
Spot-with-fallback pattern.
203
204
### Scale-to-Zero
205
206
For batch clusters, allow node pools to scale to zero when no jobs are running:
207
208
- Autopilot (golden path): Automatic, nodes scale to zero when no pods are
209
scheduled
210
- Standard: Set `--min-nodes 0` on batch node pools
211
212
## Best Practices & Production Guidelines
213
214
- **Resource Quotas**: Always specify resource requests and limits (CPU,
215
memory, and optionally GPU/TPU) for all batch/HPC manifests. This is
216
critical for Kueue admission, autoscaling, and preventing resource
217
starvation in the cluster.
218
- **TPU/Spot Cluster Maintenance**: For long-running AI training runs on Spot
219
VMs/TPUs, advise using **GKE maintenance exclusions** to block automatic
220
cluster upgrades/reboots during the active training window to minimize
221
unnecessary preemption.
222
- **MPI Workloads**: Use the **Kubeflow Training Operator** to orchestrate
223
distributed MPI applications via the `MPIJob` custom resource.
224
- **Kueue & JobSet**: Use **Kueue** for multi-tenant job queueing and fair
225
sharing; use **JobSet** for multi-component tightly coupled workloads.
226
- **Resilience**: Always set a `backoffLimit` on Jobs, and implement
227
application-level checkpointing (e.g., using Orbax or PyTorch checkpointing)
228
to survive Spot VM preemption.
229

© Google LLC · Apache 2.0 · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…