Kubernetes Job handling

Its mostly a feature request.

Can we get a template to have octopus deploy and clean up a job?

I’d like to have a runbook template to run jobs and have octopus clean up the deployments after success. But at the moment it looks like octopus’ advice is a kubectl template and some scripting?

I’d like it if Jobs were treated as first class k8’s objects.


Hi @joseph.greene, thanks for reaching out.

I’d just like to confirm your use case. It sounds like you are creating CronJob resources and you want to limit the number of resources that are left in Kubernetes, is that correct?

If that is the case, does the Deploy raw Kubernetes YAML step deploying a CronJob resource with the job history limits (https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/#jobs-history-limits) defined provide the functionality you need? That would avoid any custom scripting against kubectl.


Matt C

I’d like a step that will create a job, run it if successful, and remove the job and container from the cluster.

If possible i’d also like to have a fail command to run on job failure. or be able to trigger a runbook on job failure

Hi @joseph.greene,

Thanks for that additional information - watching for the success or failure of a CronJob is definitely an interesting use case.

First class Kubernetes steps like the one you have described are not on our immediate roadmap, so today this process requires custom scripting against kubectl. However, feedback like this is valuable, and we’ll take this use case into consideration.

If we make changes to the Kubernetes steps in future would be open to us contacting you for early access testing and feedback?

Matt C

Yes please!

That’s great, thanks @joseph.greene. I’ll add you to the feedback list for any future work on the Kubernetes steps.

Matt C