<p>I currently have a GKE Kubernetes 1.15 cluster and I'm planning to upgrade to 1.16. Since 1.16 doesn't support certain APIs I have to change my deployments from extensions/v1beta1 to apps/v1.</p>

<p>Using this simple deployment.yml:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80
</code></pre>

<p>When I apply it into my 1.15 cluster: <code>kubectl -n mynamespace deployment.yml</code>, what is actually see is the following (<code>kubectl -n mynamespace get deployments nginx-deployment</code>):</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
    kubectl.kubernetes.io/last-applied-configuration: |
...
</code></pre>

<p>As you can see the actual apiVersion is extensions/v1beta1 instead of apps/v1. Why isn't it applying the version I specified?</p>

<p><strong>UPDATE:</strong></p>

<p>This is my kubectl version:</p>

<pre><code>Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.4", GitCommit:"8d8aa39598534325ad77120c120a22b3a990b5ea", GitTreeState:"clean", BuildDate:"2020-03-12T23:41:24Z", GoVersion:"go1.14", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"15+", GitVersion:"v1.15.9-gke.24", GitCommit:"39e41a8d6b7221b901a95d3af358dea6994b4a40", GitTreeState:"clean", BuildDate:"2020-02-29T01:24:35Z", GoVersion:"go1.12.12b4", Compiler:"gc", Platform:"linux/amd64"}
</code></pre>

<p>The apiVersion returned from <code>kubectl get</code> won't necessarily match up with the actual apiVersion of your current configuration.</p>

<p>See here: <a href="https://github.com/kubernetes/kubernetes/issues/62283#issuecomment-380968868" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/62283#issuecomment-380968868</a></p>

<p>Quote:</p>

<blockquote>
  <p><code>kubectl get</code> uses server-preferred order, which will prefer the <code>extensions</code> API group for backward compatibility, until <code>extensions</code> is removed. That is to say, <code>kubectl get deployment</code> uses extenions/v1beta1 endpoint by default.</p>
  
  <p>To get deployments under <code>apps</code> API group, you can use <code>kubectl get deployment.apps</code>, which returns you <code>apps/v1</code> deployments.</p>
</blockquote>
