Skip to content

Commit a1dfece

Browse files
ConnorDoylesteveperry-53
authored andcommitted
Updated CPU manager docs to match implementation. (#5332)
* Noted limitation of alpha static cpumanager. * Updated CPU manager docs to match implementation. - Removed references to CPU pressure node condition and evictions. - Added note about new --cpu-manager-reconcile-period flag. - Added note about node allocatable requirements for static policy. - Noted limitation of alpha static cpumanager. * Move cpu-manager task link to rsc mgmt section.
1 parent 2cf12d2 commit a1dfece

File tree

2 files changed

+34
-26
lines changed

2 files changed

+34
-26
lines changed

_data/tasks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ toc:
124124
- docs/tasks/administer-cluster/quota-pod-namespace.md
125125
- docs/tasks/administer-cluster/quota-api-object.md
126126
- docs/tasks/administer-cluster/opaque-integer-resource-node.md
127+
- docs/tasks/administer-cluster/cpu-management-policies.md
127128
- docs/tasks/administer-cluster/access-cluster-api.md
128129
- docs/tasks/administer-cluster/access-cluster-services.md
129130
- docs/tasks/administer-cluster/securing-a-cluster.md
@@ -140,7 +141,6 @@ toc:
140141
- docs/tasks/administer-cluster/cpu-memory-limit.md
141142
- docs/tasks/administer-cluster/out-of-resource.md
142143
- docs/tasks/administer-cluster/reserve-compute-resources.md
143-
- docs/tasks/administer-cluster/cpu-management-policies.md
144144
- docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods.md
145145
- docs/tasks/administer-cluster/declare-network-policy.md
146146
- title: Install Network Policy Provider

docs/tasks/administer-cluster/cpu-management-policies.md

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ directives.
1515
## CPU Management Policies
1616

1717
By default, the kubelet uses [CFS quota](https://en.wikipedia.org/wiki/Completely_Fair_Scheduler)
18-
to enforce pod CPU limits.  When the node runs many CPU bound pods,
18+
to enforce pod CPU limits.  When the node runs many CPU-bound pods,
1919
the workload can move to different CPU cores depending on
2020
whether the pod is throttled and which CPU cores are available at
2121
scheduling time.  Many workloads are not sensitive to this migration and thus
@@ -25,13 +25,25 @@ However, in workloads where CPU cache affinity and scheduling latency
2525
significantly affect workload performance, the kubelet allows alternative CPU
2626
management policies to determine some placement preferences on the node.
2727

28-
Enable these management policies with the `--cpu-manager-policy` kubelet
29-
option.  There are two supported policies:
28+
### Configuration
3029

31-
* `none`: the default, which represents the existing scheduling behavior
30+
The CPU Manager is introduced as an alpha feature in Kubernetes v1.8. It
31+
must be explicitly enabled in the kubelet feature gates:
32+
`--feature-gates=CPUManager=true`.
33+
34+
The CPU Manager policy is set with the `--cpu-manager-policy` kubelet
35+
option. There are two supported policies:
36+
37+
* `none`: the default, which represents the existing scheduling behavior.
3238
* `static`: allows pods with certain resource characteristics to be
3339
granted increased CPU affinity and exclusivity on the node.
3440

41+
The CPU manager periodically writes resource updates through the CRI in
42+
order to reconcile in-memory CPU assignments with cgroupfs. The reconcile
43+
frequency is set through a new Kubelet configuration value
44+
`--cpu-manager-reconcile-period`. If not specified, it defaults to the same
45+
duration as `--node-status-update-frequency`.
46+
3547
### None policy
3648

3749
The `none` policy explicitly enables the existing default CPU
@@ -49,8 +61,13 @@ using the [cpuset cgroup controller](https://www.kernel.org/doc/Documentation/cg
4961
**Note:** System services such as the container runtime and the kubelet itself can continue to run on these exclusive CPUs.  The exclusivity only extends to other pods.
5062
{: .note}
5163

64+
**Note:** The alpha version of this policy does not guarantee static
65+
exclusive allocations across Kubelet restarts.
66+
{: .note}
67+
5268
This policy manages a shared pool of CPUs that initially contains all CPUs in the
53-
node minus any reservations by the kubelet `--kube-reserved` or
69+
node. The amount of exclusively allocatable CPUs is equal to the total
70+
number of CPUs in the node minus any CPU reservations by the kubelet `--kube-reserved` or
5471
`--system-reserved` options. CPUs reserved by these options are taken, in
5572
integer quantity, from the initial shared pool in ascending order by physical
5673
core ID.  This shared pool is the set of CPUs on which any containers in
@@ -59,26 +76,21 @@ cpu `requests` also run on CPUs in the shared pool. Only containers that are
5976
both part of a `Guaranteed` pod and have integer CPU `requests` are assigned
6077
exclusive CPUs.
6178

62-
**Note:** When reserving CPU with `--kube-reserved` or `--system-reserved` options, it is advised to use *integer* CPU quantities.
79+
**Note:** The kubelet requires a CPU reservation greater than zero be made
80+
using either `--kube-reserved` and/or `--system-reserved` when the static
81+
policy is enabled. This is because zero CPU reservation would allow the shared
82+
pool to become empty.
6383
{: .note}
6484

6585
As `Guaranteed` pods whose containers fit the requirements for being statically
6686
assigned are scheduled to the node, CPUs are removed from the shared pool and
67-
placed in the cpuset for the container.  CFS quota is not used to bound
87+
placed in the cpuset for the container. CFS quota is not used to bound
6888
the CPU usage of these containers as their usage is bound by the scheduling domain
6989
itself. In others words, the number of CPUs in the container cpuset is equal to the integer
70-
CPU `limit` specified in the pod spec.  This static assignment increases CPU
71-
affinity and decreases context switches due to throttling for the CPU bound
90+
CPU `limit` specified in the pod spec. This static assignment increases CPU
91+
affinity and decreases context switches due to throttling for the CPU-bound
7292
workload.
7393

74-
In the event that the shared pool is depleted the kubelet takes two actions:
75-
76-
* Evict all pods that include a container that does not specify a `cpu`
77-
quantity in `requests` as those pods now have no CPUs on which to run.
78-
* Set a `NodeCPUPressure` node condition to `true` in the node status. When
79-
this condition is true, the scheduler will not assign any pod to the node
80-
that has a container which lacks a `cpu` quantity in `requests`.
81-
8294
Consider the containers in the following pod specs:
8395

8496
```yaml
@@ -89,8 +101,7 @@ spec:
89101
```
90102
91103
This pod runs in the `BestEffort` QoS class because no resource `requests` or
92-
`limits` are specified. It is evicted if shared pool is depleted. It runs
93-
in the shared pool.
104+
`limits` are specified. It runs in the shared pool.
94105

95106
```yaml
96107
spec:
@@ -105,9 +116,8 @@ spec:
105116
```
106117

107118
This pod runs in the `Burstable` QoS class because resource `requests` do not
108-
equal `limits` and the `cpu` quantity is not specified. It is
109-
evicted if shared pool is depleted. It runs in the shared pool.
110-
119+
equal `limits` and the `cpu` quantity is not specified. It runs in the shared
120+
pool.
111121

112122
```yaml
113123
spec:
@@ -124,9 +134,7 @@ spec:
124134
```
125135

126136
This pod runs in the `Burstable` QoS class because resource `requests` do not
127-
equal `limits`. The non-zero `cpu` quantity in `requests` prevents the
128-
shared pool from depleting. It runs in the shared pool.
129-
137+
equal `limits`. It runs in the shared pool.
130138

131139
```yaml
132140
spec:

0 commit comments

Comments
 (0)