nmiculinic
nmiculinic

Reputation: 2474

Managing different environment/image versions in kubernetes

I have a simple, yet irritating issue. I have bunch of deployments, services, etc. written out.

For staging env (I'm using namespaces to separate staging/prod environments), I'm using images with tag :latest.

For prod env I'd like custom :tag. However I'd like avoiding copy/pasting the .yml file and am unsure how to best structure my code in helping achieve this goal.

Upvotes: 1

Views: 171

Answers (2)

Trondh
Trondh

Reputation: 3341

We use a a deploy script with (among other parts) a Jinja2 component, so we can use Jinja2 variables and conditionals in our deploy manifests. The downside is that manifests have to go thru the deploy pipeline to become "valid" Kubernetes manifests, so local deployments to minikube etc isn't currently possible.

Upvotes: 0

Been there once. What I followed into was doing some simple templating, writing my own template wrappers, to finally end up evaluating and completely switching to helm "kubernetes package manager".

I would strongly advise you to take a shortcut and go directly for helm, it can help a lot really, and writing a basic chart for what you have is pretty simple and quick solution. That way you can install your chart (ergo manifests) with something like ie . helm install mychart --set defaulttag=latest or helm install mychart --set defaulttag=dev and copy no manifests around

Upvotes: 1

Related Questions