I do not know if it is even possible but this is what I am trying to achieve
I have k3s cluster and Traefik is a part of k3s, so for all ingress purposes I am using it and it works well for http ingress .
Deployed mongodb cluster (community operator) with ReplicaSet/StatefullSet and headless service.
So far I can't find any solution on exposing this headless service.
My attempts to create an IngressRouteTCP failed. service/traefik in kube-system namespace
IngressrouteTCP does not use HOST header to match the incoming connection. It is not intended to be used like HTTP, that's why the Host header is not available. It is only specific to HTTP. Instead of that please use HostSNI.
Please have a look on the available attributes for IngressRouteTCP.
Is there any specific error message while you are adding a new entry point to your static configuration?
I have tried HostSNI('*') and still doesn't work.
Regarding
entryPoints:
mongodb:
address: ":27017"
kubectl apply throws the following error:
error validating data: ValidationError(IngressRouteTCP.spec.entryPoints): invalid type for us.containo.traefik.v1alpha1.IngressRouteTCP.spec.entryPoints: got "map", expected "array"; if you choose to ignore these errors, turn validation off with --validate=false
I still do not understand how entryPoints are configured in IngressRouteTCP. If I can't use a host name (using HostSNI('*')) and can't provide a port in entryPoint, how traefik controller knows that it needs to handle these particular requests? It is very vague to me.
I can't use - kind: Rule it throws the error also.
I think I figured it out.
In my case traefik is a part of k3s.
To add a static configuration for this custom Traefik installation (so this is specifically for my "cattle" fellows only):
Created /var/lib/rancher/k3s/server/manifests/traefik-override.yaml with the following content:
Hi,
the rancher k3s documentation recommends to use treafik-config.yaml and not treafik-override.yaml.
This seems to be the standard method for helm installs. k3s merges traefik.yaml and traefik-config.yaml on any start/restart of k3s and watchdog this directory for changes as well . (acts more or less like a treafik provider). Later changes on traefik-config.yaml are recognized and applied dynamicly out of the box by k3s.
I assume you are using a single k3s master, not a HA setup.
Try this treafik-config.yaml and put it to /var/lib/rancher/k3s/server/manifests/
BTW. You need both, the command line and the entryPoints entry. If missed out the entryPoint: you see an entry in the dashboard UI, but it just doesn work!
I also tried your the combination above, But here with traefik 2.x this did not worked out.
For me this setup works on TCP and UDP ports. But because of the very slim docu, it's hard to find out what's the proposed standard pattern for that.