1

I need to queue Kubernetes resources, basing on the Kubernetes quotas.

Sample expected scenario:

  • a user creates Kubernetes resource (let's say a simple X pod)
  • quora object resource count reached, pod X goes to the Pending state
  • resources are released (other pod Y removed), our X pod starts creating

For, now this scenario will not work, due to the quota behavior which returns 403 FORBIDDEN, when there are no free resources in quota:

If creating or updating a resource violates a quota constraint, the request will fail with HTTP status code 403 FORBIDDEN with a message explaining the constraint that would have been violated.

Question: Is there a way to achieve this via native Kubernetes mechanisms?

I was trying to execute pods over Kubernetes Jobs, but each job starts independently and I'm unable to control the execution order. I would like to execute them in First In First Out method.

4
  • so, you have 10 pending pods because you reached the limit. You delete one pod, so you have room for one pod, and you want the first pod to get on the queue (and get on the pending state) to be the one scheduled?
    – suren
    Commented Apr 28, 2019 at 10:04
  • Exactly like that.
    – brxie
    Commented Apr 28, 2019 at 10:09
  • have you checked pod priorities and scope selectors?
    – suren
    Commented Apr 28, 2019 at 15:12
  • Finally, I decided to use application logic to limit pods quantity running in the time.
    – brxie
    Commented May 18, 2019 at 12:59

2 Answers 2

2

IMO, if k8s hasn't accepted the resource, how come it manage its lifecycle or execution order.

If I understood your question correctly, then its the same pod trying to be scheduled then, your job should be designed in such a way that order of job execution should not matter because there could be scenarios where one execution is not completed and next one comes up or previous one failed to due some error or dependent service being unavailable. So, the next execution should be able to start from where the last one left.

You can also look at the work queue pattern in case it suits your requirements as explained https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/

In case you just want one job to be in execution at one time.

0

I think, running jobs in predefined order must be managed by external logic. We use Jenkins Pipeline for that.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.