We've just received an e-mail from GCP informing us that our clusters are currently using deprecated Beta APIs and that we need to upgrade to the newest API version.
We have 3 clusters running multiple resources in multiple namespaces so it would be a bit painful having to go through all of them detecting which ones are obsolete.
The ones we control such as services, deployments, horizontalpodautoscalers, poddisruptionbudgets etc, those ones are already updated.
But we have many services whose manifest files are automatically generated such as Spinnaker services generated by Halyard, or ElasticSearch generated by Elastic Operator, etc.
Is there any way to filter all resources by the API version, or any way to detect deprecated resources across all namespaces?
In order to view which API are supported by your cluster
# Print out supported API's in the cluster
kubectl api-versions
In order to view deprecated API, you can use this tool.
it's exactly what you asked for, it will print list of resources with the deprecated API's.
https://github.com/doitintl/kube-no-trouble
# sample output from the official docs:
$./kubent
6:25PM INF >>> Kube No Trouble `kubent` <<<
6:25PM INF Initializing collectors and retrieving data
6:25PM INF Retrieved 103 resources from collector name=Cluster
6:25PM INF Retrieved 132 resources from collector name="Helm v2"
6:25PM INF Retrieved 0 resources from collector name="Helm v3"
6:25PM INF Loaded ruleset name=deprecated-1-16.rego
6:25PM INF Loaded ruleset name=deprecated-1-20.rego
_____________________________________________________________________
>>> 1.16 Deprecated APIs <<<
---------------------------------------------------------------------
KIND NAMESPACE NAME API_VERSION
Deployment default nginx-deployment-old apps/v1beta1
Deployment kube-system event-exporter-v0.2.5 apps/v1beta1
Deployment kube-system k8s-snapshots extensions/v1beta1
Deployment kube-system kube-dns extensions/v1beta1
_____________________________________________________________________
>>> 1.20 Deprecated APIs <<<
---------------------------------------------------------------------
KIND NAMESPACE NAME API_VERSION
Ingress default test-ingress extensions/v1beta1
kubent
# install `kubent`
sh -c "$(curl -sSL 'https://git.io/install-kubent')"
kubent
kubent