<p>Is there some tool available that could tell me whether a K8s YAML configuration (to-be-supplied to <code>kubectl apply</code>) is valid for the target Kubernetes version without requiring a connection to a Kubernetes cluster?</p>

<p>One concrete use-case here would be to detect incompatibilities before actual deployment to a cluster, just because some already-deprecated label has been finally dropped in a newer Kubernetes version, e.g. as has happened for Helm and the switch to Kubernetes 1.16 (see <a href="https://github.com/helm/helm/issues/6374" rel="nofollow noreferrer">Helm init fails on Kubernetes 1.16.0</a>):</p>

<p>Dropped:</p>

<pre><code>apiVersion: extensions/v1beta1
</code></pre>

<p>New:</p>

<pre><code>apiVersion: apps/v1
</code></pre>

<p>I want to check these kind of incompatibilities within a CI system, so that I can reject it before even attempting to deploy it.</p>

<p>just run below command to validate the syntax</p>

<pre><code>kubectl create -f &lt;yaml-file&gt; --dry-run
</code></pre>

<p>In fact the dry-run option  is to validate the YAML syntax  and the object schema. You can grab the output into a variable and if there is no error then rerun the command without dry-run </p>
