79151957

Date: 2024-11-03 02:46:13
Score: 0.5
Natty:
Report link

I can think of two methods that maybe used to meet your requirement.

  1. Develop a scheduler plugin for this kind of job, and inject the node affinity based on the index of pod and node, to match with each other, for example, exec-job-0 will have int(0/4), so it'll be placed to exec-node-<0%4>, so it'll exec-node-0, exec-job-5 will have int(5/4), and it'll be placed to exec-node-1. If the node name is not predictable, maybe you should implement the mapping in the scheduler.

  2. Use podAffinity and podAntiAffinity, for exec-job-0/4/8, let's call it lead pod on each node, inject a special label to these pods and let them schedule to different nodes using podAntiAffinity. The for the follwing pod, use podAffinity to schedule to the same node as its lead pod. For example, lead pod exec-job-0 on node-0 have label: job-head-pod(for podAntiAffinity) and job-group-0(for podAffinity), then for all head pod will be scheduled to different node due to job-head-pod label, and exec-job-1 will use podAffinity job-group-0 and scheduled to node-0.

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Lei