kubernetes master 6443 connection refused from other hosts
Asked Answered
L

2

7

I can't seem to get a node to join the cluster.

[discovery] Trying to connect to API Server "10.0.2.15:6443"
[discovery] Created cluster-info discovery client, requesting info from "https://10.0.2.15:6443"
I0702 11:09:08.268102   10342 round_trippers.go:386] curl -k -v -XGET  -H "Accept: application/json, */*" -H "User-Agent: kubeadm/v1.11.0 (linux/amd64) kubernetes/91e7b4f" 'https://10.0.2.15:6443/api/v1/namespaces/kube-public/configmaps/cluster-info'
I0702 11:09:08.268676   10342 round_trippers.go:405] GET https://10.0.2.15:6443/api/v1/namespaces/kube-public/configmaps/cluster-info  in 0 milliseconds
I0702 11:09:08.268873   10342 round_trippers.go:411] Response Headers:
[discovery] Failed to request cluster info, will try again: [Get https://10.0.2.15:6443/api/v1/namespaces/kube-public/configmaps/cluster-info: dial tcp 10.0.2.15:6443: connect: connection refused]

The port seems closed (from the node):

telnet 10.0.2.15 6443
Trying 10.0.2.15...
telnet: Unable to connect to remote host: Connection refused

While on the master:

telnet 10.0.2.15 6443
Trying 10.0.2.15...
Connected to 10.0.2.15.
Escape character is '^]'.
^CConnection closed by foreign host.

What may be the cause of this?

Leadwort answered 2/7, 2018 at 15:12 Comment(1)
Have you deployed a CNI plugin?Jandy
L
6

Both machines are virtual machines and 10.02.15 is the NAT ip - which is the same for both machines (they are independent)...

Sigh...

In the event it is helpful to someone else:

iptables -t raw -A OUTPUT -p tcp --dport 6443 -j TRACE
iptables -t raw -A PREROUTING -p tcp --dport 6443 -j TRACE
tail -f /var/log/kern.log
Leadwort answered 2/7, 2018 at 17:40 Comment(0)
D
4

If you are running on VM (like using vagrant and virtual box) run init command with the private IP which is used in the vagrant file. So if you use join command on a node it is able to reach it else no.

Syntax: kubeadm init --apiserver-advertise-address=private-ip-address

Example: kubeadm init --apiserver-advertise-address=192.168.33.50

Davie answered 5/8, 2018 at 7:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.