Invoke a service from a multi container pod with a Istio sidecar

11/1/2018

I have two pods with two containers. In each pod, one container is the Istio sidecar-proxy (Envoy)

$ 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

I have a helloworld service in the pod helloworld-deployment-7dfc7db54d-d4ddf. I want to invoke that service from the helloserver-744bf7487-m426t pod.

$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

I used the command,

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

But it gives an error as,

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

How to invoke this service?

-- Nethmini Romina
docker
envoyproxy
istio
kubernetes
proxy

1 Answer

11/1/2018

Just use the following command:

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