Sub topic 12
Resources, node selection, and tolerations
This chapter assumes you can read a Helm values file, know what a pod spec looks like, and have already installed a runner scale set as shown in earlier chapters. You should also know what requests, limits, labels, and taints mean in Kubernetes at a basic level.
Runner pods are ordinary pods. If you don't set resources, the scheduler places them with no guarantees, and a busy build can starve its neighbors or get killed. This chapter covers how to size runner pods, how to steer them to the right nodes, and how those choices affect autoscaling.
Where the settings live
The scale set chart accepts a template.spec block in values.yaml. ARC uses it as the pod spec for each ephemeral runner. Whatever you put there is merged into the pod ARC creates, so you can set resources, nodeSelector, tolerations, affinity, and volumes the same way you would in a Deployment.
The container that runs the Actions runner must be named runner. If you give it another name, ARC treats it as an additional container and still adds its own runner container, which usually breaks the pod.
githubConfigUrl: "https://github.com/<your-org>"
githubConfigSecret: pre-defined-secret
minRunners: 1
maxRunners: 20
template:
spec:
containers:
- name: runner
image: ghcr.io/actions/actions-runner:latest
command: ["/home/runner/run.sh"]
resources:
requests:
cpu: "1"
memory: 2Gi
limits:
memory: 4GiThis is the same template from the customization chapter. Here we focus on the resources block and then add scheduling fields beside containers.
Requests and limits
A request is what the scheduler reserves for the pod. A limit is the ceiling the kubelet enforces at runtime.
| Field | What it does | Effect on runners |
|---|---|---|
| `requests.cpu` | Reserves CPU when scheduling | Decides how many runners fit on a node |
| `requests.memory` | Reserves memory when scheduling | Decides how many runners fit on a node |
| `limits.cpu` | Throttles CPU use | Slows builds that exceed it, never kills them |
| `limits.memory` | Hard memory cap | The container is OOM-killed if it exceeds it |
The two limits behave differently. Exceeding a CPU limit makes the process slower. Exceeding a memory limit kills the container, and the job fails partway through. That is why the example sets a memory limit but no CPU limit: a CPU limit throttles compilers and test runners even when the node has idle cores, and a memory limit protects the node from a runaway build.
Choosing numbers
Start from what a typical job needs, not from the node size.
- Run a representative workflow and watch peak usage with
kubectl top pod -n arc-runnerswhile it runs. This needs metrics-server installed in the cluster. - Set requests near typical usage and the memory limit above the observed peak, with headroom.
- Re-check after adding new heavy steps such as large test suites or container builds.
Setting requests equal to limits gives the pod the Guaranteed quality-of-service class. It is the last to be evicted under node pressure. Setting a request lower than the limit gives Burstable, which packs more runners onto a node but risks eviction when the node is short of memory. Most teams use Burstable for general builds and Guaranteed for long, expensive jobs.
Sidecars count too
In dind mode, ARC adds a Docker daemon container to the pod. In kubernetes mode, job steps run in separate pods. In both cases the sizing you put on the runner container does not cover the other containers. Check the total of everything in the pod, because the scheduler sums requests across all containers.
In dind mode, image builds run in the dind container, so memory-hungry builds can be OOM-killed there even if the runner container is well within its limit. If you need to size that container, define it in the template with its own resources. With containerMode.type set to dind, the chart generates the dind container and init containers for you, so check the rendered output with helm template before overriding anything.
helm template arc-runner-set \
--namespace arc-runners \
-f values.yaml \
oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-setThe result shows how your overrides combine with the chart defaults.
Requests drive autoscaling cost
ARC decides how many runner pods to create from the job queue. It does not look at CPU or memory. The Kubernetes scheduler and, if you have one, the cluster autoscaler then decide whether those pods can run.
So if ARC creates 20 pods that each request 1 CPU and 2 GiB, the cluster needs 20 CPUs and 40 GiB free. If it doesn't have them, the extra pods stay Pending and jobs wait in the queue. Treat maxRunners and your request sizes as one budget:
maxRunners × per-pod requests ≤ capacity you are willing to provideWith a node autoscaler such as Cluster Autoscaler or Karpenter, pending runner pods trigger new nodes. That adds node start-up time, often a few minutes, to job latency. A common pattern is a small minRunners for warm capacity plus a node pool that scales from zero.
Replace the above by the diagram below, which shows the full path.
Node selection
Use nodeSelector to restrict runner pods to nodes with specific labels. This is the simplest way to put CI work on a dedicated node pool.
template:
spec:
nodeSelector:
workload: ci-runners
containers:
- name: runner
image: ghcr.io/actions/actions-runner:latest
command: ["/home/runner/run.sh"]Label the nodes first, or the pods will never schedule:
kubectl label node <node-name> workload=ci-runnersOn managed clusters you normally set the label on the node pool so new nodes get it automatically.
Dedicated nodes are worth the setup for three reasons:
- Noisy builds can't slow down production services.
- You can pick instance types for CI, such as more CPU or local SSD.
- A security boundary is easier to enforce when untrusted workloads share no node with sensitive ones.
For architecture-specific builds, use the built-in label kubernetes.io/arch. Make sure the runner image supports that architecture.
template:
spec:
nodeSelector:
kubernetes.io/arch: arm64Taints and tolerations
A nodeSelector attracts pods to nodes. A taint repels pods from nodes. Together they reserve a pool for runners: the selector pulls runners in, and the taint keeps everything else out.
Taint the node pool:
kubectl taint nodes <node-name> dedicated=ci-runners:NoScheduleThen add a matching toleration to the runner template:
template:
spec:
nodeSelector:
workload: ci-runners
tolerations:
- key: "dedicated"
operator: "Equal"
value: "ci-runners"
effect: "NoSchedule"
containers:
- name: runner
image: ghcr.io/actions/actions-runner:latest
command: ["/home/runner/run.sh"]A toleration only permits scheduling onto tainted nodes. It does not require it. Without the nodeSelector, these pods could land on any untainted node too. You need both.
The taint effects differ:
| Effect | Behavior |
|---|---|
| `NoSchedule` | New pods without a toleration are not placed on the node |
| `PreferNoSchedule` | The scheduler avoids the node but may still use it |
| `NoExecute` | Also evicts running pods that lack a toleration |
Use NoSchedule for runner pools. Reserve NoExecute for cases where you want existing pods removed.
Affinity and spreading
For rules richer than a label match, use affinity. Node affinity supports multiple values and soft preferences. Pod anti-affinity or topology spread constraints spread runners across nodes or zones.
template:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node.kubernetes.io/instance-type
operator: In
values: ["c6i.2xlarge", "c6i.4xlarge"]
containers:
- name: runner
image: ghcr.io/actions/actions-runner:latest
command: ["/home/runner/run.sh"]Spreading runners is rarely necessary for correctness, since each runner is short-lived. It matters when many pods starting on one node would saturate its disk or network pulling images.
Common errors
- Pods stuck in
Pending. Runkubectl describe pod -n arc-runners <pod>and read theEventssection. Messages such asInsufficient cpu,didn't match Pod's node affinity/selector, orhad untolerated taintname the cause directly. - Typo in a label or taint key. The selector matches nothing and every runner stays pending. Compare the template with
kubectl get nodes --show-labels. - Jobs fail with exit code 137. The container was OOM-killed. Raise the memory limit on the container that ran out, which may be the
dindcontainer. - Jobs are slow but not failing. CPU limits may be throttling them, or requests may be so low that many runners share one node. Remove the CPU limit or raise the request.
- Changes don't apply to running pods. Pods are immutable. Upgrading the Helm release changes the template for new runners only. Existing runners finish their current job with the old spec.
Applying a change
After editing values.yaml, upgrade the release:
helm upgrade arc-runner-set \
--namespace arc-runners \
-f values.yaml \
oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-setThen trigger a workflow and confirm where the pod landed:
kubectl get pods -n arc-runners -o wide --watchThe NODE column should show a node from your dedicated pool.
Exercise
Your scale set uses maxRunners: 10 and each runner pod requests 2 CPUs and 4 GiB of memory. Your dedicated node pool has nodes with 8 allocatable CPUs and 32 GiB each, and it can scale up. A burst of 10 jobs arrives. Roughly how many nodes are needed to run all of them at once, and what happens to jobs if the pool cannot grow?
Show answer
The 10 pods request 20 CPUs and 40 GiB. CPU is the limiting resource: 8 CPUs per node fits 4 pods, so 3 nodes are needed (12 pod slots, 10 used). If the pool cannot grow, the pods that don't fit stay Pending, and their jobs wait in the queue until running jobs finish and free capacity.
Exercise
You added a taint dedicated=ci-runners:NoSchedule to your runner node pool and a matching toleration to the scale set template, but no nodeSelector. Runner pods still sometimes land on general-purpose nodes. Why, and how do you fix it?
Show answer
A toleration only allows pods onto tainted nodes. It doesn't force them there, so the scheduler can still use untainted nodes. Add a nodeSelector (or required node affinity) that matches a label on the runner pool, so the selector attracts the pods and the taint keeps other workloads away.