Fairwinds | Blog

Find Deprecated and Removed APIs in Kubernetes: Intro to Pluto

Written by Andy Suderman | Jul 7, 2022 4:14:41 PM

Resources:

Video Transcript:

Here is a brief overview of our open source tool, Pluto.

Pluto: Find Deprecated and Removed API Versions

Pluto is a utility that helps you find deprecated and removed API versions in your Kubernetes clusters. So Kubernetes over time has to deprecate different versions of things in order for us to be able to move forward and only use the latest versions and not have to support everything over time. So there's a process for doing this by which an API version gets deprecated and eventually gets actually removed from the API. And so Pluto will look at your infrastructure as code or your helm charts, or your installed Helm charts in your cluster and tell you if you have those deprecated versions that are going to be removed eventually so that you can find them and get them fixed.

How Does Pluto Work?

Pluto is a command line tool. You can install it in a few different ways. So we have an ASDF plugin. We can ASDF plug in, add Pluto. Or we can build the binary in Golang and install it. We just made some updates so you can now go install it, if you're familiar with that command. Or you can just go grab the binary off of the GitHub releases page and put it somewhere in your path. So we have the Pluto binary here. And well, the first thing we're going to do is we're going to detect files. So right here in our Pluto repository, we have some test files for testing out Pluto, but you can run this against any flat YAML files that you might have for deploying to Kubernetes. So we're going to detect files. And we're going to get some information here about the name of the object, the kind of the object, the current API version of the object, and then what API version replaces the deprecated version. And we see here whether it was removed and whether it was deprecated.

So we see here, the extensions v1 beta one deployment was deprecated in 1.9 way back when, and it was removed in 1.16. We can see that information by passing another flag to Pluto. It says when it was deprecated, when it was removed, what namespace it's in, if we know what namespace it's in. And so this is the very core of what Pluto is for. Just check your files, make sure something's not going to be deprecated. We see here that also that we have an exit code that is non-zero. So we can plug this into our CI system and fail builds if we have deprecated APIs, and there's a few flags to help tweak that behavior so that you can use it the way you want to use it.

The second thing that Pluto does really well is it takes a look at the helm manifests that live in the release objects inside your cluster. So if you're using Helm and you want to see what in your cluster has been deployed that has a deprecated API version, we can use the detect Helm command. And again, I'm going to look at the wide output here because I think it's a little bit more informative. And we see here, we have a Helm release that has some deprecated versions in it. So there's a pod disruption budget here of policy v1 beta one. That's replaced by policy v1. V1 beta one was deprecated in 1.21, and it's going to be removed in 1.25. So before I upgrade to Kubernetes 1.25, I need to update the API version of this object.

Now you may be asking why do we only look at Helm charts? Well, Kubernetes is awesome in that it translates between API versions. So if I ask Kubernetes to give me a deployment, it's going to tell me whatever API version I look for, regardless of what API version was deployed to the cluster. And so we have to look at something that's a little bit more definitive that explains how the object was deployed to the cluster. So in this case, a Helm release is very definitive about what API version was deployed at the time of deployment into the cluster. So that's why we only use Helm.

All this information is available on our documentation page. So if you go to pluto.docs.fairwinds.com, you can see that we have all this information here and it talks about why we've built Pluto, what it's for, the Kubernetes deprecation policy, and some different usages for Pluto as well. So that's Pluto in a nutshell. Thank you for listening and you all have a great rest of your day and week.