In a k8s cluster, how creating dynamics pod (autoscaling) for each gilab job?

Hello,

We have a private kubernetes connected to gitlab with our gitlab agent. Each job use a tag to run it into a specific container in a available pod. For exemple the job 1 running in the container “container_1” and the job 2 running in the container"container_2". All works fin. But sometimes, some specific pod are not used and some job are pending because the other specific pod are used. For exemple, if i’ve 10 pod “container_1” and '10 pod container_2". If i launch a pipeline who use 20 “container_1”, 10 job are running in “container_1” and 10 job are pending but 10 “container_2” are free and the pod are not used. So, i would to use some autoscaling pod. So, when a pipeline running, i would kubernetes create a pod for each jobs and kill them when the job is finished. For exemple, if a pipeline use 20 “container_1”, i want kubernetes create 20 “container_1” and 0 “conatiner_2”. When a job is finished, the pod must be deleted to release resources. I know it’s possible but i don’t find documentation about this. In the gitlab documentation it’s indicated to use docker-machine but is deprecied. I think i have use executor-docker. In our kubernetes cluster, i can create a deployment who create a pod contain gilab-runner and register it with the executor “Kubernetes”. But i don’t know how configure them to autoscaling any pod. I think in gitlab-ci.yaml i have to set the tag “container_1” but the “container_1” doesn’t exist in the cluster. He have to be generated by kubernetes (if the’re enough resources), and after the job will be executed.

Has anyone managed to set up this configuration ?

Tanks a lot :wink:

I think the executor “docker+machine” is the solution, but i couln’t use them with a personnal cluster. I have to set the argument “MachineDriver” like “google” (Docker Machine Executor autoscale configuration | GitLab). And with the executor “kubernetes” and couldn’t generate pod dynamically (autoscaling depending of the type of gitlab job)