headless 一旦创建了 headless ,在 k8s 里便是全局的
root@spark-worker-dcpmm-statefulset-aep1-2:/# getent hostssparkthrift-headless
10.60.218.26sparkthrift-headless.spark-project.svc.cluster.local
root@spark-worker-dcpmm-statefulset-aep1-2:/#
root@spark-worker-dcpmm-statefulset-aep1-2:/#
root@spark-worker-dcpmm-statefulset-aep1-2:/# getent hostsworker-dcpmm-service
10.60.154.147worker-dcpmm-service.spark-project.svc.cluster.local
10.60.171.234worker-dcpmm-service.spark-project.svc.cluster.local
10.60.219.144worker-dcpmm-service.spark-project.svc.cluster.local
10.60.219.147worker-dcpmm-service.spark-project.svc.cluster.local
10.60.222.181worker-dcpmm-service.spark-project.svc.cluster.local
10.60.222.182worker-dcpmm-service.spark-project.svc.cluster.local
非 headless 看下普通service 的 情况
$ oc get svc
NAMETYPECLUSTER-IPEXTERNAL-IPPORT(S)AGE
nginxClusterIPNone80/TCP73d
spark-master-dcpmmClusterIP10.60.27.1917077/TCP,8080/TCP1d
spark-master-dcpmm-nodeportNodePort10.60.74.1597077:32100/TCP23h
worker-dcpmm-serviceClusterIPNone1888/TCP20h
【Kubernetes 之 headless】getent ,获取的是 CLUSTER-IP
bash-4.4# getent hosts spark-master-dcpmm
10.60.27.191spark-master-dcpmm.spark-project.svc.cluster.localspark-master-dcpmm.spark-project.svc.cluster.local spark-master-dcpmm
bash-4.4#
bash-4.4# getent hosts spark-master-dcpmm-nodeport
10.60.74.159spark-master-dcpmm-nodeport.spark-project.svc.cluster.localspark-master-dcpmm-nodeport.spark-project.svc.cluster.local spark-master-dcpmm-nodeport