0
votes

How can I request kubernetes to allocate all of the available huge-pages on a node to my app pod?

My application uses huge-pages. Before deploying to kubernetes, I have configured kubernetes nodes for huge-pages and I know by specifying the limits & requests as mentioned in the k8s docs, my app pod can make use of huge-pages. But this somehow tightly couples the node specs to my app configuration. If my app was to run on different nodes with different amount of huge-pages, I will have to keep overriding these values based on target environment.

    resources:
      limits:
        hugepages-2Mi: 100Mi

But then as per k8s doc, "Huge page requests must equal the limits. This is the default if limits are specified, but requests are not."

Is there a way I can somehow request k8s to allocate all available huge-pages to my app pod OR just keep it dynamic like in case of an unspecified memory or cpu requests/limits?

1

1 Answers

0
votes

From the design proposal, it looks like the huge pages resource request is fixed and not designed for scenarios where there can be multiple sizes:

We believe it is rare for applications to attempt to use multiple huge page sizes.

Although you're not trying to use multiple values but dynamically modify them (once the pod is deployed), the sizes must be consistent and are rather used for pod pre-allocation and to determine how to treat reserved resources in the scheduler.

This means that is mostly used to assess resources in a fixed way, expecting a somewhat uniform scenario (where node-level page sizes were previously set).

Looks like you're going to have to rollout different pod specs depending on your nodes settings. For that, maybe some "traditional" tainting in the nodes would help identifying specific resources in an heterogeneous cluster.