Skip to content

Commit 2136efb

Browse files
authored
Merge pull request kubernetes#6531 from ConnorDoyle/rm-oir
Ported OIR tasks to use Extended Resources.
2 parents 8591c8f + c2a554f commit 2136efb

File tree

6 files changed

+67
-65
lines changed

6 files changed

+67
-65
lines changed

_data/tasks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ toc:
1515
- docs/tasks/configure-pod-container/assign-cpu-resource.md
1616
- docs/tasks/configure-pod-container/quality-service-pod.md
1717
- docs/tasks/configure-pod-container/assign-cpu-ram-container.md
18-
- docs/tasks/configure-pod-container/opaque-integer-resource.md
18+
- docs/tasks/configure-pod-container/extended-resource.md
1919
- docs/tasks/configure-pod-container/configure-volume-storage.md
2020
- docs/tasks/configure-pod-container/configure-persistent-volume-storage.md
2121
- docs/tasks/configure-pod-container/configure-projected-volume-storage.md
@@ -128,7 +128,7 @@ toc:
128128
- docs/tasks/administer-cluster/quota-memory-cpu-namespace.md
129129
- docs/tasks/administer-cluster/quota-pod-namespace.md
130130
- docs/tasks/administer-cluster/quota-api-object.md
131-
- docs/tasks/administer-cluster/opaque-integer-resource-node.md
131+
- docs/tasks/administer-cluster/extended-resource-node.md
132132
- docs/tasks/administer-cluster/cpu-management-policies.md
133133
- docs/tasks/administer-cluster/access-cluster-api.md
134134
- docs/tasks/administer-cluster/access-cluster-services.md

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

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
2-
title: Advertise Opaque Integer Resources for a Node
2+
title: Advertise Extended Resources for a Node
33
---
44

55

66
{% capture overview %}
77

8-
This page shows how to specify opaque integer resources for a Node.
9-
Opaque integer resources allow cluster administrators to advertise node-level
8+
This page shows how to specify extended resources for a Node.
9+
Extended resources allow cluster administrators to advertise node-level
1010
resources that would otherwise be unknown to Kubernetes.
1111

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

1414
{% endcapture %}
1515

@@ -31,9 +31,9 @@ kubectl get nodes
3131

3232
Choose one of your Nodes to use for this exercise.
3333

34-
## Advertise a new opaque integer resource on one of your Nodes
34+
## Advertise a new extended resource on one of your Nodes
3535

36-
To advertise a new opaque integer resource on a Node, send an HTTP PATCH request to
36+
To advertise a new extended resource on a Node, send an HTTP PATCH request to
3737
the Kubernetes API server. For example, suppose one of your Nodes has four dongles
3838
attached. Here's an example of a PATCH request that advertises four dongle resources
3939
for your Node.
@@ -47,7 +47,7 @@ Host: k8s-master:8080
4747
[
4848
{
4949
"op": "add",
50-
"path": "/status/capacity/pod.alpha.kubernetes.io~1opaque-int-resource-dongle",
50+
"path": "/status/capacity/example.com~1dongle",
5151
"value": "4"
5252
}
5353
]
@@ -69,7 +69,7 @@ Replace `<your-node-name>` with the name of your Node:
6969
```shell
7070
curl --header "Content-Type: application/json-patch+json" \
7171
--request PATCH \
72-
--data '[{"op": "add", "path": "/status/capacity/pod.alpha.kubernetes.io~1opaque-int-resource-dongle", "value": "4"}]' \
72+
--data '[{"op": "add", "path": "/status/capacity/example.com~1dongle", "value": "4"}]' \
7373
http://localhost:8001/api/v1/nodes/<your-node-name>/status
7474
```
7575

