<p>I am migrating the Kubernetes deployments from API version <code>extensions/v1beta1</code> to <code>apps/v1</code>.</p>
<p>I've changed the API group in deployment to <code>apps/v1</code> and applied the deployment.</p>
<p>However when I check the deployment using <code>get deployment -o yaml</code> it's showing deployment in <code>extensions/v1beta1</code> API group and when I check using <code>get deployment.apps -o yaml</code>, it's showing in <code>app/v1</code> API group.</p>
<p>can you please let us know a way to identify the API group of the created deployment YAML other than displaying the YAMLs using the commands <code>get deployment -o yaml</code> or <code>get deployment.app -o yaml</code> since the output apiVersion is just based on the command we give irrespective of the one with which it was created.</p>
<p>I just need to make sure that my deployment is migrated to <code>apps/v1</code>.</p>

codewarrior
<p>Kubernetes automatically handles API version conversion. This can happen when you upgrade the cluster - or when requesting a resource in a different api version that is supported by your cluster.
The stored objects in etcd are always upgraded to the latest version when edited or during creation.</p>
<p>If you want to bulk upgrade all deployments you could use a command like</p>
<pre><code>kubectl get deployment --all-namespaces -o json | kubectl replace -f -
</code></pre>
<p>The changed api version in your manifests is especially important to future-proof the files, in case you want to create/apply them in a newer cluster that does not support the old api versions.</p>
