<p>I am seeing many more labels with the command "docker inspect" than the kubernetes labels shown in "kubectl describe" or "kubectl get pods --show-labels". Is it possible to see all of the same docker labels using a kubectl command, or is this not possible as the docker labels are not related to the pod labels within kubernetes?</p>

mmiara
<p>Both labels consist of key-value pairs only.</p>
<p>In Kubernetes labels are attached to objects, such as pods. Labels are intended to be used to specify identifying attributes of objects that are meaningful and relevant to users, but do not directly imply semantics to the core system. Labels can be used to organize and to select subsets of objects. So for example, if you label a deployment with rules that schedules the pod on a specific node, it is possible using that. Or say for example if a pod can have ingress traffic from one specific service having label XYZ, it is done using labels. There are so many ways you can make use of it.</p>
<p>On the other hand, Docker offers support to add labels into images as a way to add custom metadata. So in Dockerfile you mention it as:</p>
<pre><code>LABEL &lt;key&gt;=&lt;value&gt; &lt;key&gt;=&lt;value&gt; &lt;key&gt;=&lt;value&gt;
</code></pre>
<p>It will store data as:</p>
<pre><code>LABEL multi.label1=&quot;value1&quot; \
      multi.label2=&quot;value2&quot; \
      other=&quot;value3&quot;
</code></pre>
<p>You can inspect it as:</p>
<pre><code>docker inspect \
       --format &quot;{{ index .Config.Labels \&quot;multi.label2\&quot;}}&quot;
       &lt;your image&gt;
</code></pre>
<p>As per docker documentation guidelines are : <a href="https://docs.docker.com/config/labels-custom-metadata/" rel="nofollow noreferrer">https://docs.docker.com/config/labels-custom-metadata/</a></p>
<p>The link <a href="http://label-schema.org/rc1/" rel="nofollow noreferrer">http://label-schema.org/rc1/</a> is useful too about labeling. Build time labels are well defined here:</p>
<p><a href="http://label-schema.org/rc1/#build-time-labels" rel="nofollow noreferrer">http://label-schema.org/rc1/#build-time-labels</a></p>
<p>Accessing docker's label is not feasible I think, as it is not exposed via Kubernetes API.</p>
