1
votes

So, what I'm trying to do is use helm to install an application to my kubernetes cluster. Let's say the image tag is 1.0.0 in the chart.

Then, as part of a CI/CD build pipeline, I'd like to update the image tag using kubectl, i.e. kubectl set image deployment/myapp...

The problem is if I subsequently make any change to the helm chart (e.g. number of replicas), and I helm upgrade myapp this will revert the image tag back to 1.0.0.

I've tried passing in the --reuse-values flag to the helm upgrade command but that hasn't helped.

Anyone have any ideas? Do I need to use helm to update the image tag? I'm trying to avoid this, as the chart is not available at this stage in the pipeline.

1
I don't think you need to use the helm to update the image tag, what you need is to sync the image tag to helm chart after you update the image tag through CI/CD.Kun Li
I should point out I'm using helm3Darragh
Just to clarify, you want to just upgrade the tag name, not whole image? Also are you trying to do it locally or On-Prem?PjoterS
Well, when using kubectl set image, i'm updating the whole image. but all I'm actually changing is the image tag. does local vs on-prem make any difference?Darragh

1 Answers

1
votes

When using CI/CD to build and deploy, you should use a single source-of-truth, that means a file versioned in e.g. Git and you do all changes in that file. So if you use Helm charts, they should be stored in e.g. Git and all changes (e.g. new image) should be done in your Git repository.

You could have a build pipeline that in the end commit the new image to a Kubernetes config repository. Then a deployment pipeline is triggered that use Helm or Kustomize to apply your changes and possibly execute tests.