Hello fellow TCP users,
I am moving my homelab from Docker to Kubernetes (because I have nothing to do with my homelab anymore) and I am having an issue with services that need to be accessible both within the cluster and from the outside world on the same hostname.
For an example, supposedly you have two pods: A and B which are accessible via the Gateway with hostname a.example.com and b.example.com respectively. Pod A also need to contact Pod B so there are two ways to do this:
- Via
b.example.com. This works but in this case, the traffic will go from pod A -> the boarder internet -> the loadbalancer -> the gateway -> pod B which is not very optimal. - Via
b.default.svc.cluster.local. This also works but in this case you lose:- TLS: because you bypass the gateway.
- Configuration transparency: now you have to maintain a different internal hostname and another external hostname. For example Keycloak has a specific setting just for this case: www.keycloak.org/server/hostname#_utilizing_an_in….
In Docker case, I can just set the alias of my reverse-proxy container to b.example.com and it is done. I am wondering is there anything I can do to get the traffic goes from pod A -> the gateway -> pod B in Kubernetes. Also is this a common issue or not because I don’t see a lot of articles about this issue on the internet :/
Thank you very much!
xana@lemmy.zip
Eldaroth@lemmy.world 1 hour ago
You can configure CoreDNS for what you are trying to do, there is usually a ConfigMap containing the CoreDNS config in the kube-system namespace. We did that as a quick hack on one of our clusters at work, but I wouldn’t recommend it tbh. Instead I would do what others already suggested and deploy a Pi-Hole or AdGuard Home, or even a second CoreDNS for this purpose.