@@ -85,7 +85,7 @@ The output shows that the Node has a capacity of 4 dongles:
8585
"alpha.kubernetes.io/nvidia-gpu": "0",
8686
"cpu": "2",
8787
"memory": "2049008Ki",
88-
"pod.alpha.kubernetes.io/opaque-int-resource-dongle": "4",
88+
"example.com/dongle": "4",
8989
```
9090

9191
Describe your Node:
@@ -98,53 +98,52 @@ Once again, the output shows the dongle resource:
9898

9999
```yaml
100100
Capacity:
101-
alpha.kubernetes.io/nvidia-gpu: 0
102-
cpu: 2
103-
memory: 2049008Ki
104-
pod.alpha.kubernetes.io/opaque-int-resource-dongle: 4
101+
alpha.kubernetes.io/nvidia-gpu: 0
102+
cpu: 2
103+
memory: 2049008Ki
104+
example.com/dongle: 4
105105
```
106106
107107
Now, application developers can create Pods that request a certain
108108
number of dongles. See
109-
[Assign Opaque Integer Resources to a Container](/docs/tasks/configure-pod-container/opaque-integer-resource/).
109+
[Assign Extended Resources to a Container](/docs/tasks/configure-pod-container/extended-resource/).
110110
111111
## Discussion
112112
113-
Opaque integer resources are similar to memory and CPU resources. For example,
113+
Extended resources are similar to memory and CPU resources. For example,
114114
just as a Node has a certain amount of memory and CPU to be shared by all components
115115
running on the Node, it can have a certain number of dongles to be shared
116116
by all components running on the Node. And just as application developers
117117
can create Pods that request a certain amount of memory and CPU, they can
118118
create Pods that request a certain number of dongles.
119119
120-
Opaque integer resources are called opaque because Kubernetes does not
120+
Extended resources are opaque to Kubernetes; Kubernetes does not
121121
know anything about what they are. Kubernetes knows only that a Node
122-
has a certain number of them. They are called integer resources because
123-
they must be advertised in integer amounts. For example, a Node can advertise
124-
four dongles, but not 4.5 dongles.
122+
has a certain number of them. Extended resources must be advertised in integer
123+
amounts. For example, a Node can advertise four dongles, but not 4.5 dongles.
125124
126125
### Storage example
127126
128127
Suppose a Node has 800 GiB of a special kind of disk storage. You could
129-
create a name for the special storage, say opaque-int-resource-special-storage.
128+
create a name for the special storage, say example.com/special-storage.
130129
Then you could advertise it in chunks of a certain size, say 100 GiB. In that case,
131130
your Node would advertise that it has eight resources of type
132-
opaque-int-resource-special-storage.
131+
example.com/special-storage.
133132
134133
```yaml
135134
Capacity:
136135
...
137-
pod.alpha.kubernetes.io/opaque-int-resource-special-storage: 8
136+
example.com/special-storage: 8
138137
```
139138
140139
If you want to allow arbitrary requests for special storage, you
141140
could advertise special storage in chunks of size 1 byte. In that case, you would advertise
142-
800Gi resources of type opaque-int-resource-special-storage.
141+
800Gi resources of type example.com/special-storage.
143142
144143
```yaml
145144
Capacity:
146145
...
147-
pod.alpha.kubernetes.io/opaque-int-resource-special-storage: 800Gi
146+
example.com/special-storage: 800Gi
148147
```
149148
150149
Then a Container could request any number of bytes of special storage, up to 800Gi.
@@ -162,7 +161,7 @@ Host: k8s-master:8080
162161
[
163162
{
164163
"op": "remove",
165-
"path": "/status/capacity/pod.alpha.kubernetes.io~1opaque-int-resource-dongle",
164+
"path": "/status/capacity/example.com~1dongle",
166165
}
167166
]
168167
```
@@ -179,7 +178,7 @@ Replace `<your-node-name>` with the name of your Node:
179178
```shell
180179
curl --header "Content-Type: application/json-patch+json" \
181180
--request PATCH \
182-
--data '[{"op": "remove", "path": "/status/capacity/pod.alpha.kubernetes.io~1opaque-int-resource-dongle"}]' \
181+
--data '[{"op": "remove", "path": "/status/capacity/example.com~1dongle"}]' \
183182
http://localhost:8001/api/v1/nodes/<your-node-name>/status
184183
```
185184

@@ -196,7 +195,7 @@ kubectl describe node <your-node-name> | grep dongle
196195

197196
### For application developers
198197

199-
* [Assign Opaque Integer Resources to a Container](/docs/tasks/configure-pod-container/opaque-integer-resource/)
198+
* [Assign Extended Resources to a Container](/docs/tasks/configure-pod-container/extended-resource/)
200199

201200
### For cluster administrators
202201

Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
apiVersion: v1
22
kind: Pod
33
metadata:
4-
name: oir-demo
4+
name: extended-resource-demo-2
55
spec:
66
containers:
7-
- name: oir-demo-ctr
7+
- name: extended-resource-demo-2-ctr
88
image: nginx
99
resources:
1010
requests:
11-
pod.alpha.kubernetes.io/opaque-int-resource-dongle: 3
11+
example.com/dongle: 2
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: extended-resource-demo
5+
spec:
6+
containers:
7+
- name: extended-resource-demo-ctr
8+
image: nginx
9+
resources:
10+
requests:
11+
example.com/dongle: 3

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

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: Assign Opaque Integer Resources to a Container
2+
title: Assign Extended Resources to a Container
33
---
44

55
{% capture overview %}
66

7-
This page shows how to assign opaque integer resources to a Container.
7+
This page shows how to assign extended resources to a Container.
88

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

1111
{% endcapture %}
1212

@@ -16,70 +16,73 @@ This page shows how to assign opaque integer resources to a Container.
1616
{% include task-tutorial-prereqs.md %}
1717

1818
Before you do this exercise, do the exercise in
19-
[Advertise Opaque Integer Resources for a Node](/docs/tasks/administer-cluster/opaque-integer-resource-node/).
19+
[Advertise Extended Resources for a Node](/docs/tasks/administer-cluster/extended-resource-node/).
2020
That will configure one of your Nodes to advertise a dongle resource.
2121

