Closed gyliu513 closed 3 years ago
@gyliu513 could you try to run nslookup cluster-sample-apiserver
and share the output?
@charleszheng44 it appears macOS doesn't support HOSTALIASES
- https://apple.stackexchange.com/questions/356972/how-can-i-make-macos-respect-hostaliases-environment-variable
/kind bug
@christopherhein @charleszheng44 seems Linux also does not work.
root@gyliu-dev21:~/go/src/github.com/kubernetes-sigs# cat /root/.hosts
127.0.0.1 cluster-sample-apiserver
root@gyliu-dev21:~/go/src/github.com/kubernetes-sigs# env | grep HOST
HOSTALIASES=/root/.hosts
root@gyliu-dev21:~/go/src/github.com/kubernetes-sigs# nslookup cluster-sample-apiserver
Server: 172.16.200.52
Address: 172.16.200.52#53
** server can't find cluster-sample-apiserver: NXDOMAIN
root@gyliu-dev21:~/go/src/github.com/kubernetes-sigs# kubectl --kubeconfig kubeconfig get all -A
Unable to connect to the server: dial tcp: lookup cluster-sample-apiserver on 172.16.200.52:53: no such host
Interesting, yeah I think we just need to have this say the instructions (for now) should tell you to just add it to /etc/hosts
so it will actually work or at least that is what I do.
Thanks @christopherhein , /etc/hosts works for me, but not sure why nslookup cluster-sample-apiserver
always failed.
Any side impact if we update /etc/hosts
?
root@gyliu-dev21:~/go/src/github.com/kubernetes-sigs# kubectl --kubeconfig kubeconfig get all -A
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default service/kubernetes ClusterIP 10.32.0.1 <none> 443/TCP 159m
root@gyliu-dev21:~/go/src/github.com/kubernetes-sigs# nslookup cluster-sample-apiserver
Server: 172.16.200.52
Address: 172.16.200.52#53
** server can't find cluster-sample-apiserver: NXDOMAIN
root@gyliu-dev21:~/go/src/github.com/kubernetes-sigs# cat /etc/hosts
127.0.0.1 localhost
127.0.0.1 cluster-sample-apiserver
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.16.164.91 gyliu-dev21.fyre.ibm.com gyliu-dev21
Seems like nslookup
does purely DNS resolution but when you just add to the hosts file that's not populated in DNS. For /etc/hosts
you should use ping
or at least that's what https://askubuntu.com/questions/627906/why-is-my-etc-hosts-file-not-queried-when-nslookup-tries-to-resolve-an-address says.
@charleszheng44 ^^