2018-11-27 18:52:17 -05:00
|
|
|
// Module included in the following assemblies:
|
|
|
|
|
//
|
|
|
|
|
// * nodes/nodes-cluster-overcommit.adoc
|
2020-05-19 14:47:58 -04:00
|
|
|
// * post_installation_configuration/node-tasks.adoc
|
2018-11-27 18:52:17 -05:00
|
|
|
|
2019-05-13 08:55:00 +10:00
|
|
|
[id="nodes-cluster-overcommit-node-enforcing_{context}"]
|
2018-11-27 18:52:17 -05:00
|
|
|
|
|
|
|
|
= Disabling or enforcing CPU limits using CPU CFS quotas
|
|
|
|
|
|
|
|
|
|
Nodes by default enforce specified CPU limits using the Completely Fair Scheduler (CFS) quota support in
|
2019-02-25 19:08:28 -05:00
|
|
|
the Linux kernel.
|
2018-11-27 18:52:17 -05:00
|
|
|
|
2019-02-25 19:08:28 -05:00
|
|
|
.Prerequisites
|
|
|
|
|
|
|
|
|
|
. Obtain the label associated with the static Machine Config Pool CRD for the type of node you want to configure.
|
2019-02-21 11:54:10 -05:00
|
|
|
Perform one of the following steps:
|
2019-02-25 19:08:28 -05:00
|
|
|
|
2019-02-21 11:54:10 -05:00
|
|
|
.. View the Machine Config Pool:
|
|
|
|
|
+
|
2020-08-05 21:30:49 -04:00
|
|
|
[source,terminal]
|
2019-02-21 11:54:10 -05:00
|
|
|
----
|
2019-03-15 17:25:47 -04:00
|
|
|
$ oc describe machineconfigpool <name>
|
2019-02-21 11:54:10 -05:00
|
|
|
----
|
|
|
|
|
+
|
|
|
|
|
For example:
|
|
|
|
|
+
|
2020-08-05 21:30:49 -04:00
|
|
|
[source,terminal]
|
2019-02-21 11:54:10 -05:00
|
|
|
----
|
2019-03-15 17:25:47 -04:00
|
|
|
$ oc describe machineconfigpool worker
|
2020-08-05 21:30:49 -04:00
|
|
|
----
|
|
|
|
|
+
|
|
|
|
|
.Example output
|
|
|
|
|
[source,terminal]
|
|
|
|
|
----
|
2019-02-21 11:54:10 -05:00
|
|
|
apiVersion: machineconfiguration.openshift.io/v1
|
|
|
|
|
kind: MachineConfigPool
|
|
|
|
|
metadata:
|
|
|
|
|
creationTimestamp: 2019-02-08T14:52:39Z
|
|
|
|
|
generation: 1
|
|
|
|
|
labels:
|
|
|
|
|
custom-kubelet: small-pods <1>
|
|
|
|
|
----
|
|
|
|
|
<1> If a label has been added it appears under `labels`.
|
|
|
|
|
|
|
|
|
|
.. If the label is not present, add a key/value pair:
|
|
|
|
|
+
|
2020-08-05 21:30:49 -04:00
|
|
|
[source,terminal]
|
2019-02-21 11:54:10 -05:00
|
|
|
----
|
2019-02-25 19:08:28 -05:00
|
|
|
$ oc label machineconfigpool worker custom-kubelet=small-pods
|
|
|
|
|
----
|
2019-02-21 11:54:10 -05:00
|
|
|
|
|
|
|
|
.Procedure
|
2018-11-27 18:52:17 -05:00
|
|
|
|
2019-02-12 17:37:14 -05:00
|
|
|
. Create a Custom Resource (CR) for your configuration change.
|
2019-02-21 11:54:10 -05:00
|
|
|
+
|
|
|
|
|
.Sample configuration for a disabling CPU limits
|
2018-11-27 18:52:17 -05:00
|
|
|
[source,yaml]
|
|
|
|
|
----
|
2019-02-21 11:54:10 -05:00
|
|
|
apiVersion: machineconfiguration.openshift.io/v1
|
|
|
|
|
kind: KubeletConfig
|
|
|
|
|
metadata:
|
|
|
|
|
name: disable-cpu-units <1>
|
|
|
|
|
spec:
|
|
|
|
|
machineConfigPoolSelector:
|
2019-02-25 19:08:28 -05:00
|
|
|
matchLabels:
|
2019-02-21 11:54:10 -05:00
|
|
|
custom-kubelet: small-pods <2>
|
2019-02-25 19:08:28 -05:00
|
|
|
kubeletConfig:
|
2019-02-21 11:54:10 -05:00
|
|
|
cpu-cfs-quota: <3>
|
|
|
|
|
- "false"
|
2018-11-27 18:52:17 -05:00
|
|
|
----
|
2019-02-12 17:37:14 -05:00
|
|
|
<1> Assign a name to CR.
|
2019-02-21 11:54:10 -05:00
|
|
|
<2> Specify the label to apply the configuration change.
|
|
|
|
|
<3> Set the `cpu-cfs-quota` parameter to `false`.
|
2018-11-27 18:52:17 -05:00
|
|
|
|
|
|
|
|
If CPU limit enforcement is disabled, it is important to understand the impact that will have on your node:
|
|
|
|
|
|
|
|
|
|
- If a container makes a request for CPU, it will continue to be enforced by CFS
|
|
|
|
|
shares in the Linux kernel.
|
|
|
|
|
- If a container makes no explicit request for CPU, but it does specify a limit,
|
|
|
|
|
the request will default to the specified limit, and be enforced by CFS shares
|
|
|
|
|
in the Linux kernel.
|
|
|
|
|
- If a container specifies both a request and a limit for CPU, the request will
|
|
|
|
|
be enforced by CFS shares in the Linux kernel, and the limit will have no
|
|
|
|
|
impact on the node.
|