Getting 404 from istio bookinfo sample

12/24/2019

I am trying to work through the Istio quickstart guide here and am having trouble with the step confirm the app is accessible from outside the cluster.

I'm on a mac and running docker for desktop rather than minikube.

docker desktop version information

I am also behind a proxy at work but even when I bypass the proxy I get the following error:

$ curl http://${GATEWAY_URL}/productpage -v
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connection failed
* connect to 127.0.0.1 port 30489 failed: Connection refused
* Failed to connect to 127.0.0.1 port 30489: Connection refused
* Closing connection 0

curl: (7) Failed to connect to 127.0.0.1 port 30489: Connection refused

The pod is running:

$ kubectl get pods
NAME                             READY   STATUS    RESTARTS   AGE
details-v1-c5b5f496d-ccw5f       2/2     Running   0          18h
productpage-v1-c7765c886-xm2jd   2/2     Running   0          18h
ratings-v1-f745cf57b-5df2q       2/2     Running   0          18h
reviews-v1-75b979578c-jtc5l      2/2     Running   0          18h
reviews-v2-597bf96c8f-g7bzd      2/2     Running   0          18h
reviews-v3-54c6c64795-gbqqj      2/2     Running   0          18h

I'm able to curl it from within a pod:

$ kubectl exec -it $(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}') -c ratings -- curl productpage:9080/productpage | grep -o "<title>.*</title>"
<title>Simple Bookstore App</title>

I'm not certain what I may be doing wrong. Any guidance is greatly appreciated!

-- RockyMountainHigh
docker
docker-desktop
docker-for-mac
istio
kubernetes

1 Answer

12/24/2019

I found the confusion thanks to this post in the istio community. In that post they mention that to find the ingress port they are running the following command:

export INGRESS_PORT=$(kubectl -n istio-system get service istio- ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].port}')

This differs from what you are instructed to do on the bookinfo tutorial when on step 3 you are asked to go here to determine your ingress host and port. There, if you are running locally and don't have a public loadbalancer you are told to pull the nodeport like this:

export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}')

If I instead change the json element to 'port' it works perfectly!

export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].port}')

Sample curl from tutorial:

$ curl -v -s http://127.0.0.1:80/productpage | grep -o "<title>.*</title>"
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
> GET /productpage HTTP/1.1
> Host: 127.0.0.1
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< content-type: text/html; charset=utf-8
< content-length: 4183
< server: istio-envoy
< date: Tue, 24 Dec 2019 20:28:55 GMT
< x-envoy-upstream-service-time: 940
<
{ [4183 bytes data]
* Connection #0 to host 127.0.0.1 left intact
<title>Simple Bookstore App</title>

Hopefully this helps somebody that was struggling like I was.

-- RockyMountainHigh
Source: StackOverflow