Thanks, I'm back at trying this and just spent another 5 hours trying to configure an HTTPRoute to direct traffic to my whoami
deployment. I take your point that it makes sense to use this on a real domain, but I need to prove to my manager that the entire concept of using Kubernetes/Traefik as a routing tool is workable on our local network first. I'm familiar with nginx reverse proxies and this is theoretically not a difficult task, particularly because nginx logs are generally quite helpful. All I get from Traefik is 404 page not found
, and I'm not even sure if this is coming from Traefik or some Kubernetes component because no logs are written by the Traefik pod.
I have created a deployment, service and httproute exactly as shown by @conradwt in the post above with corrected indentation. I also tried commenting out the hostnames section, or using various PathPrefix values to try and have Traefik route traffic based on those instead, like this:
# HTTPRoute
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: whoami-httproute
namespace: whoami
spec:
parentRefs:
- name: traefik-gateway
namespace: traefik
# hostnames:
# - gateway.local
rules:
- matches:
- path:
type: PathPrefix
value: /whoami/
backendRefs:
- name: whoami
namespace: whoami
port: 80
None of this returns anything except 404 page not found
, regardless of whether I access it by IP address or a hostname like gateway.local
from my laptop with this name specified in /etc/hosts
. It also responds with 404 when I try to access it with curl http://localhost/whoami/
from any of the three nodes in the cluster. No logs are written anywhere.
I am still able to access the Traefik dashboard under http://127.0.0.1:9000/dashboard/
when running kubectl port-forward $(kubectl get pods --selector "app.kubernetes.io/name=traefik" --output=name --namespace traefik) 9000:9000 --address 0.0.0.0 --namespace traefik
from my laptop. But I can't find any way to create working ingress. Would really appreciate a pointer to the right docs or a relevant forum post, thanks!