- 本任务展示如何配置 Istio 来自动地收集网格中服务的遥测指标。任务的最后,将为调用网格内部的服务打开一个新的日志流。
1.1 开启 Envoy’s access logging
[root@master bin]# ./istioctl install --set profile=demo --set meshConfig.accessLogFile="/dev/stdout"cd
Detected that your cluster does not support third party JWT authentication. Falling back to less secure first party JWT. See https://istio.io/docs/ops/best-practices/security/#configure-third-party-service-account-tokens for details.
✔ Istio core installed
✔ Istiod installed
✔ Egress gateways installed
✔ Ingress gateways installed
✔ Addons installed
✔ Installation complete [root@master bin]#
-
向示例应用发送流量
image.png - 验证是否已经生成了日志流并且正向其中不断增添请求。
- 在 Kubernetes 环境, 如下所示:
[root@master istio-1.6.3]# kubectl logs -l app=productpage -c istio-proxy
[2020-07-01T07:53:02.987Z] "GET /reviews/0 HTTP/1.1" 200 - "-" "-" 0 379 2732 2732 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" "ae731a48-3839-95e1-a132-35522711f75a" "reviews:9080" "100.122.25.9:9080" outbound|9080||reviews.default.svc.cluster.local 100.122.25.49:34964 10.104.229.61:9080 100.122.25.49:34534 - default
[2020-07-01T07:53:01.379Z] "GET /productpage HTTP/1.1" 200 - "-" "-" 0 5183 4345 4344 "100.89.161.128" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" "ae731a48-3839-95e1-a132-35522711f75a" "192.168.14.130:32082" "127.0.0.1:9080" inbound|9080|http|productpage.default.svc.cluster.local 127.0.0.1:40528 100.122.25.49:9080 100.89.161.128:0 outbound_.9080_._.productpage.default.svc.cluster.local default
[2020-07-01T07:53:06.776Z] "GET /static/bootstrap/fonts/glyphicons-halflings-regular.woff2 HTTP/1.1" 200 - "-" "-" 0 18028 238 228 "100.89.161.128" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" "63fa06f7-faad-9ecf-9f61-d786cd954b99" "192.168.14.130:32082" "127.0.0.1:9080" inbound|9080|http|productpage.default.svc.cluster.local 127.0.0.1:40622 100.122.25.49:9080 100.89.161.128:0 outbound_.9080_._.productpage.default.svc.cluster.local default
[2020-07-01T07:55:44.199Z] "GET /details/0 HTTP/1.1" 200 - "-" "-" 0 178 52 52 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" "25535e07-725c-966a-afbe-57df1438bba5" "details:9080" "100.122.25.44:9080" outbound|9080||details.default.svc.cluster.local 100.122.25.49:42296 10.106.183.190:9080 100.122.25.49:44362 - default
[2020-07-01T07:55:44.270Z] "GET /reviews/0 HTTP/1.1" 200 - "-" "-" 0 295 257 257 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" "25535e07-725c-966a-afbe-57df1438bba5" "reviews:9080" "100.122.25.2:9080" outbound|9080||reviews.default.svc.cluster.local 100.122.25.49:60882 10.104.229.61:9080 100.122.25.49:36846 - default
[2020-07-01T07:55:43.521Z] "GET /productpage HTTP/1.1" 200 - "-" "-" 0 4183 1028 1027 "100.89.161.128" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" "25535e07-725c-966a-afbe-57df1438bba5" "192.168.14.130:32082" "127.0.0.1:9080" inbound|9080|http|productpage.default.svc.cluster.local 127.0.0.1:42850 100.122.25.49:9080 100.89.161.128:0 outbound_.9080_._.productpage.default.svc.cluster.local default
[2020-07-01T07:55:49.719Z] "GET /details/0 HTTP/1.1" 200 - "-" "-" 0 178 1 1 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" "7190150e-70f9-9815-9ac6-c622be198be6" "details:9080" "100.122.25.44:9080" outbound|9080||details.default.svc.cluster.local 100.122.25.49:42296 10.106.183.190:9080 100.122.25.49:44446 - default
[2020-07-01T07:55:49.725Z] "GET /reviews/0 HTTP/1.1" 200 - "-" "-" 0 295 7 7 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" "7190150e-70f9-9815-9ac6-c622be198be6" "reviews:9080" "100.122.25.2:9080" outbound|9080||reviews.default.svc.cluster.local 100.122.25.49:60808 10.104.229.61:9080 100.122.25.49:36926 - default
[2020-07-01T07:55:49.715Z] "GET /productpage HTTP/1.1" 200 - "-" "-" 0 4183 19 19 "100.89.161.128" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" "7190150e-70f9-9815-9ac6-c622be198be6" "192.168.14.130:32082" "127.0.0.1:9080" inbound|9080|http|productpage.default.svc.cluster.local 127.0.0.1:42946 100.122.25.49:9080 100.89.161.128:0 outbound_.9080_._.productpage.default.svc.cluster.local default
[2020-07-01T07:55:50.502Z] "GET /details/0 HTTP/1.1" 200 - "-" "-" 0 178 2 1 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" "c42653e7-61ba-99ec-9189-f3c5b471548e" "details:9080" "100.122.25.44:9080" outbound|9080||details.default.svc.cluster.local 100.122.25.49:41988 10.106.183.190:9080 100.122.25.49:44466 - default
[root@master istio-1.6.3]#
- 清理:
istioctl install --set profile=demo
网友评论