check kubernetes node\cluster resource before creating kubernetes resources

8/11/2019

on kubernetes, one can blindly create a resource (such as deployment, service, pods, etc.). the resouce will be created only if there are enough system resources on the kubernetes nodes\cluster.

  1. how does one check that there are enough node resources before creating kubernetes resources (check whether a scale-out and\or scale-up are required)?
  2. what is the best practice to check and asses that the kubernetes cluster can sustain a newly created resource before the resource is created (without doing any manual calculations)?
-- Mr.
docker
kubernetes

1 Answer

8/11/2019

What you are looking for in (1) is possible with a custom admission controller - but I personally think that is too complex and not a great idea from the user experience point of view.

What would be ideal is that once a resource is created - and if the scheduler sees that there are not enough resources - then the cluster is autoscaled. This is possible with Kubernetes Autoscaler or Escalator. Both of them allow scaling cluster based on certain conditions - but are suited for different use cases.

You can find detailed information on how does the autoscaler adds nodes when it sees that a pod could be not be scheduled here

-- Vishal Biyani
Source: StackOverflow