k8s headless service 的作用

通过headless service 可以轻松找到statefulSet 的所有节点。
特别是在部署集群的时候,很多服务需要配置节点信息来创建集群。

statefulSet.spec.serviceName
当serviceName 配置成与headless service的Name 相同的时候
可以通过 {hostName}.{headless service}.{namespace}.svc.cluster.local 解析出节点IP。
hostName 由 {statefulSet name}-{编号} 组成。

原文地址:https://www.cnblogs.com/pythonPath/p/12750180.html