Home > Blockchain >  Error in label and spec in my k3s yaml file
Error in label and spec in my k3s yaml file

Time:06-22

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

spec.selector: Required value
spec.template.metadata.labels: Invalid value: map[string]string{...} selector does not match template labels 

This is my yaml file

--- 
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: 
              - "cd /models /opt/tritonserver/bin/tritonserver --model-repository=/models --allow-gpu-metrics=false --strict-model-config=false"
            command: 
              - /bin/sh
              - "-c"
            image: "nvcr.io/nvidia/tritonserver:20.12-py3"
            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: <path/to/flowerdemo/model/files>
              readOnly: false
              server: "<IP address of the server>"

Any help would be appreciated

CodePudding user response:

Wrong yaml indent in your spec, try:

--- 
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: 
        - "cd /models /opt/tritonserver/bin/tritonserver --model-repository=/models --allow-gpu-metrics=false --strict-model-config=false"
        command: 
        - /bin/sh
        - "-c"
        image: "nvcr.io/nvidia/tritonserver:20.12-py3"
        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: <path/to/flowerdemo/model/files>
          readOnly: false
          server: "<IP address of the server>"
  • Related