<p>We have a cluster where nodes are out of resources leading to slowness and over-committing issues. This is forcing us to restart the nodes frequently. We are planning to enforce a node allocatable resource policy to split the available CPU, Memory and Ephemeral Storage between system, kubelet, and application pods.</p>

<p>Came across some guidelines on allocatable resource calculation <a href="https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-architecture" rel="nofollow noreferrer">here</a>.  </p>

<p>It does not specify how much is the split between system and kubelet resources. Also, we are on open shift and so not sure how much of this is applicable.</p>

<p>As you mentioned you are using <code>OpenShift</code> and docs you provided are from GCP. Default requirements, parameters might be differnt due to Cloud Provider specs.</p>

<p>Unfortunately I am not <code>OpenShift</code> user, but you can find in OS <a href="https://docs.openshift.com/enterprise/3.2/admin_guide/allocating_node_resources.html" rel="nofollow noreferrer">documentation</a> that: </p>

<p>Resources reserved for node components are based on two node settings: <code>kube-reserved</code> and <code>system-reserved</code>.</p>

<p>You can set these in the kubeletArguments section of the node configuration file (the <em>/etc/origin/node/node-config.yaml</em> file by default) using a set of = pairs (e.g., cpu=200m,memory=512Mi). </p>

<p><strong>How to compute Allocated Resources?</strong></p>

<p>An allocated amount of a resource is computed based on the following formula:</p>

<p><code>[Allocatable] = [Node Capacity] - [kube-reserved] - [system-reserved]</code></p>

<p>If <code>[Allocatable]</code> is negative, it is set to 0.</p>

<p>Please check below OpenShift docs: <a href="https://docs.okd.io/latest/admin_guide/allocating_node_resources.html" rel="nofollow noreferrer">Allocating node resources</a>, <a href="https://blog.openshift.com/full-cluster-capacity-management-monitoring-openshift/" rel="nofollow noreferrer">Capacity management</a>, <a href="https://docs.openshift.com/container-platform/3.7/scaling_performance/cluster_limits.html" rel="nofollow noreferrer">Cluster Limits</a>, <a href="https://docs.openshift.com/enterprise/3.1/dev_guide/limits.html" rel="nofollow noreferrer">Resource Limits</a></p>

<p>Many factors depends on what exactly pods/images you want to use. Some images might requested 0.1 CPU but others might need 1CPU to start.</p>

<p>You can limit it by create a <a href="https://docs.openshift.com/online/dev_guide/compute_resources.html" rel="nofollow noreferrer">Quota</a>, set <code>Pod</code> <a href="https://www.magalix.com/blog/kubernetes-resource-requests-and-limits-101" rel="nofollow noreferrer">requests and limits</a>.</p>

<p>Please keep in mind that you can always check current Requests/Limits in each Pod, under the Containers.containerName.Requests:</p>

<pre><code>$ os describe pod &lt;pod-name&gt;
</code></pre>

<p>Or requested resources / limits on node</p>

<pre><code>$ os describe node &lt;node-name&gt;
</code></pre>

<p>On the bottom of this description you should get All pods reqyest and limits</p>

<pre><code>Non-terminated Pods:         (6 in total)
  Namespace                  Name                                              CPU Requests  CPU Limits  Memory Requests  Memory Limits  AGE
  ---------                  ----                                              ------------  ----------  ---------------  -------------  ---
  default                    nginx-7cdbd8cdc9-b94r9                            100m (10%)    0 (0%)      0 (0%)           0 (0%)         6m2s
  default                    nginx-7cdbd8cdc9-nlsw7                            100m (10%)    0 (0%)      0 (0%)           0 (0%)         6m2s
  kube-system                fluentd-gcp-v3.2.0-lwnqn                          100m (10%)    1 (106%)    200Mi (7%)       500Mi (18%)    5h22m
  kube-system                kube-proxy-gke-stc1-default-pool-094e5c74-4dzj    100m (10%)    0 (0%)      0 (0%)           0 (0%)         5h22m
  kube-system                prometheus-to-sd-lbj57                            1m (0%)       3m (0%)     20Mi (0%)        20Mi (0%)      5h22m
  kube-system                traefik-749d86f748-frs7q                          0 (0%)        0 (0%)      0 (0%)           0 (0%)         158m
Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  Resource                   Requests    Limits
  --------                   --------    ------
  cpu                        401m (42%)  1003m (106%)
  memory                     220Mi (8%)  520Mi (19%)
  ephemeral-storage          0 (0%)      0 (0%)
  attachable-volumes-gce-pd  0           0
</code></pre>

<p>Hope it will help.</p>
