Skip to content

Commit 14c6af4

Browse files
authored
Add support for Kubernetes arbitrary node selector (#464)
* Add support for Kubernetes arbitrary node selector documentation * Kubernetes node selector is now an array in documentation and add examples * Improve information regarding the default value
1 parent 57abadc commit 14c6af4

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

content/docs/ref/runner.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ Any [generic option](/doc/ref) in addition to:
6060
- `--cloud-aws-subnet=<...>`:
6161
[AWS subnet](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html#subnet-basics)
6262
identifier.
63+
- `--cloud-kubernetes-node-selector=<...>`: `key=value` pair to specify the
64+
Kubernetes node selector. May be
65+
[specified multiple times](http://yargs.js.org/docs/#array). More
66+
[details below](#using---cloud-kubernetes-node-selector). [default:
67+
`accelerator=infer`]
6368
- `--docker-volumes=<...>`: Volume mount to pass to Docker, e.g.
6469
`/var/run/docker.sock:/var/run/docker.sock` for Docker-in-Docker support. May
6570
be specified multiple times. Only supported by GitLab.
@@ -372,6 +377,56 @@ Azure.
372377
replacing the `IP_ADDRESS` placeholder with the instance address returned by
373378
`cml runner` (search the output logs for `instanceIp`).
374379

380+
### Using `--cloud-kubernetes-node-selector`
381+
382+
Set the
383+
[Kubernetes node selector](https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/).
384+
385+
For example:
386+
387+
```cli
388+
$ cml runner launch \
389+
--cloud-kubernetes-node-selector="disktype=ssd" \
390+
...
391+
```
392+
393+
will select the node labeled with `disktype=ssd`.
394+
395+
If not provided, a default `accelerator=infer` key pair will be used.
396+
397+
#### Node selector on multiple labels
398+
399+
You can set multiple labels for a node selector.
400+
401+
For example:
402+
403+
```cli
404+
$ cml runner launch \
405+
--cloud-kubernetes-node-selector="disktype=ssd" \
406+
--cloud-kubernetes-node-selector="ram=huge" \
407+
...
408+
```
409+
410+
will select the node labeled with `disktype=ssd` and `ram=huge`.
411+
412+
If you specify the same key multiple times, the last one will be used.
413+
414+
#### Infer the value from the GPU configuration
415+
416+
If you set the key value to `infer`, it will infer the GPU type from the GPU
417+
configuration on the key you have set.
418+
419+
For example:
420+
421+
```cli
422+
$ cml runner launch \
423+
--cloud-kubernetes-node-selector="gpu=infer" \
424+
...
425+
```
426+
427+
will select the node labeled `gpu` with the value inferred from the GPU
428+
configuration if available, e.g. `k80`.
429+
375430
## Debugging
376431

377432
[See the section self-hosted runners](/doc/self-hosted-runners#debugging)

0 commit comments

Comments
 (0)