Replies: 1 comment 3 replies
-
Hi @kslacroix , thanks for starting this discussion! Going via Ingress for service-to-service communication is quite unusual for real, but anyway, you'd need to add your Ingress names to CoreDNS or make CoreDNS forward DNS queries to your host system so that Pods can resolve the names. |
Beta Was this translation helpful? Give feedback.
-
TL;DR What is the ip of the cluster as seen from the host? I'm trying to reproduce what you would get from
minikube ip
.Hi, I'm migrating my local dev environment from minikube to k3d and I'm trying to get something like the
minikube ip
but for k3d. Here is my use case.I'm trying to access services inside the cluster from my host using an ingress nginx controller. I use
dnsmasq
to map subdomains to an ip address (i.e. *.test.example.com) on macos. This is essentially like updating /etc/hosts except I don't need to specify every possible subdomain, which is handy since I need to run about 20 microservices in my cluster, with different subdomains for each. For reference, I followed this tutorial. This works well, I'm sure that's not where my problem lies.I map
*.test.example.com
to 127.0.0.1, and add this to my k3d config.ymlI then add an ingress rule to a service
x
with hostx.test.example.com
. I can easily access servicex
from my host machine. But when I try to reach the service from another pod in the cluster I get the following errorcurl: (6) Couldn't resolve host 'x.test.example.com'
. I'm guessing that's because there are no dns entries for my domain in the cluster, and even if there was, it would map to my localhost and not the cluster itself.I need to use the same address inside and outside the cluster, making everything go through ingress which makes interpod communication use https instead of http (I can't use services meshes because our prod environment is still on docker-swarm... I know, lame).
With minikube, I can simply map
*.test.example.com
to the result ofminikube ip
. This removes the need to map ports from cluster to host, freeing ports 80 and 443 on localhost.With k3d, I tried creating a cluster without the port mapping but with the loadBalancer enabled. This way, I thought I could run this
docker container inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' k3d-local-serverlb
to get the ip of the loadBalancer, and use this with dnsmasq. But it simply doesn't work.I also tried with
docker network inspect -f '{{(index .IPAM.Config 0).Gateway}}' k3d-local
to get the docker network gateway address. But this also fails.Beta Was this translation helpful? Give feedback.
All reactions