You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Copy file name to clipboardExpand all lines: docs/tasks/administer-cluster/cpu-management-policies.md
+33-25Lines changed: 33 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ directives.
15
15
## CPU Management Policies
16
16
17
17
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 CPUbound pods,
18
+
to enforce pod CPU limits. When the node runs many CPU-bound pods,
19
19
the workload can move to different CPU cores depending on
20
20
whether the pod is throttled and which CPU cores are available at
21
21
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
25
25
significantly affect workload performance, the kubelet allows alternative CPU
26
26
management policies to determine some placement preferences on the node.
27
27
28
-
Enable these management policies with the `--cpu-manager-policy` kubelet
29
-
option. There are two supported policies:
28
+
### Configuration
30
29
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.
32
38
*`static`: allows pods with certain resource characteristics to be
33
39
granted increased CPU affinity and exclusivity on the node.
34
40
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
+
35
47
### None policy
36
48
37
49
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
49
61
**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.
50
62
{: .note}
51
63
64
+
**Note:** The alpha version of this policy does not guarantee static
65
+
exclusive allocations across Kubelet restarts.
66
+
{: .note}
67
+
52
68
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
54
71
`--system-reserved` options. CPUs reserved by these options are taken, in
55
72
integer quantity, from the initial shared pool in ascending order by physical
56
73
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
59
76
both part of a `Guaranteed` pod and have integer CPU `requests` are assigned
60
77
exclusive CPUs.
61
78
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.
63
83
{: .note}
64
84
65
85
As `Guaranteed` pods whose containers fit the requirements for being statically
66
86
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
68
88
the CPU usage of these containers as their usage is bound by the scheduling domain
69
89
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 CPUbound
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
72
92
workload.
73
93
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
-
82
94
Consider the containers in the following pod specs:
83
95
84
96
```yaml
@@ -89,8 +101,7 @@ spec:
89
101
```
90
102
91
103
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.
94
105
95
106
```yaml
96
107
spec:
@@ -105,9 +116,8 @@ spec:
105
116
```
106
117
107
118
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.
111
121
112
122
```yaml
113
123
spec:
@@ -124,9 +134,7 @@ spec:
124
134
```
125
135
126
136
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.
0 commit comments