GitLab Kubernetes Runner Affinity and Tolerations Prompt
Tune the GitLab Runner Kubernetes executor so CI job pods land on the right nodes — using node selectors, affinity, and tolerations to schedule onto tainted CI node pools (spot, GPU, large-build) without starving other workloads.
- Target user
- Platform teams running the GitLab Runner Kubernetes executor
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior platform engineer who runs the GitLab Runner Kubernetes executor at scale and knows exactly how taints, tolerations, node selectors, and affinity interact in `config.toml`. I will provide: - My Runner `config.toml` `[runners.kubernetes]` section - My node pool layout (taints/labels: spot, GPU, build-heavy, default) - The scheduling problem (jobs land on the wrong pool, stay Pending, or evict critical pods) Your job: 1. **Scheduling model** — explain how the Kubernetes executor turns `[runners.kubernetes.node_selector]`, `[runners.kubernetes.affinity]`, and `[runners.kubernetes.node_tolerations]` into the job pod spec, and how taints gate scheduling. 2. **Diagnose Pending** — for a job stuck Pending, walk the elimination: missing toleration for a node taint vs. unsatisfiable affinity vs. insufficient resources. 3. **config.toml tuning** — produce the corrected `[runners.kubernetes]` block that targets the intended pool with `node_selector` plus the matching `node_tolerations`, and `node_affinity` for soft preference. 4. **Isolation** — keep CI pods off control-plane and stateful pools, and prevent them from evicting workloads via priority/resource requests. 5. **Per-job overrides** — show using pod-spec or overwrite variables so a heavy job can request the GPU pool without changing the global config. 6. **Cost angle** — bias schedulable jobs toward spot/preemptible pools while keeping release-critical jobs on stable nodes. Output as: (a) the corrected `config.toml` kubernetes block, (b) a Pending-pod diagnosis tree, (c) a per-job override example, (d) an isolation/cost checklist. A toleration alone does not force placement — pair it with a node selector or affinity, or pods may still land anywhere.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
GitLab CI/CD to Argo CD GitOps Handoff Prompt
Wire GitLab CI image builds to an Argo CD GitOps repo — commit-back tag bumps or Image Updater, without CI directly kubectl-applying to clusters.
-
GitLab Runner Custom Executor Driver Config Prompt
Build and debug a GitLab Runner Custom executor driver (config/prepare/run/cleanup scripts) to run jobs on an environment GitLab does not natively support — such as bespoke VMs, a hypervisor, or an isolated sandbox.
-
GitLab Runner Kubernetes Executor Pod Spec Tuning Prompt
Tune the Kubernetes executor's pod spec — resource requests/limits, node selectors, ephemeral storage, service-account, and pod-level overrides — so CI jobs schedule reliably without starving the cluster.
-
GitLab Runner config.toml Executor Tuning Prompt
Tune self-managed runner config.toml — concurrency, executor choice (docker/kubernetes/shell), cache backend, image pull policy, and the new runner authentication tokens that replaced registration tokens.
More GitLab CI/CD prompts & error guides
Browse every GitLab CI/CD prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.