Welcome to the Linux Foundation Forum!

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

Options
strongman1708
strongman1708 Posts: 6
edited July 2020 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

  • chrispokorni
    chrispokorni Posts: 2,177
    Options

    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

  • strongman1708
    Options

    Hi Chris, Thank you.

Categories

Upcoming Training