<p>I'm running a K8s cluster on rasberry pi(Ubuntu 20.04) . When I try to deploy the following K8s deployment, the labels 'rel' and 'env' weren't created on pods.</p>
<p>K8s Versions:</p>
<pre><code>Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;14&quot;, GitVersion:&quot;v1.14.7&quot;, GitCommit:&quot;8fca2ec50a6133511b771a11559e24191b1aa2b4&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2019-09-18T14:47:22Z&quot;, GoVersion:&quot;go1.12.9&quot;, Compiler:&quot;gc&quot;, Platform:&quot;windows/a
md64&quot;}  
                                                                                                                                                                                                                                        
Server Version: version.Info{Major:&quot;1&quot;, Minor:&quot;18&quot;, GitVersion:&quot;v1.18.6&quot;, GitCommit:&quot;dff82dc0de47299ab66c83c626e08b245ab19037&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2020-07-15T16:51:04Z&quot;, GoVersion:&quot;go1.13.9&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/arm&quot;}   

                                                                                                                                                                                                                                       
</code></pre>
<p>-- Deployment yaml (kubectl apply -f .)</p>
<pre><code>apiVersion: apps/v1 
kind: Deployment
metadata:
  name: product-catalog-deployment
  namespace: default
  labels: 
   app: product-catalog
   rel: beta
   env: prod
spec:
  selector:
    matchLabels:
      app: product-catalog
  replicas: 3
  template:
    metadata:
      labels:
        app: product-catalog
    spec:
      containers:
      - name: product-catalog
        image: marveltracker/netcore_fun:netcore_3_1
        ports:
        - containerPort: 80
          name: http
        - containerPort: 443
          name: https
      
</code></pre>
<p>---get prods (kubectl get po --show-labels)</p>
<pre><code>NAME                                          READY   STATUS    RESTARTS   AGE   LABELS
product-catalog-deployment-65c7bcbf48-8nxbw   1/1     Running   0          16s   app=product-catalog,pod-template-hash=65c7bcbf48
product-catalog-deployment-65c7bcbf48-f764h   1/1     Running   0          16s   app=product-catalog,pod-template-hash=65c7bcbf48
product-catalog-deployment-65c7bcbf48-pcz4q   1/1     Running   0          16s   app=product-catalog,pod-template-hash=65c7bcbf48
</code></pre>
<p>What was the issue here ?</p>

marvelTracker
<p>Your Yaml file should be like this</p>
<pre><code>apiVersion: apps/v1 
kind: Deployment
metadata:
  name: product-catalog-deployment
  namespace: default
  labels: 
    app: product-catalog
    rel: beta
    env: prod
spec:
  replicas: 3
  selector:
    matchLabels:
      app: product-catalog
      rel: beta               #----These all should same 
      env: prod
  template:
    metadata:
      labels:
        app: product-catalog  
        rel: beta             #----Same like above
        env: prod
    spec:
      containers:
      - name: product-catalog
        image: marveltracker/netcore_fun:netcore_3_1
        ports:
        - containerPort: 80
          name: http
        - containerPort: 443
          name: https
  
</code></pre>
<p>This is because deployment manages replicasets in the background and you apply the label on replica sets pods. and replicaset add label to pods and manages those pod (means the number of pod availability)</p>
