4

k8s 之 endpoint

 1 year ago
source link: https://blog.51cto.com/u_12606610/5614159
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

k8s 之 endpoint

精选 原创

      endpoint是k8s集群中的一个资源对象,存储在etcd中,用来记录一个service对应的所有pod的访问地址。

service配置selector,endpoint controller才会自动创建对应的endpoint对象;否则,不会生成endpoint对象.

例如,k8s集群中创建一个名为hello的service,就会生成一个同名的endpoint对象,ENDPOINTS就是service关联的pod的ip地址和端口。

一个 Service 由一组 backend Pod 组成。

这些 Pod 通过 endpoints 暴露出来。

Service Selector 将持续评估,结果被 POST 到一个名称为 Service-hello 的 Endpoint 对象上。

当 Pod 终止后,它会自动从 Endpoint 中移除,新的能够匹配上 Service Selector 的 Pod 将自动地被添加到 Endpoint 中。

检查该 Endpoint,注意到 IP 地址与创建的 Pod 是相同的。

现在,能够从集群中任意节点上使用 curl 命令请求 hello Service

记录每个每个pod资源的地址

k8s 之 endpoint_service
k8s 之 endpoint_k8s_02
  • 打赏
  • 收藏
  • 评论
  • 分享
  • 举报

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK