使用Istio边车从多容器吊舱中调用服务

时间:2018-11-01 05:04:53

标签: docker proxy kubernetes istio envoyproxy

我有两个装有两个容器的豆荚。在每个吊舱中,一个集装箱是Istio sidecar-proxy(特使)

$ kubectl get pods
NAME                                     READY   STATUS    RESTARTS   AGE
helloserver-744bf7487-m426t              2/2     Running   0          14h
helloworld-deployment-7dfc7db54d-d4ddf   2/2     Running   0          15h

我在helloworld-deployment-7dfc7db54d-d4ddf窗格中有一个helloworld服务。我想从helloserver-744bf7487-m426t窗格中调用该服务。

$kubectl get services
NAME                 TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
helloserver          NodePort    10.100.244.253   <none>        9095:30161/TCP   13h
helloworld-service   NodePort    10.111.142.95    <none>        9095:32685/TCP   14h

我使用了命令,

$ kubectl exec -it helloserver-744bf7487-m426t -c helloserver -- \bin\sh\
> curl http://helloworld-service:9095/helloworld/

但是它给出了一个错误,

OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: \"binshcurl\": executable file not found in $PATH": unknown
command terminated with exit code 126

如何调用此服务?

1 个答案:

答案 0 :(得分:1)

只需使用以下命令:

kubectl exec -it helloserver-744bf7487-m426t -c helloserver -- curl http://helloworld-service:9095/helloworld/