I'm currently learning Traefik and I'm struggling a bit with some of the terminology (file vs. dynamic, etc) and how to apply some of the examples I've found to my setup. So I seem to have traefik working 95% the way I want it to. Works great for services internal to my k8s cluster, currently using kubernetes ingress yaml to define my ingresses.
I'm now trying to use traefik as a proxy for some of my services that are not running on k8s. I've found a few examples and the documentation here on defining loadbalancers/servers. This seems to be exactly what I want but I can't seem to get that config to work. Temporarily, I've setup a generic nginx proxy within k8s and send my traefik to that which then proxies to the external services...it's hacktastic (works, but I'm sure there's a better way)
So here's an example of a current (working) ingress config for one of my services:
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: service1-ingress namespace: webapps annotations: spec: rules: - host: "service1.example.com" http: paths: - path: / pathType: Prefix backend: service: name: service1 port: number: 80
This works great for internal services to k8s. I'm now trying to apply the example from the documentation to proxy for an external service, this is my config:
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: service1-ingress namespace: apps annotations: spec: rules: - host: "service.example.com" http: paths: - path: / pathType: Prefix services: service1: loadBalancer: servers: - url: "http://10.1.122.50:8080"
That returns the following error:
Error from server (BadRequest): error when creating "service1-ingress.yaml": Ingress in version "v1" cannot be handled as a Ingress: strict decoding error: unknown field "spec.rules.http.paths.services"
I'm assuming (probably should assume anything) that it's because I'm using the networking.k8s.io/v1 api and need to use something else.
My desired outcome is traefik handles the TLS (via LE) and proxies the request to the backend services whether they are within the k8s cluster or not.
Any help would be appreciated. If it helps/matters, traefik was deployed using the helm chart traefik/traefik.