Kubernetes v1.14
stable
Kubernetes supports the allocation and consumption of pre-allocated huge pages by applications in a Pod as a GA feature. This page describes how users can consume huge pages and the current limitations.
The nodes will automatically discover and report all huge page resources as a schedulable resource.
Huge pages can be consumed via container level resource requirements using the
resource name hugepages-<size>
, where size is the most compact binary notation
using integer values supported on a particular node. For example, if a node
supports 2048KiB page sizes, it will expose a schedulable resource
hugepages-2Mi
. Unlike CPU or memory, huge pages do not support overcommit. Note
that when requesting hugepage resources, either memory or CPU resources must
be requested as well.
apiVersion: v1
kind: Pod
metadata:
generateName: hugepages-volume-
spec:
containers:
- image: fedora:latest
command:
- sleep
- inf
name: example
volumeMounts:
- mountPath: /hugepages
name: hugepage
resources:
limits:
hugepages-2Mi: 100Mi
memory: 100Mi
requests:
memory: 100Mi
volumes:
- name: hugepage
emptyDir:
medium: HugePages
shmget()
with SHM_HUGETLB
must
run with a supplemental group that matches proc/sys/vm/hugetlb_shm_group
.cpu
or memory
using the hugepages-<size>
token.Was this page helpful?
Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on Stack Overflow. Open an issue in the GitHub repo if you want to report a problem or suggest an improvement.