![无法将 k3s agent 加入到 k3s server](https://linux22.com/image/757372/%E6%97%A0%E6%B3%95%E5%B0%86%20k3s%20agent%20%E5%8A%A0%E5%85%A5%E5%88%B0%20k3s%20server.png)
我使用 Ubuntu 18.04 在 AWS 上创建了 K3S master,如下所示:
K3S 主服务器 IP=54.252.228.96
ubuntu@ip-10-0-0-62:~$ curl -sfL https://get.k3s.io | sh -
sudo kubectl get nodes
ip-10-0-0-62 Ready master 11s v1.18.8+k3s1
我在 Azure 上创建了另一个节点并安装了 K3S 代理,如下所示
azureuser@k3-worker-node-01:~$ export NODE_TOKEN=K10e5ae49a964b013769ddd64f6541fc89de8eae6ec18ae5a6cdb432dfc59146226::server:b08cc8be4a07986ac1d062e9061ca74b
azureuser@k3-worker-node-01:~$ curl -sfL https://get.k3s.io | K3S_URL=https://54.252.228.96:6443 K3S_TOKEN=$NODE_TOKEN sh -
K3S Worker 节点 IP=52.243.64.166
更多详情Azure 工作器节点
root@k3s-worker-node-01:/var/lib/rancher/k3s/agent# hostname
k3s-worker-node-01
root@k3s-worker-node-01:/var/lib/rancher/k3s/agent# curl ifconfig.io
52.243.64.166
但是,我没有看到主节点显示工作节点(Azure)...请注意:我可以看到我的节点从 AWS 加入到 AWS K3S Master!
ubuntu@ip-10-0-0-62:~$ sudo kubectl get nodes
NAME STATUS ROLES AGE VERSION
ip-10-0-0-45 NotReady <none> 99m v1.18.8+k3s1
ip-10-0-0-62 Ready master 4h27m v1.18.8+k3s1
ip-10-0-0-52 Ready <none> 136m v1.18.8+k3s1
Azure 工作节点上的日志
**/var/log/syslog**
Sep 14 16:54:29 k3s-worker-node-01 k3s[2279]: time="2020-09-14T16:54:29.923739251Z" level=info msg="Connecting to proxy" url="wss://10.0.0.62:6443/v1-k3s/connect"
Sep 14 16:56:40 k3s-worker-node-01 k3s[2279]: time="2020-09-14T16:56:40.091361388Z" level=error msg="Failed to connect to proxy" error="dial tcp 10.0.0.62:6443: connect: connection timed out"
Sep 14 16:56:40 k3s-worker-node-01 k3s[2279]: time="2020-09-14T16:56:40.091404188Z" level=error msg="Remotedialer proxy error" error="dial tcp 10.0.0.62:6443: connect: connection timed out"
Sep 14 16:56:45 k3s-worker-node-01 k3s[2279]: time="2020-09-14T16:56:45.091592445Z" level=info msg="Connecting to proxy" url="wss://10.0.0.62:6443/v1-k3s/connect"
Sep 14 16:58:55 k3s-worker-node-01 k3s[2279]: time="2020-09-14T16:58:55.259345192Z" level=error msg="Failed to connect to proxy" error="dial tcp 10.0.0.62:6443: connect: connection timed out"
Sep 14 16:58:55 k3s-worker-node-01 k3s[2279]: time="2020-09-14T16:58:55.259417391Z" level=error msg="Remotedialer proxy error" error="dial tcp 10.0.0.62:6443: connect: connection timed out"
Sep 14 16:59:00 k3s-worker-node-01 k3s[2279]: time="2020-09-14T16:59:00.259623743Z" level=info msg="Connecting to proxy" url="wss://10.0.0.62:6443/v1-k3s/connect"
Sep 14 17:01:10 k3s-worker-node-01 k3s[2279]: time="2020-09-14T17:01:10.427330511Z" level=error msg="Failed to connect to proxy" error="dial tcp 10.0.0.62:6443: connect: connection timed out"
Sep 14 17:01:10 k3s-worker-node-01 k3s[2279]: time="2020-09-14T17:01:10.427378010Z" level=error msg="Remotedialer proxy error" error="dial tcp 10.0.0.62:6443: connect: connection timed out"
Sep 14 17:01:15 k3s-worker-node-01 k3s[2279]: time="2020-09-14T17:01:15.427601475Z" level=info msg="Connecting to proxy" url="wss://10.0.0.62:6443/v1-k3s/connect"
AWS K3S Master 上的安全组如下: 入站
请帮助我,为什么我无法使基本的东西正常工作。
附言:感谢 Marat 的坚持!
AWS 工作节点正在工作
ubuntu@ip-10-0-0-52:~$ sudo su -
root@ip-10-0-0-52:~# ss -tulnp
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
udp UNCONN 0 0 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=918,fd=12))
udp UNCONN 0 0 10.0.0.52%eth0:68 0.0.0.0:* users:(("systemd-network",pid=894,fd=17))
udp UNCONN 0 0 0.0.0.0:8472 0.0.0.0:*
tcp LISTEN 0 128 127.0.0.1:10249 0.0.0.0:* users:(("k3s-agent",pid=2393,fd=136))
tcp LISTEN 0 128 0.0.0.0:31760 0.0.0.0:* users:(("k3s-agent",pid=2393,fd=127))
tcp LISTEN 0 128 127.0.0.1:10256 0.0.0.0:* users:(("k3s-agent",pid=2393,fd=133))
tcp LISTEN 0 128 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=918,fd=13))
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=1301,fd=3))
tcp LISTEN 0 128 127.0.0.1:44793 0.0.0.0:* users:(("k3s-agent",pid=2393,fd=5))
tcp LISTEN 0 128 127.0.0.1:10010 0.0.0.0:* users:(("containerd",pid=2429,fd=9))
tcp LISTEN 0 128 127.0.0.1:6010 0.0.0.0:* users:(("sshd",pid=2197,fd=10))
tcp LISTEN 0 128 0.0.0.0:31838 0.0.0.0:* users:(("k3s-agent",pid=2393,fd=126))
tcp LISTEN 0 128 127.0.0.1:10248 0.0.0.0:* users:(("k3s-agent",pid=2393,fd=55))
tcp LISTEN 0 128 *:10250 *:* users:(("k3s-agent",pid=2393,fd=61))
tcp LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=1301,fd=4))
tcp LISTEN 0 128 [::1]:6010 [::]:* users:(("sshd",pid=2197,fd=9))
Azure 工作节点不起作用
root@k3s-worker-node-01:~# ss -tulnp
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
udp UNCONN 0 0 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=872,fd=12))
udp UNCONN 0 0 172.16.0.6%eth0:68 0.0.0.0:* users:(("systemd-network",pid=842,fd=19))
tcp LISTEN 0 4096 127.0.0.1:45177 0.0.0.0:* users:(("k3s-agent",pid=2279,fd=5))
tcp LISTEN 0 4096 127.0.0.1:10010 0.0.0.0:* users:(("containerd",pid=2306,fd=9))
tcp LISTEN 0 128 127.0.0.1:6010 0.0.0.0:* users:(("sshd",pid=2059,fd=10))
tcp LISTEN 0 128 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=872,fd=13))
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=1471,fd=3))
tcp LISTEN 0 128 [::1]:6010 [::]:* users:(("sshd",pid=2059,fd=9))
tcp LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=1471,fd=4))
root@k3s-worker-node-01:~#