昨天因为需求,所以需要部署新的环境,然后就创建了kubenetes,想着还是使用rancher来管理来着,但是在导入rancher的时候总是报错:websocket: bad handshake,百度了很久,有的说是因为插件的问题,有的说是计算机名的问题,还有的说是rancher的底层问题。但是我前段时间确实使用的同一个版本的rancher和kubenetes做导入是没有任何问题的。都正常了。没办法,只能一个一个的找了,我发现kubenetes中的pod无法和我node节点同一个网段的节点通信,这个就比较出来了,原来pod不是跟所有node节点,只是和rancher这个服务的节点不能通行,其他都正常,而且rancher客户端的日志出现内容如下:
time="2021-07-01T02:50:54Z" level=info msg="Connecting to proxy" url="wss://172.16.199.10/v3/connect" time="2021-07-01T02:50:54Z" level=error msg="Failed to connect to proxy. Response status: 200 - 200 OK. Response body: node.management.cattle.io \"c-v9vms/m-f6d72960ed8a\" not found" error="websocket: bad handshake" time="2021-07-01T02:50:54Z" level=error msg="Remotedialer proxy error" error="websocket: bad handshake" time="2021-07-01T02:51:04Z" level=info msg="Connecting to wss://172.16.199.10/v3/connect with token xhhl6gdnj7849r4fqgbdkr56z24ck6kxkn8hkcmktdk2fklg98b94g" time="2021-07-01T02:51:04Z" level=info msg="Connecting to proxy" url="wss://172.16.199.10/v3/connect" time="2021-07-01T02:51:04Z" level=error msg="Failed to connect to proxy. Response status: 200 - 200 OK. Response body: node.management.cattle.io \"c-v9vms/m-f6d72960ed8a\" not found" error="websocket: bad handshake" time="2021-07-01T02:51:04Z" level=error msg="Remotedialer proxy error" error="websocket: bad handshake" time="2021-07-01T02:51:14Z" level=info msg="Connecting to wss://172.16.199.10/v3/connect with token xhhl6gdnj7849r4fqgbdkr56z24ck6kxkn8hkcmktdk2fklg98b94g" time="2021-07-01T02:51:14Z" level=info msg="Connecting to proxy" url="wss://172.16.199.10/v3/connect" time="2021-07-01T02:51:14Z" level=error msg="Failed to connect to proxy. Response status: 200 - 200 OK. Response body: node.management.cattle.io \"c-v9vms/m-f6d72960ed8a\" not found" error="websocket: bad handshake" time="2021-07-01T02:51:14Z" level=error msg="Remotedialer proxy error" error="websocket: bad handshake" time="2021-07-01T02:51:24Z" level=info msg="Connecting to wss://172.16.199.10/v3/connect with token xhhl6gdnj7849r4fqgbdkr56z24ck6kxkn8hkcmktdk2fklg98b94g" time="2021-07-01T02:51:24Z" level=info msg="Connecting to proxy" url="wss://172.16.199.10/v3/connect" time="2021-07-01T02:51:24Z" level=error msg="Failed to connect to proxy. Response status: 200 - 200 OK. Response body: node.management.cattle.io \"c-v9vms/m-f6d72960ed8a\" not found" error="websocket: bad handshake" time="2021-07-01T02:51:24Z" level=error msg="Remotedialer proxy error" error="websocket: bad handshake" time="2021-07-01T02:51:34Z" level=info msg="Connecting to wss://172.16.199.10/v3/connect with token xhhl6gdnj7849r4fqgbdkr56z24ck6kxkn8hkcmktdk2fklg98b94g" time="2021-07-01T02:51:34Z" level=info msg="Connecting to proxy" url="wss://172.16.199.10/v3/connect" time="2021-07-01T02:51:34Z" level=error msg="Failed to connect to proxy. Response status: 200 - 200 OK. Response body: node.management.cattle.io \"c-v9vms/m-f6d72960ed8a\" not found" error="websocket: bad handshake" time="2021-07-01T02:51:34Z" level=error msg="Remotedialer proxy error" error="websocket: bad handshake"
我尝试着在pod里去ping一下rancher的节点ip,不能通信,和其他的节点正常,这个问题就比较明显了,rancher这个节点有问题。下面继续分析,在rancher这个服务上的docker的ip地址和node节点的ip地址是一个网段的,有冲突了。修改一下docker的节点ip端。
vim /etc/docker/daemon.json { "bip":"192.168.0.1/24" }
我这里docker默认的网断和宿主机是一个网段的,这里做一下修改,然后重启一下docker,在重新试一下问题解决。
您可以选择一种方式赞助本站
支付宝扫一扫赞助
微信钱包扫描赞助
赏