<p>I have a GKE cluster.</p>
<p>I used <code>kubectl apply</code> to apply the following YAML from my local machine:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Service
metadata:
  name: flask-app-svc
  namespace: myapp
spec:
  ports:
  - port: 5000
    targetPort: 5000
  selector:
    component: flask-app
</code></pre>
<p>Got applied. All Good. ✅</p>
<hr />
<p>Then I used <code>kubectl get service</code> to get back the YAML from the cluster. It returned this:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Service
metadata:
  annotations:
    cloud.google.com/neg: '{&quot;ingress&quot;:true}'
    cloud.google.com/neg-status: '{&quot;network_endpoint_groups&quot;:{&quot;5000&quot;:&quot;k8s1-5fe0c3c1-myapp-flask-app-svc-5000-837dba94&quot;},&quot;zones&quot;:[&quot;asia-southeast1-a&quot;]}'
    kubectl.kubernetes.io/last-applied-configuration: |
      {&quot;apiVersion&quot;:&quot;v1&quot;,&quot;kind&quot;:&quot;Service&quot;,&quot;metadata&quot;:{&quot;annotations&quot;:{},&quot;name&quot;:&quot;flask-app-svc&quot;,&quot;namespace&quot;:&quot;myapp&quot;},&quot;spec&quot;:{&quot;ports&quot;:[{&quot;port&quot;:5000,&quot;targetPort&quot;:5000}],&quot;selector&quot;:{&quot;component&quot;:&quot;flask-app&quot;}}}
  creationTimestamp: &quot;2021-10-29T14:40:49Z&quot;
  name: flask-app-svc
  namespace: myapp
  resourceVersion: &quot;242820340&quot;
  uid: ad80f634-5aab-4147-8f71-11ccc44fd867
spec:
  clusterIP: 10.22.52.180
  clusterIPs:
  - 10.22.52.180
  ports:
  - port: 5000
    protocol: TCP
    targetPort: 5000
  selector:
    component: flask-app
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}
</code></pre>
<hr />
<h3>1. What kubernetes &quot;concept&quot; is at play here?</h3>
<h3>2. Why are the 2 YAMLs SO DIFFERENT from each other?</h3>
<h3>3. What is happening under the hood?</h3>
<h3>4. Is this specific to GKE, or would any k8s cluster behave this way?</h3>
<h3>5. Where can I find some info/articles to learn more about this concept?</h3>
<hr />
<p>Thank you in advance.</p>
<p>I've been trying to wrap my head around this for a while. Appreciate any help you can advise and suggest here.</p>

Rakib
<p>The Kubernetes API server validates and configures data for the API objects which include pods, services, replication controllers, and others. The API Server services REST operations and provides the frontend to the cluster's shared state through which all other components interact. The API server takes the definitions provided by the user to create all the detailed definitions needed to create the objects required. In <a href="https://cloud.google.com/kubernetes-engine/docs/reference/rest" rel="nofollow noreferrer">this document</a> you can find an overview of the GKE API server engine.</p>
<p>You can find an <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#create-deployment-v1-apps" rel="nofollow noreferrer">example on this document about a create operation</a>. There you can switch between the request input and the response generated for the API server to create the complete definition of the objects required, its parameters, metadata and all the related configuration parameters that you see in the &quot;extended&quot; version of the original yaml file.
In the same document you can find additional information about this topic.</p>
