【问题标题】:How to list all incoming requests to istio gateway?如何列出所有对 istio 网关的传入请求?
【发布时间】:2019-09-23 18:20:27
【问题描述】:

出于调试原因,我想查看对我的 istio 网关的所有传入请求。我在哪里可以找到它?

我期待像 nginx 日志这样的东西。

我正在使用

spec:
  selector:
    istio: ingressgateway # use Istio default gateway implementation

【问题讨论】:

  • 您能分享一下该规范是针对哪个对象的吗?
  • 它的网关kubectl get gateway -o yaml -n istio-system

标签: kubernetes istio


【解决方案1】:

您可以通过运行以下命令获取 istio-ingressgateway pod 的日志:

$ kubectl -n istio-system 日志 $(kubectl -n istio-system 获取 pod -listio=ingressgateway -o=jsonpath="{.items[0].metadata.name}") --tail=300

它显示最后 300 个传入请求和可能的错误发生了什么。

更多调试命令可以在blog article 中找到。希望对你有帮助。

【讨论】:

  • 我想要一个所有传入请求的列表,例如GET /api/posts。相反,这给了我[2019-09-18 03:56:08.702][15][warning][config] [bazel-out/k8-opt/bin/external/envoy/source/common/config/_virtual_includes/grpc_stream_lib/common/config/grpc_stream.h:87] gRPC config stream closed: 13,
【解决方案2】:

基于之前的答案及其反馈,我已经关注了这个example 应用程序的一部分,并且我已经成功地获得了HTTP 请求的Ingress 日志,其中包含以下内容:

ingress_pod=$(kubectl get pods --namespace istio-system -l istio=ingress -o=jsonpath="{.items[0].metadata.name}")
kubectl logs $ingress_pod --namespace istio-system | grep -e '\] "GET'

您还可以通过获取Envoy Sidecar 的日志来获取“东/西”HTTP 流量:

kubectl logs -l app=productpage,version=v1 --container=istio-proxy --namespace=default --tail 10000 | grep -e '\] "GET'

您可以随意修改grep 命令表达式中的 HTTP 动词以及相应的标签和命名空间。

【讨论】:

  • 空 grep 结果。没有为我工作。网关起来了。我的服务器正在运行。
  • 你能说说你是怎么安装 istio 的,kubernetes 集群是怎么设置的吗?
猜你喜欢
  • 1970-01-01
  • 2023-03-16
  • 2022-01-25
  • 2017-11-02
  • 2020-12-27
  • 2017-01-31
  • 2019-12-30
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多