Error: UPGRADE FAILED: create: Secret sh.helm.release.v1.prometheus.v42 is invalid: data: Too long: must have at most 1048576 bytes

I was working on prometheus operator helm deployment and tested it locally. Everything seems working correctly. Then I started to init a repo and put this into azure devops pipeline.

However, when I was trying to deploy after defining the pipeline I realise it does not work as expected. It pops the following error.

Error: UPGRADE FAILED: create: Secret sh.helm.release.v1.prometheus.v42 is invalid: data: Too long: must have at most 1048576 bytes

This was actually complaining about the size of the helm. Then I started to troubleshoot. Since everything has been done from the pipeline. I list things out and turned on the debug mode for helm.

And this turns out .git was added into the helm chart and that’s the cause of the issue. I then created a .helmignore file and put .git into the list. And that fixes the problem.

So this could happen when you try to deploy the helm chart from the root directory of your git repo.