<p>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.</p>
<p>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.</p>
<p>The ones we control such as services, deployments, horizontalpodautoscalers, poddisruptionbudgets etc, those ones are already updated.</p>
<p>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.</p>
<p>Is there any way to filter all resources by the API version, or any way to detect deprecated resources across all namespaces?</p>

<p>In order to view which API are supported by your cluster</p>
<pre><code># Print out supported API's in the cluster
kubectl api-versions
</code></pre>
<p>In order to view deprecated API, you can use this tool.<br />
it's exactly what you asked for, it will print list of resources with the deprecated API's.</p>
<p><a href="https://github.com/doitintl/kube-no-trouble" rel="noreferrer">https://github.com/doitintl/kube-no-trouble</a></p>
<pre class="lang-sh prettyprint-override"><code># sample output from the official docs:


$./kubent
6:25PM INF &gt;&gt;&gt; Kube No Trouble `kubent` &lt;&lt;&lt;
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=&quot;Helm v2&quot;
6:25PM INF Retrieved 0 resources from collector name=&quot;Helm v3&quot;
6:25PM INF Loaded ruleset name=deprecated-1-16.rego
6:25PM INF Loaded ruleset name=deprecated-1-20.rego
_____________________________________________________________________
&gt;&gt;&gt; 1.16 Deprecated APIs &lt;&lt;&lt;
---------------------------------------------------------------------
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
_____________________________________________________________________
&gt;&gt;&gt; 1.20 Deprecated APIs &lt;&lt;&lt;
---------------------------------------------------------------------
KIND      NAMESPACE   NAME           API_VERSION
Ingress   default     test-ingress   extensions/v1beta1
</code></pre>
<hr />
<h3>Installing <code>kubent</code></h3>
<pre><code># install `kubent`
sh -c &quot;$(curl -sSL 'https://git.io/install-kubent')&quot;
</code></pre>
<h3>Running <code>kubent</code></h3>
<pre><code>kubent
</code></pre>
<hr />
<p><a href="https://i.stack.imgur.com/NTZc4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/NTZc4.png" alt="enter image description here" /></a></p>
<hr />
<h3>Additional Similar tools:</h3>
<ul>
<li><a href="https://github.com/FairwindsOps/pluto" rel="noreferrer">https://github.com/FairwindsOps/pluto</a></li>
<li><a href="https://github.com/derailed/popeye" rel="noreferrer">https://github.com/derailed/popeye</a></li>
</ul>
