Skip to content

Commit 41079ff

Browse files
[Docs] Clarify how K8s resources and offers work (#3565)
Co-authored-by: peterschmidt85 <andrey.cheptsov@gmail.com>
1 parent 20771c3 commit 41079ff

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

docs/docs/concepts/backends.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,43 @@ projects:
10601060

10611061
Ensure you've created a ClusterRoleBinding to grant the role to the user or the service account you're using.
10621062

1063-
> To learn more, see the [Lambda](../../examples/clusters/lambda/#kubernetes) and [Lambda](../../examples/clusters/crusoe/#kubernetes) examples.
1063+
??? info "Resources and offers"
1064+
If you use ranges with [`resources`](../concepts/tasks.md#resources) (e.g. `gpu: 1..8` or `memory: 64GB..`) in fleet or run configurations, other backends collect and try all offers that satisfy the range.
1065+
1066+
The `kubernetes` backend handles it differently.
1067+
1068+
* For `gpu`, if you specify a range (e.g. `gpu: 4..8`), the `kubernetes` backend only provisions pods with the GPU count equal to the lower limit (`4`). The upper limit of the GPU range is always ignored.
1069+
* For other resources such as `cpu`, `memory`, and `disk`, the `kubernetes` backend passes the lower and upper limits of the range as Kubernetes [requests and limits](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#requests-and-limits) respectively. If the upper limit is not set, the Kubernetes limit is also not set.
1070+
1071+
Example:
1072+
1073+
<div editor-title=".dstack.yml">
1074+
1075+
```yaml
1076+
type: dev-environment
1077+
ide: vscode
1078+
1079+
resources:
1080+
cpu: 32..64
1081+
memory: 1024GB
1082+
disk: 100GB..
1083+
gpu: nvidia:4..8
1084+
```
1085+
1086+
</div>
1087+
1088+
This translates to the following Kubernetes resource spec:
1089+
1090+
| Resource | Request | Limit |
1091+
|---------------------|----------|-----------|
1092+
| `cpu` | `32` | `64` |
1093+
| `memory` | `1024Gi` | `1024Gi` |
1094+
| `ephemeral-storage` | `100Gi` | _not set_ |
1095+
| `nvidia.com/gpu` | `4` | `4` |
1096+
1097+
This applies to offers shown in `dstack apply` (run plans), during provisioning, and in `dstack offer`. Unlike other backends, offers for the `kubernetes` backend always reflect the lower limit of the range.
1098+
1099+
> To learn more, see the [Lambda](../../examples/clusters/lambda/#kubernetes) and [Crusoe](../../examples/clusters/crusoe/#kubernetes) examples.
10641100

10651101
### RunPod
10661102

0 commit comments

Comments
 (0)