Flagger on ASM·基于Mixerless Telemetry实现渐进式灰度发布系列 1 遥测数据
简介: 服务网格ASM的Mixerless Telemetry技术,为业务容器提供了无侵入式的遥测数据。遥测数据一方面作为监控指标被ARMPS/prometheus采集,用于服务网格可观测性;另一方面被HPA和flaggers使用,成为应用级扩缩容和渐进式灰度发布的基石。 本系列聚焦于遥测数据在应用级扩缩容和渐进式灰度发布上的实践,将分三篇介绍遥测数据(监控指标)、应用级扩缩容,和渐进式灰度发布。
序
服务网格ASM的Mixerless Telemetry技术,为业务容器提供了无侵入式的遥测数据。遥测数据一方面作为监控指标被ARMPS/prometheus采集,用于服务网格可观测性;另一方面被HPA和flaggers使用,成为应用级扩缩容和渐进式灰度发布的基石。
本系列聚焦于遥测数据在应用级扩缩容和渐进式灰度发布上的实践,将分三篇介绍遥测数据(监控指标)、应用级扩缩容,和渐进式灰度发布。
总体架构
本系列的总体架构如下图所示:
- ASM下发Mixerless Telemetry相关的EnvoyFilter配置到各ASM sidecar(envoy),启用应用级监控指标的采集。
- 业务流量通过Ingress Gateway进入,各ASM sidecar开始采集相关监控指标。
- Prometheus从各POD上采集监控指标。
- HPA通过Adapter从Prometheus查询相关POD的监控指标,并根据配置进行扩缩容。
- Flagger通过Prometheus查询相关POD的监控指标,并根据配置向ASM发起VirtualService配置更新。
- ASM下发VirtualService配置到各ASM sidecar,从而实现渐进式灰度发布。
Flagger渐进式发布流程
Flagger官网描述了渐进式发布流程,这里翻译如下:
- 探测并更新灰度Deployment到新版本
- 灰度POD实例数从0开始扩容
- 等待灰度POD实例数到达HPA定义的最小副本数量
- 灰度POD实例健康检测
- 由flagger-loadtester实例发起
acceptance-test
验证 - 灰度发布在验证失败时终止
- 由flagger-loadtester实例发起
load-test
验证 - 在配置流量复制时开始从生产全流量复制到灰度
- 每分钟从Prometheus查询并检测请求成功率和请求延迟等监控指标
- 灰度发布在监控指标不符预期的数量到达阈值时终止
- 达到配置中迭代的次数后停止流量复制
- 开始切流到灰度POD实例
- 更新生产Deployment到新版本
- 等待生产Deployment滚动升级完毕
- 等待生产POD实例数到达HPA定义的最小副本数量
- 生产POD实例健康检测
- 切流回生产POD实例
- 灰度POD实例缩容至0
- 发送灰度发布分析结果通知
原文如下:
With the above configuration, Flagger will run a canary release with the following steps:
- detect new revision (deployment spec, secrets or configmaps changes)
- scale from zero the canary deployment
- wait for the HPA to set the canary minimum replicas
- check canary pods health
- run the acceptance tests
- abort the canary release if tests fail
- start the load tests
- mirror 100% of the traffic from primary to canary
- check request success rate and request duration every minute
- abort the canary release if the metrics check failure threshold is reached
- stop traffic mirroring after the number of iterations is reached
- route live traffic to the canary pods
- promote the canary (update the primary secrets, configmaps and deployment spec)
- wait for the primary deployment rollout to finish
- wait for the HPA to set the primary minimum replicas
- check primary pods health
- switch live traffic back to primary
- scale to zero the canary
- send notification with the canary analysis result
前提条件
- 已创建ACK集群,详情请参见创建Kubernetes托管版集群。
- 已创建ASM实例,详情请参见创建ASM实例。
Setup Mixerless Telemetry
本篇将介绍如何基于ASM配置并采集应用级监控指标(比如请求数量总数istio_requests_total
和请求延迟istio_request_duration
等)。主要步骤包括创建EnvoyFilter、校验envoy遥测数据和校验Prometheus采集遥测数据。
1 EnvoyFilter
登录ASM控制台,左侧导航栏选择服务网格 >网格管理,并进入ASM实例的功能配置页面。
- 勾选开启采集Prometheus 监控指标
- 点选启用自建 Prometheus,并填入Prometheus服务地址:
`prometheus:9090
(本系列将使用社区版Prometheus,后文将使用这个配置)。如果使用阿里云产品ARMS,请参考集成ARMS Prometheus实现网格监控。 - 勾选启用 Kiali(可选)
点击确定后,我们将在控制平面看到ASM生成的相关EnvoyFilter列表:
2 Prometheus
2.1 Install
执行如下命令安装Prometheus(完整脚本参见:demo_mixerless.sh)。
kubectl --kubeconfig "$USER_CONFIG" apply -f $ISTIO_SRC/samples/addons/prometheus.yaml
2.2 Config Scrape
安装完Prometheus,我们需要为其配置添加istio相关的监控指标。登录ACK控制台,左侧导航栏选择配置管理>配置项,在istio-system
下找到prometheus
一行,点击编辑。
在prometheus.yaml
配置中,将scrape_configs.yaml中的配置追加到scrape_configs
中。
保存配置后,左侧导航栏选择工作负载>容器组,在istio-system
下找到prometheus
一行,删除Prometheus POD,以确保配置在新的POD中生效。
可以执行如下命令查看Prometheus配置中的job_name
:
kubectl --kubeconfig "$USER_CONFIG" get cm prometheus -n istio-system -o jsonpath={.data.prometheus\\.yml} | grep job_name
- job_name: 'istio-mesh'
- job_name: 'envoy-stats'
- job_name: 'istio-policy'
- job_name: 'istio-telemetry'
- job_name: 'pilot'
- job_name: 'sidecar-injector'
- job_name: prometheusjob_name: kubernetes-apiserversjob_name: kubernetes-nodesjob_name: kubernetes-nodes-cadvisor
- job_name: kubernetes-service-endpoints
- job_name: kubernetes-service-endpoints-slowjob_name: prometheus-pushgateway
- job_name: kubernetes-services
- job_name: kubernetes-pods
- job_name: kubernetes-pods-slow
Mixerless验证
1 podinfo
1.1 部署
使用如下命令部署本系列的示例应用podinfo:
kubectl --kubeconfig "$USER_CONFIG" apply -f $PODINFO_SRC/kustomize/deployment.yaml -n test
kubectl --kubeconfig "$USER_CONFIG" apply -f $PODINFO_SRC/kustomize/service.yaml -n test
1.2 生成负载
使用如下命令请求podinfo,以产生监控指标数据
podinfo_pod=$(k get po -n test -l app=podinfo -o jsonpath={.items..metadata.name})
for i in {1..10}; dokubectl --kubeconfig "$USER_CONFIG" exec $podinfo_pod -c podinfod -n test -- curl -s podinfo:9898/versionecho
done
2 确认生成(Envoy)
本系列重点关注的监控指标项是istio_requests_total
和istio_request_duration
。首先,我们在envoy容器内确认这些指标已经生成。
2.1 istio_requests_total
使用如下命令请求envoy获取stats相关指标数据,并确认包含istio_requests_total
。
kubectl --kubeconfig "$USER_CONFIG" exec $podinfo_pod -n test -c istio-proxy -- curl -s localhost:15090/stats/prometheus | grep istio_requests_total
返回结果信息如下:
:::: istio_requests_total ::::
# TYPE istio_requests_total counter
istio_requests_total{response_code="200",reporter="destination",source_workload="podinfo",source_workload_namespace="test",source_principal="spiffe://cluster.local/ns/test/sa/default",source_app="podinfo",source_version="unknown",source_cluster="c199d81d4e3104a5d90254b2a210914c8",destination_workload="podinfo",destination_workload_namespace="test",destination_principal="spiffe://cluster.local/ns/test/sa/default",destination_app="podinfo",destination_version="unknown",destination_service="podinfo.test.svc.cluster.local",destination_service_name="podinfo",destination_service_namespace="test",destination_cluster="c199d81d4e3104a5d90254b2a210914c8",request_protocol="http",response_flags="-",grpc_response_status="",connection_security_policy="mutual_tls",source_canonical_service="podinfo",destination_canonical_service="podinfo",source_canonical_revision="latest",destination_canonical_revision="latest"} 10istio_requests_total{response_code="200",reporter="source",source_workload="podinfo",source_workload_namespace="test",source_principal="spiffe://cluster.local/ns/test/sa/default",source_app="podinfo",source_version="unknown",source_cluster="c199d81d4e3104a5d90254b2a210914c8",destination_workload="podinfo",destination_workload_namespace="test",destination_principal="spiffe://cluster.local/ns/test/sa/default",destination_app="podinfo",destination_version="unknown",destination_service="podinfo.test.svc.cluster.local",destination_service_name="podinfo",destination_service_namespace="test",destination_cluster="c199d81d4e3104a5d90254b2a210914c8",request_protocol="http",response_flags="-",grpc_response_status="",connection_security_policy="unknown",source_canonical_service="podinfo",destination_canonical_service="podinfo",source_canonical_revision="latest",destination_canonical_revision="latest"} 10
2.2 istio_request_duration
使用如下命令请求envoy获取stats相关指标数据,并确认包含istio_request_duration
。
kubectl --kubeconfig "$USER_CONFIG" exec $podinfo_pod -n test -c istio-proxy -- curl -s localhost:15090/stats/prometheus | grep istio_request_duration
返回结果信息如下:
:::: istio_request_duration ::::
# TYPE istio_request_duration_milliseconds histogram
istio_request_duration_milliseconds_bucket{response_code="200",reporter="destination",source_workload="podinfo",source_workload_namespace="test",source_principal="spiffe://cluster.local/ns/test/sa/default",source_app="podinfo",source_version="unknown",source_cluster="c199d81d4e3104a5d90254b2a210914c8",destination_workload="podinfo",destination_workload_namespace="test",destination_principal="spiffe://cluster.local/ns/test/sa/default",destination_app="podinfo",destination_version="unknown",destination_service="podinfo.test.svc.cluster.local",destination_service_name="podinfo",destination_service_namespace="test",destination_cluster="c199d81d4e3104a5d90254b2a210914c8",request_protocol="http",response_flags="-",grpc_response_status="",connection_security_policy="mutual_tls",source_canonical_service="podinfo",destination_canonical_service="podinfo",source_canonical_revision="latest",destination_canonical_revision="latest",le="0.5"} 10istio_request_duration_milliseconds_bucket{response_code="200",reporter="destination",source_workload="podinfo",source_workload_namespace="test",source_principal="spiffe://cluster.local/ns/test/sa/default",source_app="podinfo",source_version="unknown",source_cluster="c199d81d4e3104a5d90254b2a210914c8",destination_workload="podinfo",destination_workload_namespace="test",destination_principal="spiffe://cluster.local/ns/test/sa/default",destination_app="podinfo",destination_version="unknown",destination_service="podinfo.test.svc.cluster.local",destination_service_name="podinfo",destination_service_namespace="test",destination_cluster="c199d81d4e3104a5d90254b2a210914c8",request_protocol="http",response_flags="-",grpc_response_status="",connection_security_policy="mutual_tls",source_canonical_service="podinfo",destination_canonical_service="podinfo",source_canonical_revision="latest",destination_canonical_revision="latest",le="1"} 10
...
3 确认采集(Prometheus)
最后,我们验证Envoy生成的监控指标数据,是否被Prometheus实时采集上来。对外暴露Prometheus服务,并使用浏览器请求该服务。然后在查询框输入istio_requests_total
,得到结果如下图所示。
原文链接
本文为阿里云原创内容,未经允许不得转载。
Flagger on ASM·基于Mixerless Telemetry实现渐进式灰度发布系列 1 遥测数据相关推荐
- Flagger on ASM——基于Mixerless Telemetry实现渐进式灰度发布系列 1 遥测数据
简介:服务网格ASM的Mixerless Telemetry技术,为业务容器提供了无侵入式的遥测数据.遥测数据一方面作为监控指标被ARMPS/prometheus采集,用于服务网格可观测性:另一方面被 ...
- Flagger on ASM——基于Mixerless Telemetry实现渐进式灰度发布系列 3 渐进式灰度发布
简介:作为CNCF[成员](https://landscape.cncf.io/card-mode?category=continuous-integration-delivery&group ...
- Flagger on ASM——基于Mixerless Telemetry实现渐进式灰度发布系列 2 应用级扩缩容
简介:应用级扩缩容是相对于运维级而言的.像监控CPU/内存的利用率就属于应用无关的纯运维指标,针对这种指标进行扩缩容的HPA配置就是运维级扩缩容.而像请求数量.请求延迟.P99分布等指标就属于应用相关 ...
- Istio服务网格进阶③:基于Istio服务网格实现灰度发布机制
基于Istio服务网格实现灰度发布机制 文章目录 基于Istio服务网格实现灰度发布机制 1.应用程序主流发布方案 1.1.蓝绿发布 1.2.滚动发布 1.3.灰度发布 1.4.A/B测试发布 2.I ...
- 基于 Nginx+lua+Memcache 实现灰度发布
点击上方蓝色"方志朋",选择"设为星标" 回复"666"获取独家整理的学习资料! 一.灰度发布原理说明 灰度发布在百度百科中解释: 灰度发布 ...
- 基于 Istio 的全链路灰度方案探索和实践
作者|曾宇星(宇曾) 审核&校对:曾宇星(宇曾) 编辑&排版:雯燕 背景 微服务软件架构下,业务新功能上线前搭建完整的一套测试系统进行验证是相当费人费时的事,随着所拆分出微服务数量的不 ...
- 基于Metronic的Bootstrap开发框架经验总结(7)--数据的导入、导出及附件的查看处理...
在很多系统模块里面,我们可能都需要进行一定的数据交换处理,也就是数据的导入或者导出操作,这样的批量处理能给系统用户更好的操作体验,也提高了用户录入数据的效率.我在较早时期的EasyUI的Web框架上, ...
- 混合云存储组合拳:基于云存储网关与混合云备份的OSS数据备份方案
前言 阿里云对象存储(OSS)用户众多.很多用户因为业务或者合规性需求,需要对OSS内的数据做备份,无论是线上备份,还是线下备份.用户可以选择使用OSS的开放API,按照业务需求,做数据的备份,也可以 ...
- 《基于Windows 7特性的程序开发系列》视频分享
前一阵录制了<基于Windows 7特性的程序开发系列>视频课程,主要针对WinForm.WPF 开发具有Windows 7 特性的程序.现已发布到MSDN Webcast 欢迎大家拍砖. ...
最新文章
- Linux下通过进程名查询占用的端口
- Django项目--web聊天室
- 变阻尼汽车悬架振动自适应控制方法分析
- IT工程师必备的认证
- Python汉诺塔问题
- Shell入门(一)之简介
- 【Kafka】Kafka Failed to send SSL Close message IOException: Broken pipe
- “技术需求”与“技术成果”项目之间关联度计算模型top1
- 3层b+树索引访问磁盘次数_深入理解MySQL索引底层实现原理丨技术干货
- 享元模式在文本编辑器中的应用
- 【转】android题目
- 1462 通往奥格瑞玛的道路
- unity中使用C#语言判断斗地主出牌牌型
- 利用公式求sinx近似值(x:弧度)
- 时尚行业的二维码应用!2021 全新流行趋势
- python学习(25) BeautifulSoup介绍和实战
- 学习笔记之在eclipse中,使用ADT开发
- 因子图优化原理(iSAM、iSAM2论文解析)
- 张家界市4月份计算机职称,2017年4月张家界计算机应用能力考试报名时间4月10日起...
- bzoj1412: [ZJOI2009]狼和羊的故事(最小割)
热门文章
- c语言死循环中输入字符,如下代码,如果输入字符,为什么会造成死循环?
- fopen吃内存吗 php,file_get_contents = PHP致命错误:允许的内存耗尽
- treeselect只选了分支节点全选_vue Treeselect 树形下拉框:获取选中节点的ids和lables操作...
- smart原则_为什么现在少有人用德鲁克的SMART原则做目标管理了?
- php redis与me m,Redis(十) —— 为php增加redis扩展
- git保存账号密码_Altium Designer 通过Git实现版本控制
- python爬虫隐藏ip_Python3网络爬虫之使用User Agent和代理IP隐藏身份
- 蔡天西:去麻省理工,发现找不到一个能“打”的
- 4位院士的4个正确决定,成功扭转疫情!建议人人都该知道
- 大学数学不好是一种什么体验?