Skip to content

Commit 6dcb9d4

Browse files
ConnorDoylesteveperry-53
authored andcommitted
Document extended resources and OIR deprecation. (#5399)
* Document extended resources and OIR deprecation. * Updated extended resources doc per reviews.
1 parent 053c794 commit 6dcb9d4

File tree

3 files changed

+99
-21
lines changed

3 files changed

+99
-21
lines changed

docs/concepts/configuration/manage-compute-resources-container.md

Lines changed: 97 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ where `OOM` stands for Out Of Memory.
305305

306306
## Opaque integer resources (Alpha feature)
307307

308+
{% include feature-state-deprecated.md %}
309+
308310
Kubernetes version 1.5 introduces Opaque integer resources. Opaque
309311
integer resources allow cluster operators to advertise new node-level
310312
resources that would be otherwise unknown to the system.
@@ -313,9 +315,12 @@ Users can consume these resources in Pod specs just like CPU and memory.
313315
The scheduler takes care of the resource accounting so that no more than the
314316
available amount is simultaneously allocated to Pods.
315317

316-
**Note:** Opaque integer resources are Alpha in Kubernetes version 1.5.
317-
Only resource accounting is implemented; node-level isolation is still
318-
under active development.
318+
**Note:** Opaque Integer Resources will be removed in version 1.9.
319+
[Extended Resources](#extended-resources) are a replacement for Opaque Integer
320+
Resources. Users can use any domain name prefix outside of the `kubernetes.io/`
321+
domain instead of the previous `pod.alpha.kubernetes.io/opaque-int-resource-`
322+
prefix.
323+
{: .note}
319324

320325
Opaque integer resources are resources that begin with the prefix
321326
`pod.alpha.kubernetes.io/opaque-int-resource-`. The API server
@@ -339,22 +344,9 @@ first pod that requests the resource to be scheduled on that node.
339344

340345
**Example:**
341346

342-
Here is an HTTP request that advertises five "foo" resources on node `k8s-node-1` whose master is `k8s-master`.
343-
344-
```http
345-
PATCH /api/v1/nodes/k8s-node-1/status HTTP/1.1
346-
Accept: application/json
347-
Content-Type: application/json-patch+json
348-
Host: k8s-master:8080
349-
350-
[
351-
{
352-
"op": "add",
353-
"path": "/status/capacity/pod.alpha.kubernetes.io~1opaque-int-resource-foo",
354-
"value": "5"
355-
}
356-
]
357-
```
347+
Here is an example showing how to use `curl` to form an HTTP request that
348+
advertises five "foo" resources on node `k8s-node-1` whose master is
349+
`k8s-master`.
358350

359351
```shell
360352
curl --header "Content-Type: application/json-patch+json" \
@@ -395,6 +387,92 @@ spec:
395387
pod.alpha.kubernetes.io/opaque-int-resource-foo: 1
396388
```
397389

390+
## Extended Resources
391+
392+
Kubernetes version 1.8 introduces Extended Resources. Extended Resources are
393+
fully-qualified resource names outside the `kubernetes.io` domain. Extended
394+
Resources allow cluster operators to advertise new node-level resources that
395+
would be otherwise unknown to the system. Extended Resource quantities must be
396+
integers and cannot be overcommitted.
397+
398+
Users can consume Extended Resources in Pod specs just like CPU and memory.
399+
The scheduler takes care of the resource accounting so that no more than the
400+
available amount is simultaneously allocated to Pods.
401+
402+
The API server restricts quantities of Extended Resources to whole numbers.
403+
Examples of _valid_ quantities are `3`, `3000m` and `3Ki`. Examples of
404+
_invalid_ quantities are `0.5` and `1500m`.
405+
406+
**Note:** Extended Resources replace [Opaque Integer
407+
Resources](#opaque-integer-resources-alpha-feature). Users can use any domain
408+
name prefix outside of the `kubernetes.io/` domain instead of the previous
409+
`pod.alpha.kubernetes.io/opaque-int-resource-` prefix.
410+
{: .note}
411+
412+
There are two steps required to use Extended Resources. First, the
413+
cluster operator must advertise a per-node Extended Resource on one or more
414+
nodes. Second, users must request the Extended Resource in Pods.
415+
416+
To advertise a new Extended Resource, the cluster operator should
417+
submit a `PATCH` HTTP request to the API server to specify the available
418+
quantity in the `status.capacity` for a node in the cluster. After this
419+
operation, the node's `status.capacity` will include a new resource. The
420+
`status.allocatable` field is updated automatically with the new resource
421+
asynchronously by the kubelet. Note that because the scheduler uses the
422+
node `status.allocatable` value when evaluating Pod fitness, there may
423+
be a short delay between patching the node capacity with a new resource and the
424+
first pod that requests the resource to be scheduled on that node.
425+
426+
**Example:**
427+
428+
Here is an example showing how to use `curl` to form an HTTP request that
429+
advertises five "example.com/foo" resources on node `k8s-node-1` whose master
430+
is `k8s-master`.
431+
432+
```shell
433+
curl --header "Content-Type: application/json-patch+json" \
434+
--request PATCH \
435+
--data '[{"op": "add", "path": "/status/capacity/example.com~1foo", "value": "5"}]' \
436+
http://k8s-master:8080/api/v1/nodes/k8s-node-1/status
437+
```
438+
439+
**Note**: In the preceding request, `~1` is the encoding for the character `/`
440+
in the patch path. The operation path value in JSON-Patch is interpreted as a
441+
JSON-Pointer. For more details, see
442+
[IETF RFC 6901, section 3](https://tools.ietf.org/html/rfc6901#section-3).
443+
{: .note}
444+
445+
To consume an Extended Resource in a Pod, include the resource name as a key
446+
in the `spec.containers[].resources.requests` map.
447+
448+
**Note:** Extended resources cannot be overcommitted, so request and limit
449+
must be equal if both are present in a container spec.
450+
{: .note}
451+
452+
The Pod is scheduled only if all of the resource requests are
453+
satisfied, including cpu, memory and any Extended Resources. The Pod will
454+
remain in the `PENDING` state as long as the resource request cannot be met by
455+
any node.
456+
457+
**Example:**
458+
459+
The Pod below requests 2 cpus and 1 "example.com/foo" (an extended resource.)
460+
461+
```yaml
462+
apiVersion: v1
463+
kind: Pod
464+
metadata:
465+
name: my-pod
466+
spec:
467+
containers:
468+
- name: my-container
469+
image: myimage
470+
resources:
471+
requests:
472+
cpu: 2
473+
example.com/foo: 1
474+
```
475+
398476
## Planned Improvements
399477

400478
Kubernetes version 1.5 only allows resource quantities to be specified on a

docs/tasks/administer-cluster/opaque-integer-resource-node.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This page shows how to specify opaque integer resources for a Node.
99
Opaque integer resources allow cluster administrators to advertise node-level
1010
resources that would otherwise be unknown to Kubernetes.
1111

12-
{% include feature-state-alpha.md %}
12+
{% include feature-state-deprecated.md %}
1313

1414
{% endcapture %}
1515

docs/tasks/configure-pod-container/opaque-integer-resource.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Assign Opaque Integer Resources to a Container
66

77
This page shows how to assign opaque integer resources to a Container.
88

9-
{% include feature-state-alpha.md %}
9+
{% include feature-state-deprecated.md %}
1010

1111
{% endcapture %}
1212

0 commit comments

Comments
 (0)