Helm Charts upgrade script

In my homelab I’m running small Kubernetes cluster using k3s and install applications on it using Helm Charts. I don’t use gitops and for now I’m using Rancher to mostly navigate through all different types of Kubernetes objects. For a lot of Charts I’m using TrueCharts that contains ~800 different Charts and they’re using common libraries, templates and enjoy using it a lot. Because of that Charts are updated not only when docker image of application is being updated but also when common library is updated it could update a lot of Charts, so I get a lot of Helm Charts upgrades.

Upgrading every Helm Chart manually inside Rancher is fine when you need to update few of them every month. But with number of installed Helm Charts multiplied by frequency they’re updated it wasn’t feasible for me to do it that way. So I’ve built simple script that:

  • Iterates through helm ls, skips some exclusions (e.g. for rancher helm I run it manually because I update it together with k3s version)
  • checks if new Chart version is present
  • checks rollout status and ingress HTTP codes (to not upgrade application that’s not in healthy state)
  • ask if upgrade should be made (until --yes is not used)
  • check rollout status and ingress HTTP codes after upgrade (to know if maybe new Chart version broke something)

I’m not running it with --yes but still confirm every upgrade, at least for now. It saved me a lot of time and nerves. (;

You can check it’s code on GitHub.

Computer Science and MBA graduate, responsible for managing IT teams for the last 10 years. Has experience working for different-size companies ranging from small start-ups to corporation that deal with different IT businesses (firmware, device drivers, mobile, eCommerce, social media, big data, financial markets). In the past involved in organising Tricity Java User Group and Polish edition of Washington Business Week. Interested in behavioural economics and psychology.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.