2222
{% endcapture %}
2323

2424

2525
{% capture steps %}
2626

27-
## Assign an opaque integer resource to a Pod
27+
## Assign an extended resource to a Pod
2828

29-
To request an opaque integer resource, include the `resources:requests` field in your
30-
Container manifest. Opaque integer resources have the prefix `pod.alpha.kubernetes.io/opaque-int-resource-`.
29+
To request an extended resource, include the `resources:requests` field in your
30+
Container manifest. Extended resources are fully qualified with any domain outside of
31+
`*.kubernetes.io/`. Valid extended resource names have the form `example.com/foo` where
32+
`example.com` is replaced with your organization's domain and `foo` is a
33+
descriptive resource name.
3134

3235
Here is the configuration file for a Pod that has one Container:
3336

34-
{% include code.html language="yaml" file="oir-pod.yaml" ghlink="/docs/tasks/configure-pod-container/oir-pod.yaml" %}
37+
{% include code.html language="yaml" file="extended-resource-pod.yaml" ghlink="/docs/tasks/configure-pod-container/extended-resource-pod.yaml" %}
3538

3639
In the configuration file, you can see that the Container requests 3 dongles.
3740

3841
Create a Pod:
3942

4043
```shell
41-
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/oir-pod.yaml
44+
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/extended-resource-pod.yaml
4245
```
4346

4447
Verify that the Pod is running:
4548

4649
```shell
47-
kubectl get pod oir-demo
50+
kubectl get pod extended-resource-demo
4851
```
4952

5053
Describe the Pod:
5154

5255
```shell
53-
kubectl describe pod oir-demo
56+
kubectl describe pod extended-resource-demo
5457
```
5558

5659
The output shows dongle requests:
5760

5861
```yaml
5962
Requests:
60-
pod.alpha.kubernetes.io/opaque-int-resource-dongle: 3
63+
example.com/dongle: 3
6164
```
6265
6366
## Attempt to create a second Pod
6467
6568
Here is the configuration file for a Pod that has one Container. The Container requests
6669
two dongles.
6770
68-
{% include code.html language="yaml" file="oir-pod-2.yaml" ghlink="/docs/tasks/configure-pod-container/oir-pod-2.yaml" %}
71+
{% include code.html language="yaml" file="extended-resource-pod-2.yaml" ghlink="/docs/tasks/configure-pod-container/extended-resource-pod-2.yaml" %}
6972
7073
Kubernetes will not be able to satisfy the request for two dongles, because the first Pod
7174
used three of the four available dongles.
7275
7376
Attempt to create a Pod:
7477
7578
```shell
76-
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/oir-pod-2.yaml
79+
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/extended-resource-pod-2.yaml
7780
```
7881

7982
Describe the Pod
8083

8184
```shell
82-
kubectl describe pod oir-demo-2
85+
kubectl describe pod extended-resource-demo-2
8386
```
8487

8588
The output shows that the Pod cannot be scheduled, because there is no Node that has
@@ -93,30 +96,30 @@ Conditions:
9396
...
9497
Events:
9598
...
96-
... Warning FailedScheduling pod (oir-demo-2) failed to fit in any node
97-
fit failure summary on nodes : Insufficient pod.alpha.kubernetes.io/opaque-int-resource-dongle (1)
99+
... Warning FailedScheduling pod (extended-resource-demo-2) failed to fit in any node
100+
fit failure summary on nodes : Insufficient example.com/dongle (1)
98101
```
99102

100103
View the Pod status:
101104

102105
```shell
103-
kubectl get pod oir-demo-2
106+
kubectl get pod extended-resource-demo-2
104107
```
105108

106109
The output shows that the Pod was created, but not scheduled to run on a Node.
107110
It has a status of Pending:
108111

109112
```yaml
110-
NAME READY STATUS RESTARTS AGE
111-
oir-demo-2 0/1 Pending 0 6m
113+
NAME READY STATUS RESTARTS AGE
114+
extended-resource-demo-2 0/1 Pending 0 6m
112115
```
113116

114117
## Clean up
115118

116119
Delete the Pod that you created for this exercise:
117120

118121
```shell
119-
kubectl delete pod oir-demo-2
122+
kubectl delete pod extended-resource-demo-2
120123
```
121124

122125
{% endcapture %}
@@ -130,7 +133,7 @@ kubectl delete pod oir-demo-2
130133

131134
### For cluster administrators
132135

133-
* [Advertise Opaque Integer Resources for a Node](/docs/tasks/administer-cluster/opaque-integer-resource-node/)
136+
* [Advertise Extended Resources for a Node](/docs/tasks/administer-cluster/extended-resource-node/)
134137

135138
{% endcapture %}
136139

docs/tasks/configure-pod-container/oir-pod-2.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)