Given a virtual machine, with device IP 192.168.2.22
. Run Kubernetes with minikube on it, serve API apps with ingress, services, and deployments. (minikube IP = ingress IP = 172.17.0.2
in the device)
And then expected to access these APIs / server from other PCs.
Here would like to ask about how can this scenario be fulfilled? Hope someone can share their experiences & wisdom. Even some simple keywords may help.
My idea was to map 172.17.0.2
to the localhost
/ 127.0.0.1
on the device (with iptable
), but then it turned out that the ingress actually needs the host.name.com
string to work, so this failed.
Name: my-ingress
Namespace: default
Address: 172.17.0.2
Default backend: default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
Host Path Backends
---- ---- --------
localhost
/route1/?(.*) service1 (172.18.0.4:80)
/route2/?(.*) service2 (172.18.0.4:80)
Annotations: kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /$1
/etc/hosts
file.Note: If you are running Minikube locally, use minikube ip to get the external IP. The IP address displayed within the ingress list will be the internal IP.
<MINIKUBE-EXTERNAL-IP> host.name.com
Then you can do curl host.name.com
xip.io
wildcard DNS where 172.17.0.2.xip.io
resolves to 172.17.0.2