Run Octopus step in Kubernetes pod

As I understand (but haven’t yet tried), it’s possible to run a deploy process step inside a Docker container on a worker.

Is it possible to have a worker deploy a Kubernetes pod and run the deploy script in it?

(I’m thinking of the gitlab-ci analog, where you can use a Kubernetes executor, pick a Docker image for the pod, and a script to run inside the pod.)

I suspect (but haven’t tried) that you can basically do it by having an Octopus worker deploy a pod, and then run kubectl exec on it, but curious if there’s a better/easier way.

(This is what gitlab runners do basically, I think, but with some Go libraries.)

Hi @cjacobsen
Thanks for reaching out to our Support team.

While it would be possible to script this scenario using kubectl commands etc, have you considered using Execution Containers? The gist of it is that your deploy steps are executed within a Docker container on the worker.

Here is a good blog post explaining the ins and outs of this feature:

If this doesn’t suit your purposes we can ask our Solutions team to suggest some advice on how best to achieve your goal.

Let us know how you get on.

Kind Regards,

Thanks Paraic :slight_smile:

Yeah, I see the option to deploy to a worker, and run the step within a Docker container on the worker.

The worker I’m using is a Windows-based one, and doesn’t have Docker installed. And I’m wondering if I can avoid that, and just have it use the Kubernetes cluster instead. (This is even more crucial if the worker is itself running in Kubernetes, since the worker can’t - easily - do “docker in docker”.)


Hi Charlie,
We will have our Solutions team take a look at this one. I have moved your query into the Advice folder and one of the guys will pick it up and go through this with you.

Hopefully we can get a good alternative method for you.

Kind Regards,

Hi Charlie,
One of my colleagues pointed me to a good ebook resource Octopus have created for Kubernetes deployments.

There are quite a few sample deployment scenarios in the book and you should be able to get your particular scenario sorted with one of them.

Let me know if you need more help on this.

Kind Regards,

Thanks Paraic, that book is very useful, I will study it.

It looks like it recommends either a Docker-in-Docker approach, or creating custom images that combine Tentacle with the other applications/libraries you need. (In both cases, Tentacle is deployed to the Kubernetes cluster.)

I was hoping to avoid both of those approaches (gitlab-ci avoids both, fwiw), as they both have drawbacks.

Anyway, I have plenty of options for now to get what I need to done :slight_smile:

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.