Increase number of pods per node in Openshift v3

By default OSE v3 will allow maximum 40 pods per OSE v3 node and if you try to schedule next one it will end with below error message which is visible in oc describe pod pod_id

oc describe pod pod-95

Events
FirstSeen LastSeen Count   From		SubobjectPath	Reason			Message
──────    ──────   ───     ───		───────────	──────			───────
  5m	  4m	   7	  {scheduler }	              FailedScheduling	Failed for reason PodFitsResources and possibly others
  3m	  3m	   1	  {scheduler }	              Scheduled		Successfully assigned pod-95 to ose3-master.example.com

The error message

 Failed for reason PodFitsResources and possibly others

is key for reason it failed. Fortunately fix is easy
Edit on OSE node /etc/origin/node/node-config.yml and add there

kubeletArguments:
  max-pods:
  - "200"

In this example I want 200 pods per node. However, another (default) limitation is 254 pods per node, and this is due to

hostSubnetLength: 8

in OSE master configuration file

/etc/origin/master/master-config.yml

So even with max-pods in order to schedule more than 254 pods per node it is necessary to edit hostSubnetLength and give more bits for pods ip address allocation. More about this read Openshift architecture

At the end small reminder, after editing configuration files, do not forget to restart services

systemctl restart atomic-openshift-master
systemctl restart atomic-openshift-node
Advertisements

#change-number-of-pods-per-node, #docker, #openshift, #openshift-node, #openshift-origin, #paas