<p>I have this very basic YAML file which i tried to migrate from kubectl v1.14 to v1.16. I changed <code>extensions/v1beta1</code> to <code>apps/v1</code> and I added selectors as well since they were mandatory in v1.16.</p>
<p>My original YAML file which worked fine in v1.14:</p>
<p>I modified the files for v1.16. My YAML files now look like this:</p>
<p>But on running this I get the following error</p>
<pre><code>error: error validating &quot;/root/config/cpx.yaml&quot;: 
error validating data: [ValidationError(Deployment.spec.template): 
unknown field &quot;selector&quot; in io.k8s.api.core.v1.PodTemplateSpec, ValidationError(Deployment.spec): 
missing required field &quot;selector&quot; in io.k8s.api.apps.v1.DeploymentSpec]; 
if you choose to ignore these errors, 
turn validation off with --validate=false
</code></pre>
<p>What could be causing this issue? I followed all the steps in the kubectl depreciation manual ? It should ideally work in v1.16 as well.</p>

Daniel Isaac
<p>Moving from <code>extensions/v1beta1</code> to <code>apps/v1</code> also requires informing the <code>selector</code> field, this is no longer inferred from the pod template.</p>

<ul>
<li><p>Notice the optional at the <code>extenstions/v1beta1</code> type: <a href="https://github.com/kubernetes/api/blob/5524a3672fbb1d8e9528811576c859dbedffeed7/extensions/v1beta1/types.go#L107-L110" rel="nofollow noreferrer">https://github.com/kubernetes/api/blob/5524a3672fbb1d8e9528811576c859dbedffeed7/extensions/v1beta1/types.go#L107-L110</a></p></li>
<li><p>See that same block at the new <code>apps/v1</code> type: <a href="https://github.com/kubernetes/api/blob/5524a3672fbb1d8e9528811576c859dbedffeed7/apps/v1/types.go#L276-L279" rel="nofollow noreferrer">https://github.com/kubernetes/api/blob/5524a3672fbb1d8e9528811576c859dbedffeed7/apps/v1/types.go#L276-L279</a></p></li>
</ul>

<p>Add a selector that matches your Pod template's label and you should be good.</p>
