Kubernetes: how is it possible to test whether there is a node with sufficient resources before starting a job

3/16/2021

Is it possible to test whether there is a node with sufficient resources before starting a job?

-- micha
kubectl
kubernetes

1 Answer

3/17/2021

I think that depends on the environment you are building (from my experience).

Disk space, process power and memory can be easily tracked.

From the control plane you can install kubernetes/metrics-server and use

kubectl top nodes

for the current situation of the nodes. Also if you have local volume provisioning via blockDevices (eq. openebs-cstore) You can always use

kubectl get bd --all-namespaces

to see the available blockdevices or if you have cstore pools

kubectl get csp --all-namespaces

to check the allocation process and capacity on the disks.

EQ.

NAME                   ALLOCATED   FREE    CAPACITY   STATUS    READONLY   TYPE      AGE
cstor-disk-pool-1tgd   264K        19.9G   19.9G      Healthy   false      striped   22h
cstor-disk-pool-3cvq   393K        19.9G   19.9G      Healthy   false      striped   22h
cstor-disk-pool-coq6   254K        9.94G   9.94G      Healthy   false      striped   22h

In the local version these information are avaliable and useful (for me at least).

Once you check these resources if you have a deployment definition with resource claims (cpu and memory included) you can decide whether you need more or less of a specific resource.

Also you can create a test environment to freely test the deployment (with higher resources) and than decide the cluster or the node you want to use.

-- Catastrophe
Source: StackOverflow