I tried setting up hub in a test cluster, following the docs.
I registered a test service, but when making a request at that URL, I can see that hub-agent-tunnel pod logs this error:
{"level":"error","error":"dial: dial tcp: lookup traefik-hub.hub-agent.svc.cluster.local on 172.20.0.10:53: no such host","time":1668875101,"message":"Unable to proxy the tunnel traffic to the cluster endpoint"}
I don't have a service called traefik-hub in the traefik-hub namespace, here's what I have:
❯ kubectl -n hub-agent get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hub-agent-auth-server ClusterIP 172.20.235.135 <none> 80/TCP 5m
hub-agent-controller ClusterIP 172.20.248.242 <none> 443/TCP 5m
hub-catch-all ExternalName <none> hub.traefik.io 443/TCP 5m
I'm pretty sure I've followed all the guides, anyone know what I can have done wrong?
I think I found it. The hub's helm chart has a default setting tunnelDeployment.traefik.tunnelHost: traefik-hub.traefik-hub.svc.cluster.local. This would only make sense if running traefik in a namespace called traefik-hub.
Yes, you were on the right track.
We've tried reproducing what we thought was your use case, i.e. setting up traefik through helm with a namespace that is not "hub-agent", with:
mbp:traefik mpl$ helm upgrade --install traefik traefik/traefik --namespace foo --create-namespace --set hub.enabled=true --set ports.web=null --set ports.websecure=null
Release "traefik" does not exist. Installing it now.
NAME: traefik
LAST DEPLOYED: Thu Nov 24 15:33:19 2022
NAMESPACE: foo
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Traefik Proxy v2.9.4 has been deployed successfully
on foo namespace !
Traefik Hub integration is enabled ! With your specific parameters,
`metricsURL`, `tunnelHost` and `tunnelPort` needs to be set accordingly
on hub-agent Helm Chart. Based on this Chart, it should be:
--set controllerDeployment.traefik.metricsURL=traefik-hub.foo.svc.cluster.local:9100/metrics \
--set tunnelDeployment.traefik.tunnelHost=traefik-hub.foo.svc.cluster.local \
--set tunnelDeployment.traefik.tunnelPort=9901 \
See https://doc.traefik.io/traefik-hub/install/#traefik-hub-agent-install-with-helmchart
And as you can see, it now detects that the namespace is not "hub-agent", and therefore outputs the settings that one should use when setting the hub agent afterwards, which we then did:
mbp:traefik mpl$ helm upgrade --install hub-agent traefik/hub-agent \
--set token="0a5f823d-c755-4e82-836e-a913eb598dc7" --namespace hub-agent \
--set controllerDeployment.traefik.metricsURL=traefik-hub.foo.svc.cluster.local:9100/metrics \
--set tunnelDeployment.traefik.tunnelHost=traefik-hub.foo.svc.cluster.local \
--set tunnelDeployment.traefik.tunnelPort=9901 \
--create-namespace
Release "hub-agent" does not exist. Installing it now.
NAME: hub-agent
LAST DEPLOYED: Thu Nov 24 15:40:28 2022
NAMESPACE: hub-agent
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Hub Agent v1.0.0 has been deployed successfully
on the hub-agent namespace!
You can read more about configuring Traefik to work with Hub in the documentation https://doc.traefik.io/traefik/traefik-hub/
which seems to work.
Have you tried a similar approach and succeeded with it?