<p>I am trying to deploy an image in k3s but I am getting an error like this. I have made sure that there is no syntax error. I have also added match labels in my spec, but don't know what causing the issue</p>
<pre><code>spec.selector: Required value
spec.template.metadata.labels: Invalid value: map[string]string{...} selector does not match template labels 
</code></pre>
<p>This is my yaml file</p>
<pre><code>--- 
apiVersion: apps/v1
kind: Deployment
metadata: 
  labels: 
    app: darwin_tritron_server
  name: darwin_tritron_server
  spec: 
    replicas: 3
    selector: 
      matchLabels: 
        app: darwin_tritron_server
    template: 
      metadata: 
        labels: 
          app: darwin_tritron_server
      spec: 
        containers: 
          - 
            args: 
              - &quot;cd /models /opt/tritonserver/bin/tritonserver --model-repository=/models --allow-gpu-metrics=false --strict-model-config=false&quot;
            command: 
              - /bin/sh
              - &quot;-c&quot;
            image: &quot;nvcr.io/nvidia/tritonserver:20.12-py3&quot;
            name: flower
            ports: 
              - 
                containerPort: 8000
                name: http-triton
              - 
                containerPort: 8001
                name: grpc-triton
              - 
                containerPort: 8002
                name: metrics-triton
            resources: 
              limits: 
                nvidia.com/mig-1g.5gb: 1
            volumeMounts: 
              - 
                mountPath: /models
                name: models
        volumes: 
          - 
            name: models
            nfs: 
              path: &lt;path/to/flowerdemo/model/files&gt;
              readOnly: false
              server: &quot;&lt;IP address of the server&gt;&quot;
</code></pre>
<p>Any help would be appreciated</p>

Siddharth
<p>Wrong yaml indent in your spec, try:</p>
<pre><code>--- 
apiVersion: apps/v1
kind: Deployment
metadata: 
  labels: 
    app: darwin_tritron_server
  name: darwin_tritron_server
spec: 
  replicas: 3
  selector: 
    matchLabels: 
      app: darwin_tritron_server
  template: 
    metadata: 
      labels: 
        app: darwin_tritron_server
    spec: 
      containers: 
      - args: 
        - &quot;cd /models /opt/tritonserver/bin/tritonserver --model-repository=/models --allow-gpu-metrics=false --strict-model-config=false&quot;
        command: 
        - /bin/sh
        - &quot;-c&quot;
        image: &quot;nvcr.io/nvidia/tritonserver:20.12-py3&quot;
        name: flower
        ports: 
        - containerPort: 8000
          name: http-triton
        - containerPort: 8001
          name: grpc-triton
        - containerPort: 8002
          name: metrics-triton
        resources: 
          limits: 
            nvidia.com/mig-1g.5gb: 1
        volumeMounts: 
        - mountPath: /models
          name: models
      volumes: 
      - name: models
        nfs: 
          path: &lt;path/to/flowerdemo/model/files&gt;
          readOnly: false
          server: &quot;&lt;IP address of the server&gt;&quot;
</code></pre>
