12345kind: Servicespec:# clusterIP: None的即为`headless service` type: ClusterIP clusterIP: None
12345678910111213141516171819202122232425/ # nslookup consulnslookup: can't resolve '(null)': Name does not resolveName: consulAddress 1: 172.31.10.94 172-31-10-94.consul.default.svc.cluster.localAddress 2: 172.31.10.95 172-31-10-95.consul.default.svc.cluster.localAddress 3: 172.31.11.176 172-31-11-176.consul.default.svc.cluster.local/ # ping consulPING consul (172.31.10.94): 56 data bytes64 bytes from 172.31.10.94: seq=0 ttl=62 time=0.973 ms64 bytes from 172.31.10.94: seq=1 ttl=62 time=0.170 ms^C--- consul ping statistics ---2 packets transmitted, 2 packets received, 0% packet lossround-trip min/avg/max = 0.170/0.571/0.973 ms/ # ping consulPING consul (172.31.10.94): 56 data bytes64 bytes from 172.31.10.94: seq=0 ttl=62 time=0.206 ms64 bytes from 172.31.10.94: seq=1 ttl=62 time=0.178 ms^C--- consul ping statistics ---2 packets transmitted, 2 packets received, 0% packet lossround-trip min/avg/max = 0.178/0.192/0.206 ms
/ # nslookup consul
nslookup: can't resolve '(null)': Name does not resolve
Name: consul
Address 1: 172.30.15.52 consul.default.svc.cluster.local