我计划将 K8s/Istio 引入我的基础设施。现在我有很多使用 RabbitMQ 相互通信的服务。
服务网格概念似乎假设所有服务都应该是同步的。
我想至少保持我的一些服务异步并利用 istio 提供的相互 TLS 身份验证以及聚合监控。
是否有任何工具/方法可以帮助我简化同步和异步服务的管理?
谢谢,
我想将 istio 与 K8S 中现有的 jaeger 跟踪系统一起使用,我开始按照cassandra 作为后端存储的官方链接安装 jaeger 系统。然后通过helm way安装 istio ,但只启用了一些选定的组件:
helm upgrade istio -i install/kubernetes/helm/istio --namespace istio-system \
--set security.enabled=true \
--set ingress.enabled=false \
--set gateways.istio-ingressgateway.enabled=true \
--set gateways.istio-egressgateway.enabled=false \
--set galley.enabled=false \
--set sidecarInjectorWebhook.enabled=true \
--set mixer.enabled=false \
--set prometheus.enabled=false \
--set global.proxy.envoyStatsd.enabled=false \
--set pilot.sidecar=true \
--set tracing.enabled=false
Run Code Online (Sandbox Code Playgroud)
Jaeger 和 istio 安装在同一个 namespace istio-sytem,完成后,里面的所有 pods 长这样:
kubectl -n istio-system get pods
NAME READY STATUS RESTARTS AGE
istio-citadel-5c9544c886-gr4db 1/1 Running 0 …Run Code Online (Sandbox Code Playgroud) 我想将传入流量的请求和响应主体记录到我的每个微服务中。Istio (Envoy) 是否可以开箱即用?我在 Mixer 的 EntryLog 中没有看到用于映射的 body 属性。也许它会在 Istio 的未来版本中添加?
当然,我可以通过在微服务中实现我自己的过滤器来实现这一点,但也许有更好的解决方案来实现这一点。
我正在尝试调试服务网格,Envoy 位于中间。访问日志显示了很多 503,它们的%RESPONSE_FLAGS%. 除了access logging docs 之外,我找不到关于标志实际含义的任何解释。
例如,简洁的NR意思是“我向下游发送了 404,但不是因为上游向我发送了一个,而是因为我没有匹配的路由,所以我,特使生成了 404”。我会喜欢像这样的单衬线用于其他一些。特别是我在苦苦挣扎(这些都出现在我们的日志中......)
URvs UC- 我认为这些是“我向下游发送了 503,因为我连接了上游,但随后出现了问题”。什么问题?具体来说,remote resetvsconnection termination是什么意思?LR connection local reset- 这是什么意思?特使向下游发送了 503,因为它决定停止与上游对话,中途?为什么会那样做?<no flag>- 我是否正确地假设,如果有像404or503和 no这样的错误代码RESPONSE_FLAGS,那个代码是由上游发送的,只是被转发了?我希望能够envoy在我的服务网格上捕获(记录)(至少部分)的 HTTP 标头istio。
我已经浏览了envoy's docs,并且在日志级别'部分中,它没有提到任何特定于标头的信息。
目前,我的istio-proxy日志是这样的(这是来自输出stern):
mysvc-69c46fbc75-d9v8j istio-proxy {"bytes_sent":"124","upstream_cluster":"inbound|80|http|mysvc.default.svc.cluster.local","downstream_remote_address":"10.11.11.1:0","authority":"some.url.com","path":"/health?source=dd_cluster_agent","protocol":"HTTP/1.1","upstream_service_time":"1","upstream_local_address":"127.0.0.1:40406","duration":"2","upstream_transport_failure_reason":"-","route_name":"default","downstream_local_address":"10.11.32.32:20000","user_agent":"Datadog Agent/7.24.0","response_code":"200","response_flags":"-","start_time":"2021-01-17T18:54:57.449Z","method":"GET","request_id":"61ae63c7-aa10-911b-9562-939kdhd49ddhj","upstream_host":"127.0.0.1:20000","x_forwarded_for":"10.16.32.1","requested_server_name":"outbound_.80_.mysvc_.faros.default.svc.cluster.local","bytes_received":"0","istio_policy_status":"-"}
Run Code Online (Sandbox Code Playgroud)
有没有办法记录http标题?(最好是其中一些,以控制伐木成本)
edit1按照评论中的建议,我检查了我的istio-operator资源,我发现访问日志记录似乎已启用
meshConfig:
accessLogEncoding: JSON
accessLogFile: /dev/stdout
Run Code Online (Sandbox Code Playgroud)
edit2我也尝试过以下操作:
curl -i -H "Custom-Header: application/json" https://my.url.net
Run Code Online (Sandbox Code Playgroud)
但在日志中istio-ingressgateway我没有看到我的自定义标头
istio-ingressgateway-58f69d8696-rmpwn istio-proxy {"user_agent":"curl/7.64.1","response_code":"200","response_flags":"-","start_time":"2021-01-18T19:02:48.645Z","method":"GET","request_id":"8e32c93c-484d-9c56-9489-8c5392793d97","upstream_host":"10.16.32.55:20000","x_forwarded_for":"10.16.32.1","requested_server_name":"my.url.net","bytes_received":"0","istio_policy_status":"-","bytes_sent":"124","upstream_cluster":"outbound|80||mysvc.default.svc.cluster.local","downstream_remote_address":"10.16.32.1:52804","authority":"my.url.net","path":"/","protocol":"HTTP/2","upstream_service_time":"9","upstream_local_address":"10.16.32.17:49826","duration":"10","upstream_transport_failure_reason":"-","route_name":"-","downstream_local_address":"10.16.32.17:8443"}
Run Code Online (Sandbox Code Playgroud) 我有下面的过滤器。
我正在检查网关的日志,看起来没有应用过滤器。
EnvoyFilter?apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: proper-filter-name-here
namespace: istio-system
spec:
workloadSelector:
labels:
app: istio-ingressgateway
configPatches:
- applyTo: NETWORK_FILTER
match:
context: GATEWAY
listener:
filterChain:
filter:
name: "envoy.http_connection_manager"
patch:
operation: INSERT_BEFORE
value:
name: envoy.lua
typed_config:
"@type": "type.googleapis.com/envoy.config.filter.http.lua.v2.Lua"
inlineCode: |
function envoy_on_request(request_handle)
request_handle:logDebug("Hello World!")
end
Run Code Online (Sandbox Code Playgroud) 我是 gRPC 新手。我的程序是用 \xe2\x80\x8d\xe2\x80\x8d 编写的nuxtjs,是一个简单的程序login page,它接收username并password使用 gRPC 将其发送到服务器。\n当我使用BloomRPC提交请求时,一切都很好。但使用浏览器时,请求不会发送到服务器。
我的auth班级如下:
// auth.js\n\nexport default class {\n constructor(vars) {\n this.tokenKey = vars.tokenKey\n this.proto = vars.proto\n this.client = new vars.proto.AuthenticationClient(\'http://127.0.0.1:50051\', null, null)\n }\n\n async loginRequest(user) {\n const request = new this.proto.LoginRequest()\n request.setUsername(user.username.trim().toLowerCase())\n request.setPassword(user.password.trim()) \n return await this.client.login(request, {}) \n } \n}\nRun Code Online (Sandbox Code Playgroud)\n无论服务器是否启动,用浏览器向服务器请求时都会出现此错误。
\nnet ERROR_CONNECTION_REFUSED\nmessage: \'Http response at 400 or 500 level\'\n...\nRun Code Online (Sandbox Code Playgroud)\n\n我需要进行特定配置吗?
\n …我在 scala Play Framework 中有 gRPC 服务器,它在端口 9000 上公开了 gRPC hello world 示例服务。我正在尝试将它与 React Web 客户端连接。我似乎遇到了部署到 Mac 上 docker 容器的 Envoy 代理的连接问题。
\n我总是遇到同样的错误,我认为这意味着 Envoy 无法与后端连接:
\n\xe2\x80\x8bcode: 2\xe2\x80\x8b\nmessage: "Http response at 400 or 500 level"\n\xe2\x80\x8bmetadata: Object { }\nRun Code Online (Sandbox Code Playgroud)\n我用来构建 Envoy 的 docker 文件是:
\nFROM envoyproxy/envoy:v1.12.2\nCOPY ./envoy.yaml /etc/envoy/envoy.yaml\nCMD /usr/local/bin/envoy -c /etc/envoy/envoy.yaml -l trace --log-path /tmp/envoy_info.log\nRun Code Online (Sandbox Code Playgroud)\n我正在使用这个脚本构建它:
\necho --- Building my-envoy docker image ---\ndocker build -t my-envoy:1.0 .\n\necho --- Running my-envoy docker image ---\ndocker run -d -p …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Python 中设置 GRPC 客户端来访问特定服务器。服务器设置为需要通过访问令牌进行身份验证。因此,我的实现如下所示:
def create_connection(target, access_token):
credentials = composite_channel_credentials(
ssl_channel_credentials(),
access_token_call_credentials(access_token))
target = target if target else DEFAULT_ENDPOINT
return secure_channel(target = target, credentials = credentials)
conn = create_connection(svc = "myservice", session = Session(client_id = id, client_secret = secret)
stub = FakeStub(conn)
stub.CreateObject(CreateObjectRequest())
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是,当我尝试使用此连接时,出现以下错误:
File "<stdin>", line 1, in <module>
File "\anaconda3\envs\test\lib\site-packages\grpc\_interceptor.py", line 216, in __call__
response, ignored_call = self._with_call(request,
File "\anaconda3\envs\test\lib\site-packages\grpc\_interceptor.py", line 257, in _with_call
return call.result(), call
File "anaconda3\envs\test\lib\site-packages\grpc\_channel.py", line 343, in result
raise self
File "\anaconda3\envs\test\lib\site-packages\grpc\_interceptor.py", …Run Code Online (Sandbox Code Playgroud) 我们正在使用访问日志字段来提供持续时间类型我们正在使用以下内容
totalDuration: '%DURATION%'
upstreamTime: '%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%'
Run Code Online (Sandbox Code Playgroud)
我们正在获取这些值,但是它在访问日志中的值相同(完全相同的时间),为什么?我想持续时间应该总是大于 upstram_service_time 我在这里错过了什么?
1 We need the total time of the calls E2E - for that we use '%DURATION%'
2. How much time it spent e2e on the upstream '%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%'
Run Code Online (Sandbox Code Playgroud)
可以打印微秒吗?也许我们可以看到差异
envoyproxy ×10
istio ×5
kubernetes ×4
grpc ×3
debugging ×1
django ×1
docker ×1
grpc-web ×1
http-headers ×1
jaeger ×1
javascript ×1
logging ×1
nuxt.js ×1
openshift ×1
python ×1
zipkin ×1