从istio bookinfo示例获取404

时间:2019-12-24 16:42:17

标签: docker kubernetes istio docker-desktop docker-for-mac

我正在尝试阅读此处的Istio快速入门指南,而在步骤confirm the app is accessible from outside the cluster上遇到了麻烦。

我在Mac上运行的是台式机而不是minikube的docker。

docker desktop version information

我也在工作中使用代理,但是即使我绕过代理,也会出现以下错误:

$ 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

吊舱正在运行:

$ 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

我可以从吊舱内卷曲它:

$ 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>

我不确定自己可能做错了什么。任何指导都将不胜感激!

1 个答案:

答案 0 :(得分:2)

感谢istio社区中的this post,使我感到困惑。他们在那篇文章中提到要找到入口端口,他们正在运行以下命令:

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

这与您在bookinfo tutorial上被指示执行的操作不同,在步骤3中,系统要求您转到here以确定您的入口主机和端口。在那里,如果您在本地运行并且没有公共负载均衡器,则会被告知按以下方式拉节点端口:

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}')

如果我改为将json元素更改为“ port”,则效果很好!

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

教程中的示例卷曲:

$ 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>

希望这可以帮助像我一样挣扎的人。