首页 > 其他分享 >Istio Policies and Telemetry

Istio Policies and Telemetry

时间:2022-10-30 18:35:55浏览次数:93  
标签:适配器 destination Telemetry Istio Mixer istio source 实例 Policies


要理解策略和遥测,首先要理解 Mixer 的架构;
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-sUuojjzC-1664190859192)(https://istio.io/docs/concepts/policies-and-telemetry/topology-with-cache.svg)]
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-NghRMvEl-1664190859194)(https://istio.io/docs/concepts/policies-and-telemetry/machine.svg)]

适配器和模板(Template)
适配器 封装了 Mixer 和特定基础设施后端之间的接口,把 Mixer 和基础设施后端连接起来。Istio已经实现了多个​​适配器​​​。各种适配器都需要参数配置才能工作。例如日志适配器可能需要 IP 地址和端口来进行日志的输出。Istio使用处理器(Handler)来给适配器配置参数来生成一个适配器实例;。
模板 定义了从特定请求的属性到适配器输入的映射关系。一个适配器可以支持任意数量的模板。一个模板代表了一条check或者report的data item;

TEMPLATE_VARIETY_CHECK
TEMPLATE_VARIETY_REPORT
TEMPLATE_VARIETY_QUOTA
TEMPLATE_VARIETY_ATTRIBUTE_GENERATOR

策略和遥控功能的控制能力包含了三种类型资源的配置:
配置一组处理器(Handler),用于确定正在使用的适配器组及其操作方式。处理器配置的一个例子如:为 Statsd 后端提供带有 IP 地址的 statsd 适配器。

配置一组实例(Instance),描述如何将请求属性映射到适配器输入。实例表示一个或多个适配器将操作的各种数据。例如,运维人员可能决定从诸如 destination.service 和 response.code 之类的属性中生成 requestcount 指标的实例。

配置一组规则(Rule),这些规则描述了何时调用特定适配器及哪些实例。规则包含 match 表达式和 action。match 表达式控制何时调用适配器,而 action 决定了要提供给适配器的一组实例。例如,规则可能会将生成的 requestcount 实例发送到 statsd 适配器。

Instance对应Template
Handler对应Adapter

apiVersion: config.istio.io/v1alpha2
kind: handler
metadata:
name: quotahandler
namespace: istio-system
spec:
compiledAdapter: memquota
params:
quotas:
- name: requestcountquota.instance.istio-system
maxAmount: 500
validDuration: 1s
# The first matching override is applied.
# A requestcount instance is checked against override dimensions.
overrides:
# The following override applies to 'reviews' regardless
# of the source.
- dimensions:
destination: reviews
maxAmount: 1
validDuration: 5s
# The following override applies to 'productpage' when
# the source is a specific ip address.
- dimensions:
destination: productpage
source: "10.28.11.20"
maxAmount: 500
validDuration: 1s
# The following override applies to 'productpage' regardless
# of the source.
- dimensions:
destination: productpage
maxAmount: 2
validDuration: 5s
---
apiVersion: config.istio.io/v1alpha2
kind: instance
metadata:
name: requestcountquota
namespace: istio-system
spec:
compiledTemplate: quota
params:
dimensions:
source: request.headers["x-forwarded-for"] | "unknown"
destination: destination.labels["app"] | destination.service.name | "unknown"
destinationVersion: destination.labels["version"] | "unknown"

参考
​​​Mixer Out Of Process Adapter Dev Guide​​​​Mixer Out of Process Adapter Walkthrough​​​​Mixer Template Dev Guide​


标签:适配器,destination,Telemetry,Istio,Mixer,istio,source,实例,Policies
From: https://blog.51cto.com/xichenguan/5807694

相关文章

  • Istio(十三):Istio项目实际案例——Online Boutique
    目录一.模块概览二.系统环境三.创建Kubernetes(k8s)集群3.1创建Kubernetes(k8s)集群3.2Kubernetes集群环境四.安装istio4.1安装Istio五.部署onlineBoutique应用5.1部......
  • Istio(十二):Istio问题排查
    目录一.模块概览二.Envoy基础2.1Envoy基础三.Envoy示例四.调试备忘录4.1配置4.2运行时4.3检查Envoy日志4.4配置istiod日志一.模块概览本模块介绍了在使用Isti......
  • Istio(十一):向istio服务网格中引入虚拟机
    目录一.模块概览二.系统环境三.虚拟机负载3.1虚拟机负载3.2单网络架构3.3多网络架构3.4Istio中如何表示虚拟机工作负载?四.实战:向istioMesh中引入虚拟机4.1将虚拟机......
  • Istio(十):istio多集群部署模式
    目录一.模块概览二.多集群部署2.1多集群部署2.2网络部署模式2.3控制平面部署模型2.4网格部署模型2.5租户模式2.6最佳多集群部署一.模块概览在本模块中,我们将了解在......
  • Istio(九):istio安全之授权
    目录一.模块概览二.系统环境三.istio授权3.1istio授权3.2来源3.3操作3.4条件四.实战:授权(访问控制)4.1访问控制4.2清理一.模块概览在Kubernetes集群中,可以对用户进行......
  • Istio(八):istio安全之认证,启用mTLS
    目录一.模块概览二.系统环境三.istio认证3.1证书创建与轮换3.2对等认证和请求认证3.2.1对等认证3.2.2请求认证3.3mTLS3.3.1双向TLS3.3.2允许模式四.实战:启用mTLS4.......
  • Istio(七):ServiceEntry,sidecar,Envoy Filter
    目录一.模块概览二.系统环境三.ServiceEntry四.sidecar4.1Sidecar4.2工作负载选择器4.3入口和出口监听器五.EnvoyFilter5.1EnvoyFilter一.模块概览使用ServiceEntr......
  • Istio(六):Istio弹性(超时&重试)和故障注入
    目录一.模块概览二.系统环境三.弹性(超时&重试)3.1弹性四.故障注入4.1故障注入五.实战:观察错误注入5.1在Grafana、Zipkin和Kiali中观察故障注入和延迟情况5.2清理......
  • Istio(五):使用服务网格Istio进行流量路由
    目录一.模块概览二.系统环境三.简单路由3.1简单路由四.Subset和DestinationRule4.1Subset和DestinationRule4.2DestinationRule中的流量策略4.2.1负载均衡器设置4.2......
  • Istio(四):创建部署Gateway并使用网关暴露服务
    目录一.模块概览二.系统环境三.Gateway网关3.1使用Gateway四.实战:使用Gateway发布服务4.1创建部署并使用网关暴露4.2清理一.模块概览在Kubernetes集群中,服务的发布方......