本篇文章整理了,istio(版本是1.11.2+)数据面所使用的端口,以及他的健康检查,算是读书笔记,方便后续查找翻看。
1. istio数据面的组件介绍
pilot-agent:主要用来生成envoy启动使用的配置文件,证书相关的信息(可选),并且启动envoy。除此之外还作为代理与pilot-discovery之间交互XDS协议。
Envoy: 接收控制面下发的XDS配置,劫持业务流量(通常是iptables),并通过xds的配置进行路由转发、限流熔断等流量层面的管控,属于istio数据面的核心组件。
2. 数据面的网络端口介绍
摘自:https://istio.io/latest/docs/ops/deployment/requirements/
pilot-agent上面的接口:
15004和15020,特别说明一下15020与envoy上面的15090都是实现可观察性的监听端口,只不过15020里面还可以包含pilot-agent本身的可观察性数据的采集。
envoy上面的端口:
15001和15006是iptables的网络劫持端口
15000是envoy对应的主线程上面的命令和对话相关的接口
15008、15009都是证书相关的端口
15053:是DNS服务相关接口
15021:这个是Envoy健康检查的端口,稍后会特别讲下这部分内容
15090:envoy自身提供出去的采集可观察性指标的端口
3.envoy的健康检查介绍
envoy的生命周期检查在1.11.2版本上面已经从pilot-agent移除了,下放到了k8s本身来做,这里对应的也就是envoy的15021端口。
k8s的健康检查分为3种,分别是:
Liveness Probes:
The kubelet uses liveness probes to know when to restart a container.
For example, liveness probes could catch a deadlock,
where an application is running, but unable to make progress.
Restarting a container in such a state can help to make the application more available despite bugs.
Readiness Probes:
The kubelet uses readiness probes to know
when a container is ready to start accepting traffic.
A Pod is considered ready when all of its containers are ready.
One use of this signal is to control which Pods are used as backends for Services.
When a Pod is not ready, it is removed from Service load balancers.
Startup Probes:
The kubelet uses startup probes to know when a container application has started.
If such a probe is configured, it disables liveness and readiness checks until it succeeds,
making sure those probes don't interfere with the application startup.
This can be used to adopt liveness checks on slow starting containers,
avoiding them getting killed by the kubelet before they are up and running.
在istio中envoy往往会配置前两种方式,用来进行envoy的健康检查,一种用来检查envoy是不是还存活;另一种用来校验envoy是否启动完成,达到了接收数据的情况,如果达到了kubelet才会把它放到负载均衡器里面,让它可以接收流量。
备注:个人觉得pilot-agent之所以把envoy这个健康检查从自己维护还给k8s,主要是想借助k8s的调度能力,去决定到底要不要把流量从envoy所在的sidecar上面摘除。
参考文档:
https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
https://istio.io/latest/zh/docs/ops/configuration/mesh/app-health-check/
https://istio.io/latest/docs/ops/deployment/requirements/