Reputation: 627
Is there a easy way to list all kubernetes objects related to an API version?
Lets say, API version apps/v1beta1
is getting deprecated and I want to know if I have any objects in my cluster using this version, how can I find such objects?
Upvotes: 7
Views: 14955
Reputation: 627
The reason I asked this question was that I was upgrading my kubernetes cluster from v1.15 to v1.16 and this brings a lot of breaking changes
The kubepug tool allowed me to easily find a list of resources that I need to change to be able to upgrade seamlessly from 1.15 to 1.16
Edit: Another alternative is pluto command line tool to get information about resources which might have deprecated or removed API versions. This is helpful specially if you use helm extensively since pluto can look at helm state.
Upvotes: 4
Reputation: 1700
To list Kubernetes resource versions use this command:
kubectl api-resources
And if the you know what resource you are searching for then just filter it from the list using grep:
kubectl api-resources | grep the_resource_name_you_want
In the below example we search for the api version of 'persistentvolumes' resource:
kubectl api-resources | grep persistentvolumes
Result:
deployments deploy apps/v1 true Deployment
There are additional options to get the resource version:
Use the official documentation:
The official and updated with the newest versions is in the Kubernetes API documentation
The left navigation bar lists the resources, click on one & the version is the first row of the page.
Upvotes: 2
Reputation: 30083
you can do something similar like this
kubectl get pod -o=custom-columns=NAME:.metadata.name,API-version:.metadata.owner_references[].api_version
by using kubectl just print respective data and api version
Upvotes: 4