I'm trying to do a most basic test of routing to a host external to my Kubernetes cluster. I'm using Kubernetes 1.21, and Traefik 2.6.1. For this test I'm trying to route traffic to a pihole server; pihole.example.com -> pihole.lan. I used the example at Kubernetes IngressRoute - Traefik where it specifically mentions an exception for externalName services.
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: pihole-prefix
spec:
addPrefix:
prefix: /admin/
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: pihole.route
namespace: default
spec:
entryPoints:
- web
routes:
- match: Host(`pihole.test.app`)
kind: Rule
middlewares:
- name: pihole-prefix
services:
- name: pihole-svc
port: 80
---
apiVersion: v1
kind: Service
metadata:
name: pihole-svc
namespace: default
spec:
externalName: pihole.lan
type: ExternalName
ports:
- port: 80
I can kubectl to see the service and the ingress, but the Traefik dashboard doesn't show the ingress service. The dashboard does show the middleware. If I try to go to pihole.test.app (I added it to my /etc/hosts to point to the traefik loadbalancer IP) it doesn't work and if I curl it I get a 404 page not found
. Traefik is deployed with helm. Is there some other prerequisite I'm missing to get this to work? I have some services I don't plan to migrate or can't migrate to Kubernetes and need them still to be routable.