As i mentioned in https://github.com/containous/traefik/issues/5751. I am using IngressRoutes to define rules to send traffic to several services within k8s.
Most of the services exist within k8s but a few are outside of k8s. So normally we are route to them from k8s services by using ExternalName services, however it appears these dont work with traefik. So, Im trying to find a way to route outside of k8s for a few rules.
error msg="Cannot create service: service not found default/gateway-legacy" ingress=entry-www-de namespace=default servicePort=8001 serviceName=gateway-legacy providerName=kubernetescrd
How can I route outside of the k8s cluster using IngressRoutes.
@dduportal I think you said you had 2 workarounds?
Following the file provider documentation example (https://docs.traefik.io/v2.0/routing/overview/#example-with-a-file-provider), then you need to define, in the TOML for the file provider dynamic config, the http routers objects equivalent to the IngressRoute you wanted to create + specify the port 8000 in the http.service.xxx.url field.
Please note the following:
I've named the service gateway-legacy-svc and the router gateway-legacy to avoid confusion.
I assume that the Traefik pod is able to contact the URL http://gateway-lagacy.mydomain.internal:8000/. You can verify it by spawning an interactive shell inside traefik's pod with kubectl exec -ti --namespace=<traefik namespace> <traefik pod id> -- sh and curl-ing the URL from this shell: # apk add --no-cache curl && curl -v http://gateway-lagacy.mydomain.internal:8000/
[http]
[http.routers]
[http.routers.gateway-legacy]
rule = "PathPrefix(`/legacy`)"
service = "gateway-legacy-svc" # Traefik Service Reference
[http.services]
[http.services.gateway-legacy-svc.loadBalancer]
[[http.services.gateway-legacy-svc.loadBalancer.servers]]
url = "http://gateway-lagacy.mydomain.internal:8000/"