Service Controller与Endpoints Controller

Endpoints Controller

Endpoints表示一个Service对应的所有Pod副本的访问地址Endpoints Controller就是负责生成和维护所有Endpoints对象的控制器。

Endpoints Controller负责监听Service和对应的Pod副本的变化。

  • 如果监测到Service被删除,则删除和该Service同名的Endpoints对象。

  • 如果监测到新的Service被创建或者修改,则根据该Service信息获得相关的Pod列表,然后创建或者更新Service对应的Endpoints对象。

  • 如果监测到Pod的事件,则更新它所对应的Service的Endpoints对象(增加、删除或者修改对应的Endpoint条目)。

Endpoints对象是在哪里被使用的呢?答案是每个Node上的kube-proxy进程,kube-proxy进程获取每个Service的Endpoints,实现了Service的负载均衡功能。

Service Controller

Service Controller其实是属于Kubernetes集群与外部的云平台之间的一个接口控制器

Service Controller监听Service的变化,如果该Service是一个LoadBalancer类型的Service(externalLoadBalancers=true),则Service Controller确保在外部的云平台上该Service对应的LoadBalancer实例被相应地创建、删除及更新路由转发表(根据Endpoints的条目)。

最后更新于