kubernetes logo

Advertise Extended Node Resources for a Kubernetes Node

Kubernetes

Cluster administrators often need to advertise custom hardware or software resources to Kubernetes. Extended resources let you declare these node-level assets so the scheduler can allocate them. This article shows static and dynamic methods to configure and use extended node resources.


TL;DR

  • Extended resources let you add custom node capacity and allocatable values.
  • Enable ExtendedResourcePodScheduling feature gate in Kubelet.
  • Use KubeletConfiguration or kubectl patch for static resources.
  • Device plugins offer dynamic extended resources (GPUs, NICs).
  • Scheduler respects resource namespaced as “domain/name”.
  • Pods request extended resources via spec.resources.requests.

Extended Node Resources Overview

Extended resources appear under Node.status.capacity and Node.status.allocatable. Kubernetes treats them like CPU or memory but with custom names. You declare resourceName in the form domain/name. The scheduler matches Pod.spec.resources.requests.name to Node.allocatable.name.


Configuring Extended Node Resources

Two main methods exist: static via KubeletConfiguration file and dynamic via device plugins.


Static Method: KubeletConfiguration

Edit your Kubelet config file (e.g., /var/lib/kubelet/config.yaml) to include:

Then restart Kubelet. It will update Node.status.capacity and allocatable with 4 units of example.com/foo.


Static Method: kubectl patch

For quick tests, use kubectl patch:

This command sets both capacity and allocatable of example.com/foo to 2 on node worker1.


Extended Node Resources Scheduling

Pods request extended resources under resources.requests:

The scheduler picks a node with ≥1 example.com/foo allocatable.


Dynamic Extended Node Resources

Use device plugins for hardware resources like GPUs or NICs. The plugin advertises resources through the Kubelet Device Plugin API. The Kubelet then populates Node.status with resource name and count.



Security and Access Controls

Extended resources follow the same RBAC and PodSecurityPolicies as standard resources. You can restrict which namespaces or service accounts may request custom resources.


References

Suggested Reading

PostHashID: 87f1f295ea728eb811f33e7c528d14bfdf6d8078af9afd497dcc6f0d4f822972

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.