[SOLVED]IngressRouteTCP cross namespace

Hey,

I am using helm to install traeftik to my aws eks using namespace traefik-system.
Applying a IngressRoute for the dasboard in the same namespace does work.

But now I need to connect a service from the default namespace to traefik.
In the dasboard I get "the service does not exists" ...
I have created the IngressRouteTCP in the default namespace (so in the namespace the service exists)

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRouteTCP
metadata:
  name: mosquitto
spec:
  entryPoints:
    - mqtts
  routes:
    - match: HostSNI(`*`)
      kind: Rule
      services:
        - name: mosquitto
  tls: {}

And the service

apiVersion: v1
kind: Service
metadata:
  name: mosquitto
  namespace: default
spec:
  ports:
  - name: mqtt
    port: 1883
    protocol: TCP
    targetPort: 1883

Can you please add namespace and specify where your service has been created?

Please also have a look on other attributes that are available for IngressRouterTCP

https://doc.traefik.io/traefik/routing/providers/kubernetes-crd/#kind-ingressroutetcp

Omg it was due to a wrong port mapping.

The incomming 8883 TLS port is terminated and has to be forwarded to 1883 on the service.

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRouteTCP
metadata:
  name: mosquitto
  namespace: default
spec:
  entryPoints:
    - mqtts
  routes:
    - match: HostSNI(`*`)
      kind: Rule
      services:
        - name: mosquitto
          port: 1883
  tls: {}

The error message that the service does not exists is a bit misleading.

Thank you!

1 Like