Skip to content

When helm says "no" (failed to delete release)

My beloved "Penguin Patrol" bot, which I use to give GitHub / Patreon / Ko-Fi supporters access to the premix repo, was deployed on a Kube 1.19 Digital Ocean cluster, 3 years ago. At the time, the Ingress API was at v1beta1.

Fast-forward to today, and several Kubernetes major version upgrades later (it's on 1.23 currently, and we're on Ingress v1), and I discovered that I was unable to upgrade the chart, since helm complained that the previous release referred to deprecated APIs.

Worse, helm wouldn't let me delete and re-install the release - because of those damned deprecated APIs!

Here's how I fixed it...

Use the helm mapkubeapis plugin

I stumbled across this helpful comment, which gave me the solution.

I installed the mapkubeapis helm plugin using helm plugin install https://github.com/helm/helm-mapkubeapis

~❯ helm plugin install https://github.com/helm/helm-mapkubeapis                                                 
Downloading and installing helm-mapkubeapis v0.3.2 ...
https://github.com/helm/helm-mapkubeapis/releases/download/v0.3.2/helm-mapkubeapis_0.3.2_darwin_amd64.tar.gz
Installed plugin: mapkubeapis
~❯

Then I ran mapkubeapis against my crusty ol' helm release:

~❯ helm mapkubeapis -n penguinpatrol penguinpatrol                                                          
2023/03/03 10:45:13 Release 'penguinpatrol' will be checked for deprecated or removed Kubernetes APIs and will be updated if necessary to supported API versions.
2023/03/03 10:45:13 Get release 'penguinpatrol' latest version.
2023/03/03 10:45:15 Check release 'penguinpatrol' for deprecated or removed APIs...
2023/03/03 10:45:16 Found 1 instances of deprecated or removed Kubernetes API:
"apiVersion: networking.k8s.io/v1beta1
kind: Ingress
"
Supported API equivalent:
"apiVersion: networking.k8s.io/v1
kind: Ingress
"
2023/03/03 10:45:16 Finished checking release 'penguinpatrol' for deprecated or removed APIs.
2023/03/03 10:45:16 Deprecated or removed APIs exist, updating release: penguinpatrol.
2023/03/03 10:45:16 Set status of release version 'penguinpatrol.v39' to 'superseded'.
2023/03/03 10:45:16 Release version 'penguinpatrol.v39' updated successfully.
2023/03/03 10:45:16 Add release version 'penguinpatrol.v40' with updated supported APIs.
2023/03/03 10:45:16 Release version 'penguinpatrol.v40' added successfully.
2023/03/03 10:45:16 Release 'penguinpatrol' with deprecated or removed APIs updated successfully to new version.
2023/03/03 10:45:16 Map of release 'penguinpatrol' deprecated or removed APIs to supported versions, completed successfully.
~❯

And I was finally able to delete the "stuck" release, with a helm delete1!

Summary

What did I learn?

  1. Upgrade your deprecated APIs before upgrading your Kubernetes major versions
  2. helm ls -a can help identify stuck releases which wouldn't normally appear with a simple helm ls

Chef's notes 📓


  1. And now the misbehaving chart can be re-installed, since there's no invalid previous version to worry about! 

Tip your waiter (sponsor) 👏

Did you receive excellent service? Want to compliment the chef? (..and support development of current and future recipes!) Sponsor me on Github / Ko-Fi / Patreon, or see the contribute page for more (free or paid) ways to say thank you! 👏

Employ your chef (engage) 🤝

Is this too much of a geeky PITA? Do you just want results, stat? I do this for a living - I'm a full-time Kubernetes contractor, providing consulting and engineering expertise to businesses needing short-term, short-notice support in the cloud-native space, including AWS/Azure/GKE, Kubernetes, CI/CD and automation.

Learn more about working with me here.

Flirt with waiter (subscribe) 💌

Want to be alerted to new posts / recipes? Subscribe to the RSS feed, or leave your email address below, and we'll keep you updated.

Your comments? 💬