Routing with IngressRoute CRD not working but works with Ingress.
I deployed Traefik 2.2.1 using helm.
I additionally applied ingressRoute for the dashboard from the helm/traefik site
I am able to view the dashboard no issues
I created whoami service with ingressRoute and middleware. Traefik routed correctly to service.
I created Jenkins service from helm installation.
I turned off the creation of ingress and instead created ingressRoute as follows:
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
labels:
traefik.env: mytest
name: mynameingress
namespace: mynamespace
spec:
entryPoints:
- web
routes:
- kind: Rule
match: Host(`test.example.com`)
services:
- name: myjenkins
namespace: jenkins
port: 8080
The router shows up on the dashboard
The jenkins service looks like this
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
labels:
traefik.env: myselector
name: mynameingress
namespace: mynamespace
spec:
entryPoints:
- web
routes:
- kind: Rule
match: Host(`test.example.com`)
services:
- name: myjenkins
namespace: jenkins
port: 8080
Under additional arguments for Traefik the following is added as a selector:
additionalArguments:
- --providers.kubernetescrd.labelSelector=traefik.env=myselector
When I try to http://test.example.com I get a 404 error
When I reinstall Jenkins using helm and add an ingress which looks like this
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web
labels:
traefik.env: myselector
name: jenkinsingress
namespace: jenkins
spec:
rules:
- host: test.example.com
http:
paths:
- backend:
serviceName: myjenkins
servicePort: 8080
I now see two entries on the Traefik Dashboard under HTTP Routers one from the ingress and one from the ingressRoute.
But now when I try to http://test.example.com the application "Jenkins" comes up...
Some additional information:
The Traefik dashboard displays the routers appropriately. The one with ingress is designated as provider Kubernetes and the IngressRoute router is designated as KubernetesCRD.
The only content in the logs is this
time="2020-07-14T18:18:18Z" level=info msg="Configuration loaded from flags."
W0714 18:34:24.373123 1 reflector.go:326] pkg/mod/k8s.io/client-go@v0.17.3/tools/cache/reflector.go:105: watch of *v1alpha1.IngressRouteTCP ended with: too old resource version: 8046202 (8061646)
W0714 18:34:32.423449 1 reflector.go:326] pkg/mod/k8s.io/client-go@v0.17.3/tools/cache/reflector.go:105: watch of *v1.Secret ended with: too old resource version: 8056179 (8061675)
W0714 18:34:32.423514 1 reflector.go:326] pkg/mod/k8s.io/client-go@v0.17.3/tools/cache/reflector.go:105: watch of *v1.Secret ended with: too old resource version: 8056179 (8061675)
My deployment has the following list of args:
args:
- "--global.checknewversion"
- "--global.sendanonymoususage"
- "--entryPoints.traefik.address=:9000/tcp"
- "--entryPoints.web.address=:8000/tcp"
- "--entryPoints.websecure.address=:8443/tcp"
- "--api.dashboard=true"
- "--ping=true"
- "--providers.kubernetescrd"
- "--providers.kubernetesingress"
- "--providers.kubernetescrd.labelSelector=traefik.env=myselector"
My questions:
- Is something wrong in my configuration for IngressRoute which prevents it from working without an ingress?
- Is an Ingress needed if you use IngressRoute?
Any feedback or assistance would be greatly appreciated.
thanks