You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/k8s/README.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,27 @@ rules:
30
30
- The `ACTIONS_RUNNER_REQUIRE_JOB_CONTAINER` env should be set to true to prevent the runner from running any jobs outside of a container
31
31
- The runner pod should map a persistent volume claim into the `_work` directory
32
32
- The `ACTIONS_RUNNER_CLAIM_NAME` env should be set to the persistent volume claim that contains the runner's working directory, otherwise it defaults to `${ACTIONS_RUNNER_POD_NAME}-work`
33
+
- The `ACTIONS_RUNNER_USE_KUBE_SCHEDULER` env can be set to `true` to enable the Kubernetes scheduler for job pods. When set to `true`, the hook uses `nodeAffinity` to ensure job pods are scheduled correctly (essential for `ReadWriteOnce` volumes). If not set, the hook defaults to a legacy mode where job pods are pinned to the same node as the runner pod using `nodeName`.
34
+
35
+
## Storage Guidance
36
+
The K8s hooks require a shared volume between the runner pod and the job pods to share the workspace and other internal directories.
37
+
38
+
### RWX (Recommended)
39
+
The preferred way to configure storage is using a `ReadWriteMany` (RWX) Persistent Volume Claim. While job pods are always pinned to the runner's node, RWX provides better operational flexibility by allowing multiple pods to access the same workspace simultaneously.
40
+
41
+
To migrate from RWO to RWX:
42
+
1. Provision a new `ReadWriteMany` StorageClass if one is not available.
43
+
2. Update your PVC definition to use `accessModes: [ReadWriteMany]`.
44
+
3. Set `ACTIONS_RUNNER_USE_KUBE_SCHEDULER=true` to enable the scheduler-based node pinning (via affinity) instead of the default `nodeName` pinning.
45
+
46
+
### RWO Fallback (Affinity-based)
47
+
If `ReadWriteMany` storage is not available, you can use `ReadWriteOnce` (RWO) storage. In this mode, all job pods must be scheduled on the same node as the runner pod that owns the PVC.
48
+
49
+
To enable this safely:
50
+
1. Ensure `ACTIONS_RUNNER_USE_KUBE_SCHEDULER` is set to `true`.
51
+
2. The hooks will automatically add a `nodeAffinity` to the job pods, ensuring they are scheduled on the same node as the runner pod (`kubernetes.io/hostname` match).
52
+
53
+
> **Note:** We do not recommend manually setting `nodeName` in the pod template, as the hooks handle node placement automatically via affinity when the scheduler is enabled.
33
54
- Some actions runner env's are expected to be set. These are set automatically by the runner.
34
55
-`RUNNER_WORKSPACE` is expected to be set to the workspace of the runner
35
56
-`GITHUB_WORKSPACE` is expected to be set to the workspace of the job
0 commit comments