Files
Tim Bannister 322e88de9a Update device plugin documentation + related pages (#14331)
* Update device plugin docs for Kubernetes 1.14

& related pages

This change is mainly about feature-state shortcodes & similar.

(if there's a way to get the short version string, eg "1.14" rather
than "v1.14", then that could go in place of the hard coded value
in this commit).

* Fix code block formatting

eg code blocks incorrectly marked as:
```shell

* Use glossary shortcodes where appropriate

* Hyperlink to Prometheus

* Tidy Markdown formatting

* Change example vendor domain name

Use a name inside ".example" to highlight that this is a DNS
domain name.

* Reword device plugins documentation

* Tweak headings for device plugins

* Add "what's next" to device plugins docs

* Tweak wording for device plugins docs

* Add KubeVirt device plugins
2019-08-06 16:00:52 -07:00

3.3 KiB

title, content_template, weight
title content_template weight
Assign Extended Resources to a Container templates/task 40

{{% capture overview %}}

{{< feature-state state="stable" >}}

This page shows how to assign extended resources to a Container.

{{% /capture %}}

{{% capture prerequisites %}}

{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}

Before you do this exercise, do the exercise in Advertise Extended Resources for a Node. That will configure one of your Nodes to advertise a dongle resource.

{{% /capture %}}

{{% capture steps %}}

Assign an extended resource to a Pod

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:

{{< codenew file="pods/resource/extended-resource-pod.yaml" >}}

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

Create a Pod:

kubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod.yaml

Verify that the Pod is running:

kubectl get pod extended-resource-demo

Describe the Pod:

kubectl describe pod extended-resource-demo

The output shows dongle requests:

Limits:
  example.com/dongle: 3
Requests:
  example.com/dongle: 3

Attempt to create a second Pod

Here is the configuration file for a Pod that has one Container. The Container requests two dongles.

{{< codenew file="pods/resource/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.

Attempt to create a Pod:

kubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod-2.yaml

Describe the Pod

kubectl describe pod extended-resource-demo-2

The output shows that the Pod cannot be scheduled, because there is no Node that has 2 dongles available:

Conditions:
  Type    Status
  PodScheduled  False
...
Events:
  ...
  ... 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:

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:

NAME                       READY     STATUS    RESTARTS   AGE
extended-resource-demo-2   0/1       Pending   0          6m

Clean up

Delete the Pods that you created for this exercise:

kubectl delete pod extended-resource-demo
kubectl delete pod extended-resource-demo-2

{{% /capture %}}

{{% capture whatsnext %}}

For application developers

For cluster administrators

{{% /capture %}}