kubernetes master 6443连接被其他主机拒绝

时间:2018-07-02 15:12:24

标签: kubernetes flannel

我似乎无法让节点加入集群。

[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]

端口似乎已关闭(从节点开始):

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

在母版上:

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.

这可能是什么原因?

2 个答案:

答案 0 :(得分:1)

两台机器都是虚拟机,而NAT ip是10.02.15-两台机器都是相同的(它们是独立的)...

叹息...

如果对其他人有帮助,

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

答案 1 :(得分:1)

如果您正在VM上运行(例如使用vagrant和virtual box),请使用vagrant文​​件中使用的专用IP运行init命令。因此,如果您在节点上使用join命令,则可以访问它,否则不能。

  

语法: kubeadm init   --apiserver-advertise-address =私有IP地址

     

示例:kubeadm init --apiserver-advertise-address = 192.168.33.50