How to limit the maximum number of running pods

4/20/2018

We currently have around 20 jobs. These jobs create one pod each, but we want to make sure that only one of these pods can run at a time, keeping the rest of them in pending status. Increasing the resource limitations makes them to run one by one but I want to be sure that this is always the behaviour.

Is there any way of limiting this concurrency to 1, let's say per label or something similar?

-- djuarez
kubernetes
openshift

1 Answer

4/23/2018

Use ResourceQuota resource:

apiVersion: v1
kind: ResourceQuota
metadata:
  name: pod-demo
spec:
  hard:
    pods: "5"
-- Nicola Ben
Source: StackOverflow