<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>A <a href="https://cloud.google.com/kubernetes-engine/docs/concepts/service" rel="nofollow noreferrer">service in GKE</a> is a way to expose to the intended final users, those applications running in a set of pods. All these elements form part of a GKE cluster.
If you apply a YAML to crate a service, several additional thins are needed in order to have the applications reachable for your users. One of the features of kubernetes and of GKE is to automatically create, set and mantain the resources required to, in this case for example, create a service. All those extra settings and definitions made by GKE are recorded in a YAML file.</p>
<p>If you can know more about this concept, you can start in the <a href="https://cloud.google.com/kubernetes-engine" rel="nofollow noreferrer">Google Kubernetes Engine product page</a>, or consult in this same page the <a href="https://cloud.google.com/kubernetes-engine/docs" rel="nofollow noreferrer">GKE documentation</a>. Another good point to start is to read this <a href="https://cloud.google.com/kubernetes-engine/docs/concepts/kubernetes-engine-overview" rel="nofollow noreferrer">GKE overview</a>.</p>
