Skip to content

Commit 8aad4ef

Browse files
[Docs] Minor update to the Resources and offers under Kubernetes on the Backends page
1 parent 8923b73 commit 8aad4ef

File tree

1 file changed

+12
-33
lines changed

1 file changed

+12
-33
lines changed

docs/docs/concepts/backends.md

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,23 +1061,21 @@ projects:
10611061
Ensure you've created a ClusterRoleBinding to grant the role to the user or the service account you're using.
10621062

10631063
??? info "Resources and offers"
1064-
[Resources](../concepts/tasks.md#resources) specified in the run configuration are translated to Kubernetes
1065-
[requests and limits](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#requests-and-limits) as follows:
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.
10661065

1067-
- As with other backends, an exact value is translated to a range with the same lower and upper limits,
1068-
e.g., `cpu: 4` is the same as `cpu: 4..4`.
1069-
- The lower limit, if set, is used as a resource request, meaning that it is guaranteed that the container has at least the specified
1070-
amount of the resource.
1071-
- For resources other than `gpu`, the upper limit, if set, is used as a resource limit, meaning that the container is not allowed
1072-
to consume more resources than specified. If the upper limit is not set, the resource limit is also not set.
1073-
- For `gpu` resources, the upper limit is always ignored, and the resource limit is always set to the same value as the resource request,
1074-
that is, to the lower limit of the range.
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.
10751070

1076-
For example, the following resources specification:
1071+
Example:
10771072

10781073
<div editor-title=".dstack.yml">
10791074

10801075
```yaml
1076+
type: dev-environment
1077+
ide: vscode
1078+
10811079
resources:
10821080
cpu: 32..64
10831081
memory: 1024GB
@@ -1087,35 +1085,16 @@ projects:
10871085

10881086
</div>
10891087

1090-
is translated to:
1088+
This translates to the following Kubernetes resource spec:
10911089

1092-
| resource | request | limit |
1090+
| Resource | Request | Limit |
10931091
|---------------------|----------|-----------|
10941092
| `cpu` | `32` | `64` |
10951093
| `memory` | `1024Gi` | `1024Gi` |
10961094
| `ephemeral-storage` | `100Gi` | _not set_ |
10971095
| `nvidia.com/gpu` | `4` | `4` |
10981096

1099-
In offers, `dstack` uses resource requests as offer's resources.
1100-
With the resources spec as in the example above, offers would look like the following,
1101-
even if nodes have more available resources:
1102-
1103-
```
1104-
# BACKEND RESOURCES INSTANCE TYPE PRICE
1105-
1 kubernetes (-) cpu=32 mem=1024GB disk=100GB H100:80GB:4 h100x8 $0
1106-
```
1107-
1108-
As a consequence, if you specify `gpu: 0` or don't specify `gpu` at all (the default value is `0`),
1109-
you won't see GPU resources in offers, even with GPU nodes. The same is true for the `dstack offer` command,
1110-
to see available GPU models, you should specify a miminum amount of GPUs > 0:
1111-
1112-
<div class="termy">
1113-
1114-
```shell
1115-
$ dstack offer --gpu 1
1116-
```
1117-
1118-
</div>
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.
11191098

11201099
> To learn more, see the [Lambda](../../examples/clusters/lambda/#kubernetes) and [Crusoe](../../examples/clusters/crusoe/#kubernetes) examples.
11211100

0 commit comments

Comments
 (0)