Kubernetes deployments from yml manifests

Hi,

I was wondering if there is to deploy a way to provide manifests files to kubernetes deployment step without specifing a lot of details in a UI. Main disadvantage of using UI is it is hard to version and introduce changes, so we’d like to host as much as possible in project git repo (deployment, service, ingress and other resources).

At the moment we are doing a lot of things manually as kubectl script.

/Evgeny

Hi @evgenyl

Thanks for getting in touch!

What I would recommend for this scenario is packaging your manifests file so that you can reference it in Octopus, then call that script via the Run a kubectl CLI Script or Kubernetes Raw YAML steps.

The advantage of the Run a kubectl CLI Script is you can reference the container images on the step, and use them in the k8s template by variable-substitution using package variables: https://octopus.com/docs/deployment-examples/custom-scripts/run-a-script-step#accessing-package-references-from-a-custom-script

I hope that helps, let me know if you have any further questions,

Regards
Alex

Thanks for the reply.

That is what we are basically doing at this moment.
We are running variable substitution on manifests and then running kubectl apply on manifests.

However, to my understanding, this approach makes it harder to do:

  • Rollbacks (you have to keep track what should be deleted and what should be kept)
  • Monitor deployment status (manually calling kubectl rollout status)
  • Blue/green deployments, without scripting them manually (and it’s tedious)

All of this things are possible to script, however I’d really like to get help from deployment tool instead of scripting it manually :slight_smile:

/Evgeny

Hi Evgeny,

I understand what you mean, unfortunately that’s the trade-off at the moment.

We would be happy to supply you with the script that the Deploy Kubernetes Containers step uses to perform the deployment, if you’d like? You wouldn’t be able to use it directly, but it could be nice as a reference.

Hi Michael,

That would be great!
Thanks for all your hard work :slight_smile:

Kind regards,
Evgeny

No problem! I sent a link to the scripts to the email associated with your profile.
Let me know if you don’t receive them.

Thanks, I received them.

Thanks so much for your help!