【发布时间】:2017-08-21 08:25:35
【问题描述】:
我正在按照教程评估 Istio 作为我的 K8s 集群的服务网格,但由于某种原因,我无法制作使用几个服务正常工作的简单示例:
https://istio.io/docs/tasks/integrating-services-into-istio.html
如果我尝试从服务一调用服务二,我会收到以下错误:
# kubectl exec -ti ${CLIENT} -- curl -v service-two:80
Defaulting container name to app.
Use 'kubectl describe pod/service-one-714088666-73fkp' to see all of the containers in this pod.
* Rebuilt URL to: service-two:80/
* Trying 10.102.51.89...
* connect to 10.102.51.89 port 80 failed: Connection refused
* Failed to connect to service-two port 80: Connection refused
* Closing connection 0
curl: (7) Failed to connect to service-two port 80: Connection refused
但是,如果我尝试从集群中的另一个服务连接到服务二,即使在不同的命名空间中,它也可以:
# kubectl exec -ti redis-4054078334-mj287 -n redis -- curl -v service-two.default:80
* Rebuilt URL to: service-two.default:80/
* Hostname was NOT found in DNS cache
* Trying 10.102.51.89...
* Connected to service-two.default (10.102.51.89) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.38.0
> Host: service-two.default
> Accept: */*
>
< HTTP/1.1 200 OK
* Server envoy is not blacklisted
< server: envoy
< date: Sat, 19 Aug 2017 14:43:01 GMT
< content-type: text/plain
< x-envoy-upstream-service-time: 2
< transfer-encoding: chunked
<
CLIENT VALUES:
client_address=127.0.0.1
command=GET
real path=/
query=nil
request_version=1.1
request_uri=http://service-two.default:8080/
SERVER VALUES:
server_version=nginx: 1.10.0 - lua: 10001
HEADERS RECEIVED:
accept=*/*
content-length=0
host=service-two.default
user-agent=curl/7.38.0
x-b3-sampled=1
x-b3-spanid=00000caf6e052e86
x-b3-traceid=00000caf6e052e86
x-envoy-expected-rq-timeout-ms=15000
x-forwarded-proto=http
x-ot-span-context=00000caf6e052e86;00000caf6e052e86;0000000000000000;cs
x-request-id=1290973c-7bca-95d2-8fa8-80917bb404ad
BODY:
* Connection #0 to host service-two.default left intact
-no body in request-
我得到这种意外行为的任何原因或解释?
谢谢。
【问题讨论】:
-
您是否检查了所有服务存在?
kubectl get services -
是的,所有服务都存在:
service-one 10.98.250.222 <none> 80/TCP 1dservice-two 10.101.229.75 <none> 80/TCP 1d -
旁边的
<none>是什么?每个服务是否正确映射到 Deployment? -
<none>是该服务没有External-IP这是我想通过 Istio 公开它们的预期行为。
标签: kubernetes istio