Scale down kubernetes job but dont delete pods until complete

8/6/2018

Is it possible To scale down a kubernetes jobs parallelism value but leave any running jobs up until they have run to completion.

I have a specific scenario where I am running vsts build agents in containers and need to design the solution in such a way that there is always one agent available at all times. Scaling up is easy as this can just be done at the start of every build however because I need to clean up the agent before the pod finishes I cant scale down in the same way at the end of the build. If there were a way to set the target parallelism but not delete any pods until one completed this would be perfect but any other way for me to achieve this or pointers on where to look would be great.

-- David Parsonson
azure-devops
azure-pipelines
azure-pipelines-release-pipeline
kubernetes

1 Answer

8/9/2018

I guess your goal is not to be accomplished out of Kubernetes box because in Parallel Jobs implementation it is feasible to have a Pod after completion available. Usually to specify Job scenario we use conditions like .spec.completions or .spec.parallelism but they are only tracked for completion of Pods and execution in parallel.

Take a look at this Article and GitHub Project for the deployment of VSTS agents using Helm on Kubernetes cluster.

-- mk_sta
Source: StackOverflow