Skip to content

Commit ec61990

Browse files
docs(k8s): document RWX migration and RWO affinity-only guidance
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <[email protected]>
1 parent c9b0062 commit ec61990

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

packages/k8s/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,27 @@ rules:
3030
- The `ACTIONS_RUNNER_REQUIRE_JOB_CONTAINER` env should be set to true to prevent the runner from running any jobs outside of a container
3131
- The runner pod should map a persistent volume claim into the `_work` directory
3232
- 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.
3354
- Some actions runner env's are expected to be set. These are set automatically by the runner.
3455
- `RUNNER_WORKSPACE` is expected to be set to the workspace of the runner
3556
- `GITHUB_WORKSPACE` is expected to be set to the workspace of the job

0 commit comments

Comments
 (0)