Istio在HP通用平台的实践

如果无法正常显示,请先停止浏览器的去广告插件。
分享至:
1. Istio在HP通用平台的实践 贺喜 – HP Inc.
2. Agenda • Istio简介 • HP通用平台 - Horizon • 流量管理 • 安全 • 可观测性 • 扩展Istio 卓越工程生产力峰会 ee.msup.com.cn
3. Istio简介 卓越工程生产力峰会 ee.msup.com.cn
4. Istio是什么? Connect, Secure, Control & Observe services 卓越工程生产力峰会 ee.msup.com.cn 流量管理 策略控制 安全性 可观测性
5. Istio – 架构 卓越工程生产力峰会 ee.msup.com.cn
6. HP通用平台 - Horizon 卓越工程生产力峰会 ee.msup.com.cn
7. Horizon - 架构 - Used - Backlog - Monitor & Alert PagerDuty Service 1 Service 1 Service 1 Service x Service x Prometheus - Alert Backend-Monitoring Grafana Auth IAM Notification GeoIP RPL Storage Eventin g Jaeger Backend - Tracing EFK Stack Logging NATS Security RBAC ABAC Istio Messaging Service Mesh Network Cilium Cluster Mesh Network AWS ECR Image Repo Harbor Image Repo Rook Kubernetes Storage Container Orchestration Vault Amazon Web Services Node 1 UI - Monitoring Node 2 Node x Google Cloud Platform Node 1 Multi- tenant management platform 卓越工程生产力峰会 ee.msup.com.cn Node 2 Node x Open Service Broker Microsoft Azure Node 1 Node 2 Secret Management Node x Service MongoDB Database MySQL Database Status
8. 流量管理 卓越工程生产力峰会 ee.msup.com.cn
9. Gateway • 定义管理入站和出站流量的规则 § Ingress Gateway § Egress Gateway • 定义可以被外部访问的服务、端口、协议 • 结合Virtual Service以及Destination Rule定 义mesh内的流量管理规则 卓越工程生产力峰会 ee.msup.com.cn
10. Virtual Service • 路由规则的集合。这些路由规则定义 了请求如何被正确的路由到目的服务。 • 支持HTTP, TCP, TLS路由规则 • HTTP路由规则 § 丰富的条件匹配(uri, method, header, query parameters…) 。 支持精确、前 缀、正则匹配 § 重定向,重写,重试,错误注入(超 时,终止),Cors § • 添加、删除、修改HTTP Headers 多个路由规则的执行顺序 从上到下,执行最先匹配的规则 卓越工程生产力峰会 ee.msup.com.cn
11. Destination Rule • 定义服务子集(版本) • 配置负载均衡 • 配置连接池 § § TCP: 最大连接数,连接超时时间,Keep alive HTTP: 最大未处理请求数,每连接最大请求 数…… 卓越工程生产力峰会 ee.msup.com.cn
12. Traffic Splitting - Header https://api.hpbp.io/user/v1/xxx --> user.hpbp • Example项目的请求发送到User Service的example版本 • 其它tenant的请求发送到User Service的common版本 卓越工程生产力峰会 ee.msup.com.cn
13. 安全 卓越工程生产力峰会 ee.msup.com.cn
14. 架构 • 身份 § § Kubernetes:service account GKE/GCE:GCP service account 卓越工程生产力峰会 ee.msup.com.cn • 认证 § § 对等认证(服务到服务的认证) 请求认证(终端用户认证) • 授权
15. 认证 – 对等认证 • • 作用范围 § § § Mesh - Root Namespace Namespace Service Service->Namespace->Mesh 三种模式 § § § Disable:不启用mTLS Permissive:接受TLS以及明文 Strict:只接受mTLS 卓越工程生产力峰会 ee.msup.com.cn Root Namespace
16. 认证 - 请求认证 • • 作用范围 § § § Mesh – Root Namespace Namespace Service Service->Namespace->Mesh JWT Rules § JWT在请求中出现的位置 (Header/Query parameter) § § Issuer JWKs 不带token的请求也能通过认证!!! 卓越工程生产力峰会 ee.msup.com.cn
17. 授权 - AuthorizationPolicy • • • • 作用范围 Mesh,Namespace,Service 规则 § § § from: 请求的来源(namespace, IP…) to: 请求执行的操作(host, method, path…) when: 自定义条件(request.headers, source.principal, request.auth.principal…) 行为 § § § § ALLOW: 允许访问 DENY: 拒绝访问 AUDIT:审计(v1.7) CUSTOM: 自定义(v1.9) 优先级 CUSTOM > DENY > ALLOW 卓越工程生产力峰会 ee.msup.com.cn v1.9
18. 授权 – 访问控制 • Namespace里的服务,只能被本namespace的其它服务或者公开访问 example这个namespace里的服务,只能被 本namespace的其它服务以及istio-system 里的服务访问 卓越工程生产力峰会 ee.msup.com.cn
19. 授权 – 访问控制 • • 某个API只能被某些IP访问 某个API只能被某些用户访问 只允许ID是” 80a704ba-6fab-4b5f-9cb9-3f0199de4022”和 “f6533b3e-fd40-4694-8e26-44bdcc61ea4d”的 用户用GET方法访问“/example/api” 只允许来自于地址”192.168.*.*”对 “/example/api” 的POST请求 卓越工程生产力峰会 ee.msup.com.cn
20. 请求认证 + 授权 • • Istio默认接受不带Token的请求,如何在这种情况下拒绝请求? 某些API不需要Token就能访问(health check),如何实现? 卓越工程生产力峰会 ee.msup.com.cn
21. 安全 – 问题及建议 • 基于IP地址的访问控制(Kubernetes + AWS NLB) § § AWS NLB不会添加XFF头 Kubernetes SNAT导致不能获取到客户端IP地址 AWS NLB 启用Proxy Protocol 卓越工程生产力峰会 ee.msup.com.cn
22. 安全 – 问题及建议 • 确保在配置AuthorizationPolicy时,能够正确的从请求里提取到用于条件匹 配的属性 ‘ JWT Claim: <iss/sub> 如果sub为空, request.auth.principal 为空 https://istio.io/v1.6/docs/reference/config/security/conditions/ 卓越工程生产力峰会 ee.msup.com.cn ‘ JWT Claim: < aud >
23. 可观察性 卓越工程生产力峰会 ee.msup.com.cn
24. Metrics • Proxy-level • 进站连接数,请求数 • 出站的连接数 • CPU使用 • 内存使用 • …… • Service-level § HTTP Request的数量、大小以及处 理时间 § HTTP Response的body的大小 § gRPC 请求以及响应的数量 § TCP接受/发送的字节数以及打开关 闭的连接数 § …… • Control plane § Citadel解析CSR失败的次数 § Galley校验资源失败的次数 § Pilot获取JWKs失败的次数 § …… 卓越工程生产力峰会 ee.msup.com.cn
25. Tracing • Headers: § x-request-id § x-b3-traceid § x-b3-spanid § x-b3-parentspanid § x-b3-sampled § x-b3-flags § x-ot-span-context • 采样率 § 默认是1% § 可配置 o values.pilot.traceSampling o PILOT_TRACE_SAMPLE o IstioOperator • 定制化Tag § 文本/环境变量/请求头 卓越工程生产力峰会 ee.msup.com.cn
26. Logs - Proxy Logs • 输出日志的模块 admin, http, http2, grpc, connection, filter, jwt, upstream... • 调整日志级别 curl -X POST http://localhost:15000/logging?filter=debug • Envoy访问日志 Response Code Response Flag Bytes Received Method Start Time Path Bytes Sent Durations Protocol Upstream Service Time [2021-07-08T07:45:28.998Z] "GET /exam/v1/location HTTP/1.1" 200 - "-" "-" 0 441 35 34 "73.181.89.31" "-" "19d7d084- 9ecb-474f-90e1-273ae199933f" "api.hpbp.io" "127.0.0.1:8080" inbound|80|http-fpz29u|hpbp- example.hpbp.svc.cluster.local 127.0.0.1:7100 10.107.146.5:8080 73.181.89.31:0 outbound_.80_._.hpbp- example.hpbp.svc.cluster.local default 卓越工程生产力峰会 ee.msup.com.cn
27. Logs – 统计 卓越工程生产力峰会 ee.msup.com.cn
28. 扩展Istio – Envoy Filter 卓越工程生产力峰会 ee.msup.com.cn
29. Envoy Filter – Token 检查 Token被撤销了吗? 卓越工程生产力峰会 ee.msup.com.cn
30. Envoy Filter – 动态日志 添加日志,只能修改代码? 卓越工程生产力峰会 ee.msup.com.cn
31. Envoy Filter – 动态日志 卓越工程生产力峰会 ee.msup.com.cn
32. Q&A 卓越工程生产力峰会 ee.msup.com.cn
33. 谢 谢! 卓越工程生产力峰会 ee.msup.com.cn

首页 - Wiki
Copyright © 2011-2024 iteam. Current version is 2.132.0. UTC+08:00, 2024-09-21 22:58
浙ICP备14020137号-1 $访客地图$