Welcome to the Linux Foundation Forum!

Chapter 3 - kubectl to create the local docker registry. - Lab 3.2

strongman1708strongman1708 Posts: 6
edited July 21 in LFD259 Class Forum

I am getting this error when I try to run kubectl create -f localregistry.yaml

Error from server (Invalid): Deployment.apps "nginx" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"io.kompose.service":"nginx"}: selector does not match template labels

Comments

  • chrispokornichrispokorni Posts: 549

    Hi @strongman1708,

    When editing localregistry.yaml, scroll down to the nginx Deployment, and ensure that the Deployment's spec.selector.matchLabels "io.kompose.service:nginx" key:value pair matches the Deployment's spec.template.metadata.labels "io.kompose.service:nginx" key:value pair.

    ...
      spec:
        replicas: 1
        selector:
          matchLabels:
            io.kompose.service: nginx
        strategy:
          type: Recreate
        template:
          metadata:
            creationTimestamp: null
            labels:
              io.kompose.service: nginx
          spec:
            containers:
    ...
    

    Comparing localregistry.yaml with edited-localregistry.yaml from the Solutions tarball may also help to locate the properties which do not match.

    Regards,
    -Chris

  • Hi Chris, Thank you.

Sign In or Register to comment.