kubernetes v1.7.1 kubeadm join hostname "" could not be reached error
Asked Answered
C

3

7

Today I recreated my cluster with v1.7.1 when I run the kubeadm join --token 189518.c21306e71082d6ec command, it giving the below error. this used work in previous version of kubernetes. Is something changed in this version, How do we resolve this?

[root@k8s17-02 ~]# kubeadm join --token 189518.c21306e71082d6ec 192.168.15.91:6443
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
[preflight] Running pre-flight checks
[preflight] WARNING: hostname "" could not be reached
[preflight] WARNING: hostname "" lookup : no such host
[preflight] Some fatal errors occurred:
        hostname "" a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
[preflight] If you know what you are doing, you can skip pre-flight checks with `--skip-preflight-checks`

update on 7/21/17

Tested this with v1.7.2 same issue still.

# ./kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.2", GitCommit:"922a86cfcd65915a9b2f69f3f193b8907d741d9c", GitTreeState:"clean", BuildDate:"2017-07-21T08:08:00Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}

# ./kubeadm join --token 189518.c21306e71082d6ec 192.168.15.91:6443
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
[preflight] Running pre-flight checks
[preflight] WARNING: hostname "" could not be reached
[preflight] WARNING: hostname "" lookup : no such host
[preflight] Some fatal errors occurred:
        hostname "" a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
[preflight] If you know what you are doing, you can skip pre-flight checks with `--skip-preflight-checks`

Thanks SR

Clockwise answered 15/7, 2017 at 2:1 Comment(7)
Maybe the argument parser is a bit buggy with this release. Did you try 'kubeadm join 192.168.15.91:6443 --token 189518.c21306e71082d6ec' ?Cardboard
What version were you using before? The message comes from github.com/kubernetes/kubernetes/commit/…Carmelcarmela
beforeI used v1.7.0. also some other machines I was able configure version 1.6.4 also.Clockwise
Maybe related to github.com/kubernetes/kubeadm/issues/64Komsomol
Any update on this? I'm facing the same issue.Inconvenience
@Clockwise Did you manage to resolve it somehow?Inconvenience
since i know my server config is good. I skipped preflight checks. ` kubeadm join --skip-preflight-checks --token 189518.c21306e71082d6ec 192.168.15.91:6443`Clockwise
W
5

Looks like it's trying to look up the hostname and can't because it's not in DNS. There are two ways around this:

  1. Kubernetes works better with named nodes. While this is annoying, it provides benefits in the long run, such as when you have to use different IP addresses on a reboot. You could edit /etc/hosts on each machine to give names to all the boxes in your cluster, or start up a local DNS, adding the names to that.
  2. Or, you could try skipping the preflight checks... kubeadm join --skip-preflight-checks --token TOKEN HOST:PORT
Weekend answered 17/7, 2017 at 13:44 Comment(2)
my host file has the correct IPand hostname listed. it worked for v1.7 and older versions. Its giving error only in v1.7.1, looks like some logic changed in new version. if you look at the message, it not getting the hostname, its empty.Clockwise
have you tried referring to the box not by its IP address but instead by its hostname in /etc/hosts?Weekend
U
2

According to #49065 GitHub issue, this will be fixed in 1.7.2, until then, recommendation is to use --skip-preflight-checks flag. That worked for me.

Uncommercial answered 19/7, 2017 at 17:46 Comment(1)
Good news. I compared code from V1.7.0 to V1.7.1. I didn't see any changes in the kubeadm code validating the hostname.Clockwise
A
0

I would like to confirm that this should problem only on v1.7.1. That I'm also found this problem on GCloud lab. My solution now is roll state to use V1.7.0 that if find. Please kindly see step test below:

====================================================

Lab Description (All node had been install docker/kubelet/kubectl/kubeadm):
Machine name Roles: IP Address:
kubeserve-ms Master 192.168.99.200
kubeserve-1 NodePort 192.168.99.201
kubeserve-2 NodePort 192.168.99.202

===================================================

1.(kubeserve_ms) initial cluster by command (su to root):
kubeadm init --pod-network-cidr=10.244.0.0/16 --token 8c2350.f55343444a6ffc46

2. (kubeserve_ms) setup run cluster system by command (Regular User):
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
3. (kubeserve_ms) init cluster by command:
sudo su -
kubeadm init --pod-network-cidr=10.244.0.0/16 --token 8c2350.f55343444a6ffc46
4.(kubeserve_ms) apply weave network module by command:
kubectl apply -n kube-system -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
5. (kubeserve-1,kuberserve-2) start join node by command:
kubeadm --token 8c2350.f55343444a6ffc46 join 192.168.99.200:6443
Result
kubeadm join kubernetes-ms:6443 --token 8c2350.f55343444a6ffc46
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
[preflight] Running pre-flight checks
[preflight] WARNING: docker version is greater than the most recently validated version. Docker version: 17.06.0-ce. Max validated version: 1.12
[preflight] WARNING: hostname "" could not be reached
[preflight] WARNING: hostname "" lookup : no such host
[preflight] Some fatal errors occurred: hostname "" a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is 'a-z0-9?(.a-z0-9?)*')
[preflight] If you know what you are doing, you can skip pre-flight checks with --skip-preflight-checks

Solution for workaround now:
Install "kubelet","kubeadm","kubectl" with version 1.7.0 everything is workfine

Astrogation answered 18/7, 2017 at 15:29 Comment(2)
v1.7.2 - released we need to test this.Clockwise
I'm using kubeadm v1.7.2. Having same issue.Mercymerdith

© 2022 - 2024 — McMap. All rights reserved.