Use traefik as an external ingress controller

Hello,

I'm using traefik with the last 1.7 version and I have multiple backend type like file and docker.

Now, I'm trying to add a kubernetes backend and I have successfully connecting my traefik to my kubernetes cluster.

I've been configured an ingress inside my kubernetes cluster and I can see on traefik dashboard the kubernetes frontend and backend but, when I make a call to one of frontend URL, I can see that traefik try to communicate with the pod and it's internal cluster IP.

My kubernetes service :

kind: Service
apiVersion: v1
metadata:
  name: api-service
spec:
  selector:
    app: myapp
    tier: api
  ports:
  - port: 3000
  type: NodePort

And my ingress :

kind: Ingress
apiVersion: extensions/v1beta1
metadata:
  name: traefik-ingress
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  rules:
  - host: "api.myapp.com"
    http:
      paths:
      - backend:
          serviceName: api-service
          servicePort: 3000

My question is : there is a solution to have this scheme working correctly without the use of ingress controller inside the cluster ? Or it is inevitable ?
It is possible that ingress return the node IP and the correct port ?

I hope I was clear enough :blush:
Thank you

Traefik queries the kubernetes API and forwards requests directly to the configured pods. If you are running traefik outside of the kubernetes cluster, it will listen on the hosts, but will try to forward directly to the pod IPs.

This may or may not work depending how you have your overlay network set up.

Ingress is used to take traffic coming into the cluster and route it to the appropriate pods based on rules. It seems like what you are trying to do is to route from outside the cluster to associated nodeports. That is the job of a load balancer.

You may want to check out MetalLB: https://metallb.universe.tf/

Note that you can put metalLB infront of traefik, and use both!
internet -> metal LB -> Traefik -> service

Thank you very much for your response.

I will have a look to setup my network or add MetalLB.

I will keep in touch if I've succeeded :blush:

Have a good day !