// Module included in the following assemblies:
//
// * nodes/nodes-nodes-managing-max-pods.adoc
// * post_installation_configuration/node-tasks.adoc

:_mod-docs-content-type: PROCEDURE
[id="nodes-nodes-managing-max-pods-proc_{context}"]
= Configuring the maximum number of pods per node

[role="_abstract"]
You can use the `podsPerCore` and `maxPods` parameters in a kubelet configuration to control the maximum number of pods that can be scheduled to a node. If you use both options, the lower of the two limits the number of pods on a node. Setting an appropriate maximum can help ensure your nodes run efficiently.

For example, if `podsPerCore` is set to `10` on a node with 4 processor cores, the maximum number of pods allowed on the node will be 40.

.Prerequisites

* You have the label associated with the static `MachineConfigPool` CRD for the type of node you want to configure.

.Procedure

. Create a custom resource (CR) for your configuration change.
+
.Sample configuration for a `max-pods` CR
[source,yaml]
----
apiVersion: machineconfiguration.openshift.io/v1
kind: KubeletConfig
metadata:
  name: set-max-pods
spec:
  machineConfigPoolSelector:
    matchLabels:
      pools.operator.machineconfiguration.openshift.io/worker: ""
  kubeletConfig:
    podsPerCore: 10
    maxPods: 250
#...
----
+
where:
+
--
`metadata.name`:: Specifies a name for the CR.
`spec.machineConfigPoolSelector.matchLabels`:: Specifies the label from the machine config pool.
`spec.kubeletConfig.podsPerCore`:: Specifies the number of pods the node can run based on the number of processor cores on the node.
`spec.kubeletConfig.maxPods`:: Specifies the number of pods the node can run to a fixed value, regardless of the properties of the node.
+
[NOTE]
====
Setting `podsPerCore` to `0` disables this limit.
====
+
In the above example, the default value for `podsPerCore` is `10` and the default value for `maxPods` is `250`. This means that unless the node has 25 cores or more, by default, `podsPerCore` will be the limiting factor.
--

. Run the following command to create the CR:
+
[source,terminal]
----
$ oc create -f <file_name>.yaml
----

.Verification

* List the `MachineConfigPool` CRDs to check if the change is applied. The `UPDATING` column reports `True` if the change is picked up by the Machine Config Controller:
+
[source,terminal]
----
$ oc get machineconfigpools
----
+
.Example output
[source,terminal]
----
NAME     CONFIG                        UPDATED   UPDATING   DEGRADED
master   master-9cc2c72f205e103bb534   False     False      False
worker   worker-8cecd1236b33ee3f8a5e   False     True       False
----
+
After the change is complete, the `UPDATED` column reports `True`.
+
[source,terminal]
----
$ oc get machineconfigpools
----
+
.Example output
[source,terminal]
----
NAME     CONFIG                        UPDATED   UPDATING   DEGRADED
master   master-9cc2c72f205e103bb534   False     True       False
worker   worker-8cecd1236b33ee3f8a5e   True      False      False
----
