Skip to content

Commit c330471

Browse files
derekwaynecarrsteveperry-53
authored andcommitted
HugePages documentation (#5419)
1 parent 6dcb9d4 commit c330471

File tree

3 files changed

+89
-0
lines changed

3 files changed

+89
-0
lines changed

_data/tasks.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ toc:
187187
section:
188188
- docs/tasks/manage-gpus/scheduling-gpus.md
189189

190+
- title: Manage HugePages
191+
section:
192+
- docs/tasks/manage-hugepages/scheduling-hugepages.md
193+
190194
- title: Extend kubectl with plugins
191195
section:
192196
- docs/tasks/extend-kubectl/kubectl-plugins.md

docs/tasks/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ Perform common tasks for managing a DaemonSet, such as performing a rolling upda
6262

6363
Configure and schedule NVIDIA GPUs for use as a resource by nodes in a cluster.
6464

65+
#### Managing HugePages
66+
67+
Configure and schedule huge pages as a schedulable resource in a cluster.
68+
6569
### What's next
6670

6771
If you would like to write a task page, see
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
approvers:
3+
- derekwaynecarr
4+
title: Manage HugePages
5+
---
6+
7+
{% capture overview %}
8+
{% include feature-state-alpha.md %}
9+
10+
Kubernetes supports the allocation and consumption of pre-allocated huge pages
11+
by applications in a Pod as an **alpha** feature. This page describes how users
12+
can consume huge pages and the current limitations.
13+
14+
{% endcapture %}
15+
16+
{% capture prerequisites %}
17+
18+
1. Kubernetes nodes must pre-allocate huge pages in order for the node to report
19+
its huge page capacity. A node may only pre-allocate huge pages for a single
20+
size.
21+
1. A special **alpha** feature gate `HugePages` has to be set to true across the
22+
system: `--feature-gates="HugePages=true"`.
23+
24+
The nodes will automatically discover and report all huge page resources as a
25+
schedulable resource.
26+
27+
{% endcapture %}
28+
29+
{% capture steps %}
30+
31+
## API
32+
33+
Huge pages can be consumed via container level resource requirements using the
34+
resource name `hugepages-<size>`, where size is the most compact binary notation
35+
using integer values supported on a particular node. For example, if a node
36+
supports 2048KiB page sizes, it will expose a schedulable resource
37+
`hugepages-2Mi`. Unlike CPU or memory, huge pages do not support overcommit.
38+
39+
```yaml
40+
apiVersion: v1
41+
kind: Pod
42+
metadata:
43+
generateName: hugepages-volume-
44+
spec:
45+
containers:
46+
- image: fedora:latest
47+
command:
48+
- sleep
49+
- inf
50+
name: example
51+
volumeMounts:
52+
- mountPath: /hugepages
53+
name: hugepage
54+
resources:
55+
limits:
56+
hugepages-2Mi: 100Mi
57+
volumes:
58+
- name: hugepage
59+
emptyDir:
60+
medium: HugePages
61+
```
62+
63+
- Huge page requests must equal the limits. This is the default if limits are
64+
specified, but requests are not.
65+
- Huge pages are isolated at a pod scope, container isolation is planned in a
66+
future iteration.
67+
- EmptyDir volumes backed by huge pages may not consume more huge page memory
68+
than the pod request.
69+
- Applications that consume huge pages via `shmget()` with `SHM_HUGETLB` must
70+
run with a supplemental group that matches `proc/sys/vm/hugetlb_shm_group`
71+
72+
## Future
73+
74+
- Support container isolation of huge pages in addition to pod isolation.
75+
- NUMA locality guarnatees as a feature of quality of service.
76+
- ResourceQuota support.
77+
- LimitRange support.
78+
79+
{% endcapture %}
80+
81+
{% include templates/task.md %}

0 commit comments

Comments
 (0)