Kubernetes ingress: Cannot create service: subset not found

Hi,

I am using traefik 2.2.8, installed from the official helm chart (v9.1.1), and I'm not able to create a kubernetes ingress that would work with Traefik. traefik pod logs gives me this:

level=error msg="Cannot create service: subset not found"

E V E R Y ingress object gives this. Validated that, for a specific one, the pod is in ready state, that there's the service object referred by the ingress.

I hhave no clue on how to solve it, and I wouldn't want to go back to traefik 1.8.x for which my ingresses work without any issue.

This error usually means that the service does not have active end points. There is also a possibly related issue.

Found out. I had to add these two lines:

traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.tls: "true"

In the ingress annotations for Traefik to route correctly.

I'm getting this error when trying to test the ingress without TLS as well.

Traefik installed via Helm with helm install traefik traefik/traefik -n traefik -f traefik/args.yaml and these additional args:

additionalArguments:
  - "--providers.kubernetesingress.ingressclass=traefik"
  - "--providers.kubernetesingress.ingressendpoint.publishedservice=traefik/traefik"

Then a test chart to test the ingress with: helm create test, and the only change to the generated chart is:

ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: traefik
  hosts:
    - host: my.sub.domain
      paths:
        - path: '/'
  tls: []

However, when I deploy with helm install -n test hello-world ./test, I the specified host is inaccessible and I get this error from Traefik:

time="2021-01-07T00:56:37Z" level=error msg="Cannot create service: subset not found" namespace=test serviceName=hello-world-test providerName=kubernetes servicePort=80 ingress=hello-world-test
time="2021-01-07T00:56:37Z" level=error msg="Cannot create service: subset not found" namespace=test serviceName=hello-world-test servicePort=80 providerName=kubernetes ingress=hello-world-test

I just got this error as well on Kubernetes 1.23 and traefik 2.9.1.

My problem was a mismatch between the referenced service's.
service.spec.ports[0].targetPort and the actual service's deployment's:
deployment.spec.template.spec.containers[0].ports[0].name

This although kubernetes had no problem binding the pod to the service.

(edit: typo in kubernetes version)