<p>I am trying to configure a Traefik IngressRoute to point to a Headless service (the service point to a Database behind the cluster).
The Setup work well with a &quot;normal&quot; service (with the endpoint inside the cluster).
I am using traefik 2.3.</p>
<p>But when I try to create an ingressRoute that point to the headless service, I have that error in the traefik logs:</p>
<pre><code>time=&quot;2020-11-27T10:41:53Z&quot; level=error msg=&quot;cannot define a port for dev/-central-db-service&quot; ingress=webapp-ingressroute providerName=kubernetescrd namespace=traefik

time=&quot;2020-11-27T10:41:54Z&quot; level=error msg=&quot;cannot define a port for dev/central-db-service&quot; providerName=kubernetescrd ingress=webapp-ingressroute namespace=traefik
</code></pre>
<p>Here is the IngressRoute I am trying to create, along with the Headless service with endpoint:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: webapp-ingressroute
  namespace: traefik
  labels:
spec:
  entryPoints:
    - websecure
  routes:
    - match: Host(`couchdb.test.io`)
      kind: Rule
      services:
        - name: central-db-service
          kind: Service
          port: 5984
          namespace: dev
  tls:
    secretName: certificate
---
kind: Endpoints
apiVersion: v1
metadata:
  name: central-db-service
  namespace: dev
subsets:
  - addresses:
        - ip: 192.168.0.50
    ports:
      - port: 5984
        name: central-db-service
---
kind: Service
apiVersion: v1
metadata:
  name: central-db-service
  namespace: dev
spec:
  clusterIP: None
  ports:
  - port: 5984
    targetPort: 5984</code></pre>
</div>
</div>
</p>
<p>The setup work perfectly with a &quot;normal&quot; service.</p>
<p>What did I miss? Is it even possible to point to headless service with traefik 2.3 ?
Thanks in advance for your help.</p>

Popopame
<p>Resolved !</p>
<p>The error came from a misconfiguration of my service and endpoints.</p>
<p>The name I set for the port of my endpoints didn't match the name of the port of the service (in fact, I didn't set a name).
Once the ports in the endpoints and the ports in the services have the same name set, everything worked fine.</p>
<pre><code>kind: Endpoints
apiVersion: v1
metadata:
  name: central-db-service
  namespace: dev
subsets:
  - addresses:
        - ip: 192.168.0.50
    ports:
      - port: 5984
        name: central-db-service
---
kind: Service
apiVersion: v1
metadata:
  name: central-db-service
  namespace: dev
spec:
  clusterIP: None
  ports:
  - port: 5984
    targetPort: 5984
    name: central-db-service
</code></pre>
