I started a kubernetes cluster with Docker Desktop for Mac. I then installed Istio on the cluster and followed the steps to create Istio ingress gateway following steps in Open the application to outside traffic. At this point, I have:
(base) ~/istio/istio-1.16.1 $ kubectl get svc -A
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default details ClusterIP 10.105.143.37 <none> 9080/TCP 5h5m
default kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 6h16m
default productpage ClusterIP 10.106.2.22 <none> 9080/TCP 5h5m
default ratings ClusterIP 10.111.217.64 <none> 9080/TCP 5h5m
default reviews ClusterIP 10.104.251.134 <none> 9080/TCP 5h5m
istio-system istio-egressgateway ClusterIP 10.99.102.205 <none> 80/TCP,443/TCP 6h15m
istio-system istio-ingressgateway LoadBalancer 10.108.135.209 localhost 15021:32723/TCP,80:32335/TCP,443:32040/TCP,31400:30864/TCP,15443:31429/TCP 6h15m
istio-system istiod ClusterIP 10.101.35.195 <none> 15010/TCP,15012/TCP,443/TCP,15014/TCP 6h15m
kube-system kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 6h16m
According the Istio document, for Docker Desktop, the ingress gateway host is set to 127.0.0.1.
$ export INGRESS_HOST=127.0.0.1
At this point, I could not access 127.0.0.1:80/productpage, neither 127.0.0.1:32335/productpage from my Mac. However according to the istio document, I should be able to access the page.
I understand that Docker for Desktop for Mac will setup a linuxkit VM and deploy the kubernetes on this VM. This VM has an internal ip 192.168.65.4, which I can not reach from my mac host. So the localhost from the kubectl get svc command above should really mean the linuxkit VM, not my mac host. So how to access the nodeport 32335 on the linuxkit VM from my mac host?
CodePudding user response:
You will need to use port forwarding to access the Istio ingress gateway from your Mac. First, find the port that the Istio ingress gateway is listening on.
Once you have the port number, run the following command to forward it to your local machine:
kubectl port-forward -n istio-system svc/istio-ingressgateway <PORT_NUMBER>