docker - 使用 Istio sidecar 从多容器 pod 调用服务
问题描述
我有两个带有两个容器的豆荚。在每个 pod 中,一个容器是 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
我在 pod 中有一个 helloworld 服务helloworld-deployment-7dfc7db54d-d4ddf
。我想从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
我用了命令,
$ 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
如何调用该服务?
解决方案
只需使用以下命令:
kubectl exec -it helloserver-744bf7487-m426t -c helloserver -- curl http://helloworld-service:9095/helloworld/
推荐阅读
- php - str_replace 上 foreach 数组上的字符串
- javascript - 在渲染时隐藏检查单元 - extjs 6.5.3 现代
- android - 应用程序的锁定屏幕
- runtime-error - 关于列表的 App Inventor 运行时错误
- amazon-web-services - 使用 AWS Codebuild 时如何读取 SSM 参数?
- javascript - 如何使用时刻时区以长格式获取本地时区?
- javascript - VueJS 中的 JavaScript 类 getter/setter 和 v-model
- javascript - 使用Nodejs自动将文件名保存在数据库中
- javascript - 使用 Parsimmon 解析用户在 JavaScript 中输入的数组
- sql-server - 如何使用分号分隔符将 Excel (xlsm) 保存为 CSV 文件?