<p>I am trying to understand the difference between pods and annotations.</p>
<p>Standard documentation says that annotations captures &quot;non-identifying information&quot;.
While on labels, selectors can be applied. Labels are used to organise objects in kubernetes cluster.</p>
<p>If this is the case then why istio use pod annotations instead of labels for various different settings : <a href="https://istio.io/latest/docs/reference/config/annotations/" rel="nofollow noreferrer">https://istio.io/latest/docs/reference/config/annotations/</a></p>
<p>Isn't label is good approach ?</p>
<p>Just trying to understand what advantages does annotations provide, if istio developers chose to use annotations.</p>

<p>As Extending the Burak answer,</p>
<blockquote>
<p>Kubernetes labels and annotations are both ways of adding metadata to
Kubernetes objects. The similarities end there, however. Kubernetes
labels allow you to identify, select and operate on Kubernetes
objects. Annotations are non-identifying metadata and do none of these
things.</p>
</blockquote>
<p>Labels are mostly used to attach with the resources like POD, Replica set, etc. it also get used to route the traffic and routing deployment to service and other.</p>
<p>Labels are getting stored in the ETCD database so you can search using it.</p>
<p>Annotation is mostly to store metadata and config-if any.</p>
<p>Metadata like : owner details, last helm release if using helm, side car injection</p>
<p>You can store owner details in labels, K8s use <strong>labels</strong> for traffic routing from <strong>service to deployment</strong> and labels should be the <strong>same</strong> on both resources (deployment &amp; service) to route traffic.</p>
<p>What will you do in that case to match labels for resources? Use service owner name same inside all deployment &amp; service? when you are running multiple distributed services managed by diff team and service owners.</p>
<p>If you notice some of annotation of istio is just for storing metadata like : <code>install.operator.istio.io/chart-owner</code>, <code>install.operator.istio.io/owner-generation</code></p>
<p>Read more at : <a href="https://istio.io/latest/docs/reference/config/annotations/" rel="nofollow noreferrer">https://istio.io/latest/docs/reference/config/annotations/</a></p>
<p>You should also check once syntax of both <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set" rel="nofollow noreferrer">label</a> and <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/#syntax-and-character-set" rel="nofollow noreferrer">annotation</a>.</p>
