How to give kubernetes node a host name that it can reach?

10/29/2019

I am trying to set up a one master and one node k8s cluster; however, when joining my node to my cluster via:

kubeadm join 10.1.3.238:6443 --token 2xm3il.sqjbsq7ebn5yaz4x \
    --discovery-token-ca-cert-hash sha256:7fb7e9ca3ee452928fd413bc3ecb4cb8bc50a99d52b73a39a5c758d240054c4e

it gives this output:

 [WARNING Hostname]: hostname "k8s-node1" could not be reached
 [WARNING Hostname]: hostname "k8s-node1": lookup k8s-node1 on 10.1.0.2:53: no such host

I have tried setting the hostname of the instances to k8s-master and k8s-node1 and I also added them to the etc/hosts file. When I : cat etc/hosts on my master I get:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

ip-10-1-3-16 k8s-node1
ip-10-1-3-16 k8s-master

and when I : cat etc/hosts on my worker I get:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
ip-10-1-3-16 k8s-node1
ip-10-1-3-16 k8s-master
-- James Ukilin
amazon-web-services
centos
hostname
kubernetes

0 Answers