Merge pull request #6531 from ConnorDoyle/rm-oir
Ported OIR tasks to use Extended Resources.
This commit is contained in:
commit
2136efb975
|
|
@ -15,7 +15,7 @@ toc:
|
|||
- docs/tasks/configure-pod-container/assign-cpu-resource.md
|
||||
- docs/tasks/configure-pod-container/quality-service-pod.md
|
||||
- docs/tasks/configure-pod-container/assign-cpu-ram-container.md
|
||||
- docs/tasks/configure-pod-container/opaque-integer-resource.md
|
||||
- docs/tasks/configure-pod-container/extended-resource.md
|
||||
- docs/tasks/configure-pod-container/configure-volume-storage.md
|
||||
- docs/tasks/configure-pod-container/configure-persistent-volume-storage.md
|
||||
- docs/tasks/configure-pod-container/configure-projected-volume-storage.md
|
||||
|
|
@ -128,7 +128,7 @@ toc:
|
|||
- docs/tasks/administer-cluster/quota-memory-cpu-namespace.md
|
||||
- docs/tasks/administer-cluster/quota-pod-namespace.md
|
||||
- docs/tasks/administer-cluster/quota-api-object.md
|
||||
- docs/tasks/administer-cluster/opaque-integer-resource-node.md
|
||||
- docs/tasks/administer-cluster/extended-resource-node.md
|
||||
- docs/tasks/administer-cluster/cpu-management-policies.md
|
||||
- docs/tasks/administer-cluster/access-cluster-api.md
|
||||
- docs/tasks/administer-cluster/access-cluster-services.md
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
title: Advertise Opaque Integer Resources for a Node
|
||||
title: Advertise Extended Resources for a Node
|
||||
---
|
||||
|
||||
|
||||
{% capture overview %}
|
||||
|
||||
This page shows how to specify opaque integer resources for a Node.
|
||||
Opaque integer resources allow cluster administrators to advertise node-level
|
||||
This page shows how to specify extended resources for a Node.
|
||||
Extended resources allow cluster administrators to advertise node-level
|
||||
resources that would otherwise be unknown to Kubernetes.
|
||||
|
||||
{% include feature-state-deprecated.md %}
|
||||
{% include feature-state-stable.md %}
|
||||
|
||||
{% endcapture %}
|
||||
|
||||
|
|
@ -31,9 +31,9 @@ kubectl get nodes
|
|||
|
||||
Choose one of your Nodes to use for this exercise.
|
||||
|
||||
## Advertise a new opaque integer resource on one of your Nodes
|
||||
## Advertise a new extended resource on one of your Nodes
|
||||
|
||||
To advertise a new opaque integer resource on a Node, send an HTTP PATCH request to
|
||||
To advertise a new extended resource on a Node, send an HTTP PATCH request to
|
||||
the Kubernetes API server. For example, suppose one of your Nodes has four dongles
|
||||
attached. Here's an example of a PATCH request that advertises four dongle resources
|
||||
for your Node.
|
||||
|
|
@ -47,7 +47,7 @@ Host: k8s-master:8080
|
|||
[
|
||||
{
|
||||
"op": "add",
|
||||
"path": "/status/capacity/pod.alpha.kubernetes.io~1opaque-int-resource-dongle",
|
||||
"path": "/status/capacity/example.com~1dongle",
|
||||
"value": "4"
|
||||
}
|
||||
]
|
||||
|
|
@ -69,7 +69,7 @@ Replace `<your-node-name>` with the name of your Node:
|
|||
```shell
|
||||
curl --header "Content-Type: application/json-patch+json" \
|
||||
--request PATCH \
|
||||
--data '[{"op": "add", "path": "/status/capacity/pod.alpha.kubernetes.io~1opaque-int-resource-dongle", "value": "4"}]' \
|
||||
--data '[{"op": "add", "path": "/status/capacity/example.com~1dongle", "value": "4"}]' \
|
||||
http://localhost:8001/api/v1/nodes/<your-node-name>/status
|
||||
```
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ The output shows that the Node has a capacity of 4 dongles:
|
|||
"alpha.kubernetes.io/nvidia-gpu": "0",
|
||||
"cpu": "2",
|
||||
"memory": "2049008Ki",
|
||||
"pod.alpha.kubernetes.io/opaque-int-resource-dongle": "4",
|
||||
"example.com/dongle": "4",
|
||||
```
|
||||
|
||||
Describe your Node:
|
||||
|
|
@ -98,53 +98,52 @@ Once again, the output shows the dongle resource:
|
|||
|
||||
```yaml
|
||||
Capacity:
|
||||
alpha.kubernetes.io/nvidia-gpu: 0
|
||||
cpu: 2
|
||||
memory: 2049008Ki
|
||||
pod.alpha.kubernetes.io/opaque-int-resource-dongle: 4
|
||||
alpha.kubernetes.io/nvidia-gpu: 0
|
||||
cpu: 2
|
||||
memory: 2049008Ki
|
||||
example.com/dongle: 4
|
||||
```
|
||||
|
||||
Now, application developers can create Pods that request a certain
|
||||
number of dongles. See
|
||||
[Assign Opaque Integer Resources to a Container](/docs/tasks/configure-pod-container/opaque-integer-resource/).
|
||||
[Assign Extended Resources to a Container](/docs/tasks/configure-pod-container/extended-resource/).
|
||||
|
||||
## Discussion
|
||||
|
||||
Opaque integer resources are similar to memory and CPU resources. For example,
|
||||
Extended resources are similar to memory and CPU resources. For example,
|
||||
just as a Node has a certain amount of memory and CPU to be shared by all components
|
||||
running on the Node, it can have a certain number of dongles to be shared
|
||||
by all components running on the Node. And just as application developers
|
||||
can create Pods that request a certain amount of memory and CPU, they can
|
||||
create Pods that request a certain number of dongles.
|
||||
|
||||
Opaque integer resources are called opaque because Kubernetes does not
|
||||
Extended resources are opaque to Kubernetes; Kubernetes does not
|
||||
know anything about what they are. Kubernetes knows only that a Node
|
||||
has a certain number of them. They are called integer resources because
|
||||
they must be advertised in integer amounts. For example, a Node can advertise
|
||||
four dongles, but not 4.5 dongles.
|
||||
has a certain number of them. Extended resources must be advertised in integer
|
||||
amounts. For example, a Node can advertise four dongles, but not 4.5 dongles.
|
||||
|
||||
### Storage example
|
||||
|
||||
Suppose a Node has 800 GiB of a special kind of disk storage. You could
|
||||
create a name for the special storage, say opaque-int-resource-special-storage.
|
||||
create a name for the special storage, say example.com/special-storage.
|
||||
Then you could advertise it in chunks of a certain size, say 100 GiB. In that case,
|
||||
your Node would advertise that it has eight resources of type
|
||||
opaque-int-resource-special-storage.
|
||||
example.com/special-storage.
|
||||
|
||||
```yaml
|
||||
Capacity:
|
||||
...
|
||||
pod.alpha.kubernetes.io/opaque-int-resource-special-storage: 8
|
||||
example.com/special-storage: 8
|
||||
```
|
||||
|
||||
If you want to allow arbitrary requests for special storage, you
|
||||
could advertise special storage in chunks of size 1 byte. In that case, you would advertise
|
||||
800Gi resources of type opaque-int-resource-special-storage.
|
||||
800Gi resources of type example.com/special-storage.
|
||||
|
||||
```yaml
|
||||
Capacity:
|
||||
...
|
||||
pod.alpha.kubernetes.io/opaque-int-resource-special-storage: 800Gi
|
||||
example.com/special-storage: 800Gi
|
||||
```
|
||||
|
||||
Then a Container could request any number of bytes of special storage, up to 800Gi.
|
||||
|
|
@ -162,7 +161,7 @@ Host: k8s-master:8080
|
|||
[
|
||||
{
|
||||
"op": "remove",
|
||||
"path": "/status/capacity/pod.alpha.kubernetes.io~1opaque-int-resource-dongle",
|
||||
"path": "/status/capacity/example.com~1dongle",
|
||||
}
|
||||
]
|
||||
```
|
||||
|
|
@ -179,7 +178,7 @@ Replace `<your-node-name>` with the name of your Node:
|
|||
```shell
|
||||
curl --header "Content-Type: application/json-patch+json" \
|
||||
--request PATCH \
|
||||
--data '[{"op": "remove", "path": "/status/capacity/pod.alpha.kubernetes.io~1opaque-int-resource-dongle"}]' \
|
||||
--data '[{"op": "remove", "path": "/status/capacity/example.com~1dongle"}]' \
|
||||
http://localhost:8001/api/v1/nodes/<your-node-name>/status
|
||||
```
|
||||
|
||||
|
|
@ -196,7 +195,7 @@ kubectl describe node <your-node-name> | grep dongle
|
|||
|
||||
### For application developers
|
||||
|
||||
* [Assign Opaque Integer Resources to a Container](/docs/tasks/configure-pod-container/opaque-integer-resource/)
|
||||
* [Assign Extended Resources to a Container](/docs/tasks/configure-pod-container/extended-resource/)
|
||||
|
||||
### For cluster administrators
|
||||
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: oir-demo
|
||||
name: extended-resource-demo-2
|
||||
spec:
|
||||
containers:
|
||||
- name: oir-demo-ctr
|
||||
- name: extended-resource-demo-2-ctr
|
||||
image: nginx
|
||||
resources:
|
||||
requests:
|
||||
pod.alpha.kubernetes.io/opaque-int-resource-dongle: 3
|
||||
example.com/dongle: 2
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: extended-resource-demo
|
||||
spec:
|
||||
containers:
|
||||
- name: extended-resource-demo-ctr
|
||||
image: nginx
|
||||
resources:
|
||||
requests:
|
||||
example.com/dongle: 3
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
title: Assign Opaque Integer Resources to a Container
|
||||
title: Assign Extended Resources to a Container
|
||||
---
|
||||
|
||||
{% capture overview %}
|
||||
|
||||
This page shows how to assign opaque integer resources to a Container.
|
||||
This page shows how to assign extended resources to a Container.
|
||||
|
||||
{% include feature-state-deprecated.md %}
|
||||
{% include feature-state-stable.md %}
|
||||
|
||||
{% endcapture %}
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ This page shows how to assign opaque integer resources to a Container.
|
|||
{% include task-tutorial-prereqs.md %}
|
||||
|
||||
Before you do this exercise, do the exercise in
|
||||
[Advertise Opaque Integer Resources for a Node](/docs/tasks/administer-cluster/opaque-integer-resource-node/).
|
||||
[Advertise Extended Resources for a Node](/docs/tasks/administer-cluster/extended-resource-node/).
|
||||
That will configure one of your Nodes to advertise a dongle resource.
|
||||
|
||||
{% endcapture %}
|
||||
|
|
@ -24,40 +24,43 @@ That will configure one of your Nodes to advertise a dongle resource.
|
|||
|
||||
{% capture steps %}
|
||||
|
||||
## Assign an opaque integer resource to a Pod
|
||||
## Assign an extended resource to a Pod
|
||||
|
||||
To request an opaque integer resource, include the `resources:requests` field in your
|
||||
Container manifest. Opaque integer resources have the prefix `pod.alpha.kubernetes.io/opaque-int-resource-`.
|
||||
To request an extended resource, include the `resources:requests` field in your
|
||||
Container manifest. Extended resources are fully qualified with any domain outside of
|
||||
`*.kubernetes.io/`. Valid extended resource names have the form `example.com/foo` where
|
||||
`example.com` is replaced with your organization's domain and `foo` is a
|
||||
descriptive resource name.
|
||||
|
||||
Here is the configuration file for a Pod that has one Container:
|
||||
|
||||
{% include code.html language="yaml" file="oir-pod.yaml" ghlink="/docs/tasks/configure-pod-container/oir-pod.yaml" %}
|
||||
{% include code.html language="yaml" file="extended-resource-pod.yaml" ghlink="/docs/tasks/configure-pod-container/extended-resource-pod.yaml" %}
|
||||
|
||||
In the configuration file, you can see that the Container requests 3 dongles.
|
||||
|
||||
Create a Pod:
|
||||
|
||||
```shell
|
||||
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/oir-pod.yaml
|
||||
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/extended-resource-pod.yaml
|
||||
```
|
||||
|
||||
Verify that the Pod is running:
|
||||
|
||||
```shell
|
||||
kubectl get pod oir-demo
|
||||
kubectl get pod extended-resource-demo
|
||||
```
|
||||
|
||||
Describe the Pod:
|
||||
|
||||
```shell
|
||||
kubectl describe pod oir-demo
|
||||
kubectl describe pod extended-resource-demo
|
||||
```
|
||||
|
||||
The output shows dongle requests:
|
||||
|
||||
```yaml
|
||||
Requests:
|
||||
pod.alpha.kubernetes.io/opaque-int-resource-dongle: 3
|
||||
example.com/dongle: 3
|
||||
```
|
||||
|
||||
## Attempt to create a second Pod
|
||||
|
|
@ -65,7 +68,7 @@ Requests:
|
|||
Here is the configuration file for a Pod that has one Container. The Container requests
|
||||
two dongles.
|
||||
|
||||
{% include code.html language="yaml" file="oir-pod-2.yaml" ghlink="/docs/tasks/configure-pod-container/oir-pod-2.yaml" %}
|
||||
{% include code.html language="yaml" file="extended-resource-pod-2.yaml" ghlink="/docs/tasks/configure-pod-container/extended-resource-pod-2.yaml" %}
|
||||
|
||||
Kubernetes will not be able to satisfy the request for two dongles, because the first Pod
|
||||
used three of the four available dongles.
|
||||
|
|
@ -73,13 +76,13 @@ used three of the four available dongles.
|
|||
Attempt to create a Pod:
|
||||
|
||||
```shell
|
||||
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/oir-pod-2.yaml
|
||||
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/extended-resource-pod-2.yaml
|
||||
```
|
||||
|
||||
Describe the Pod
|
||||
|
||||
```shell
|
||||
kubectl describe pod oir-demo-2
|
||||
kubectl describe pod extended-resource-demo-2
|
||||
```
|
||||
|
||||
The output shows that the Pod cannot be scheduled, because there is no Node that has
|
||||
|
|
@ -93,22 +96,22 @@ Conditions:
|
|||
...
|
||||
Events:
|
||||
...
|
||||
... Warning FailedScheduling pod (oir-demo-2) failed to fit in any node
|
||||
fit failure summary on nodes : Insufficient pod.alpha.kubernetes.io/opaque-int-resource-dongle (1)
|
||||
... Warning FailedScheduling pod (extended-resource-demo-2) failed to fit in any node
|
||||
fit failure summary on nodes : Insufficient example.com/dongle (1)
|
||||
```
|
||||
|
||||
View the Pod status:
|
||||
|
||||
```shell
|
||||
kubectl get pod oir-demo-2
|
||||
kubectl get pod extended-resource-demo-2
|
||||
```
|
||||
|
||||
The output shows that the Pod was created, but not scheduled to run on a Node.
|
||||
It has a status of Pending:
|
||||
|
||||
```yaml
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
oir-demo-2 0/1 Pending 0 6m
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
extended-resource-demo-2 0/1 Pending 0 6m
|
||||
```
|
||||
|
||||
## Clean up
|
||||
|
|
@ -116,7 +119,7 @@ oir-demo-2 0/1 Pending 0 6m
|
|||
Delete the Pod that you created for this exercise:
|
||||
|
||||
```shell
|
||||
kubectl delete pod oir-demo-2
|
||||
kubectl delete pod extended-resource-demo-2
|
||||
```
|
||||
|
||||
{% endcapture %}
|
||||
|
|
@ -130,7 +133,7 @@ kubectl delete pod oir-demo-2
|
|||
|
||||
### For cluster administrators
|
||||
|
||||
* [Advertise Opaque Integer Resources for a Node](/docs/tasks/administer-cluster/opaque-integer-resource-node/)
|
||||
* [Advertise Extended Resources for a Node](/docs/tasks/administer-cluster/extended-resource-node/)
|
||||
|
||||
{% endcapture %}
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: oir-demo-2
|
||||
spec:
|
||||
containers:
|
||||
- name: oir-demo-2-ctr
|
||||
image: nginx
|
||||
resources:
|
||||
requests:
|
||||
pod.alpha.kubernetes.io/opaque-int-resource-dongle: 2
|
||||
Loading…
Reference in New Issue