rancher初始化k8s由于主机名不规范导致异常

概述

  • 部署rancher/rancher
  • 通过rancher-ui初始化k8s

日志

rancher-agent //logs

INFO: Arguments: --server https://172.16.1.69 --token REDACTED --ca-checksum 5e5f7cbe78a0a34e3df0c31c6b2c9bc2421e1f11469f4d29b8523b64d0073630 --etcd --controlplane --worker
INFO: Environment: CATTLE_ADDRESS=172.16.0.140 CATTLE_INTERNAL_ADDRESS= CATTLE_NODE_NAME=pet_k8s_master CATTLE_ROLE=,etcd,worker,controlplane CATTLE_SERVER=https://172.16.1.69 CATTLE_TOKEN=REDACTED
INFO: Using resolv.conf: nameserver 223.5.5.5 nameserver 172.16.0.2 nameserver 8.8.8.8
INFO: https://172.16.1.69/ping is accessible
INFO: Value from https://172.16.1.69/v3/settings/cacerts is an x509 certificate
time="2020-09-07T10:34:04Z" level=info msg="Rancher agent version v2.4.5 is starting"
time="2020-09-07T10:34:04Z" level=info msg="Option requestedHostname=pet_k8s_master"     //主机名不规范,不符合dns域名规范
time="2020-09-07T10:34:04Z" level=info msg="Option customConfig=map[address:172.16.0.140 internalAddress: label:map[] roles:[etcd worker controlplane] taints:[]]"
time="2020-09-07T10:34:04Z" level=info msg="Option etcd=true"
time="2020-09-07T10:34:04Z" level=info msg="Option controlPlane=true"
time="2020-09-07T10:34:04Z" level=info msg="Option worker=true"
time="2020-09-07T10:34:04Z" level=info msg="Listening on /tmp/log.sock"
time="2020-09-07T10:34:04Z" level=info msg="Connecting to wss://172.16.1.69/v3/connect with token cb8m9szbwjp2v8ddk5mmg26d64dphc4f9fsn5g7h5nrztfkrc5xcck"
time="2020-09-07T10:34:04Z" level=info msg="Connecting to proxy" url="wss://172.16.1.69/v3/connect"
time="2020-09-07T10:34:04Z" level=error msg="Failed to connect to proxy. Response status: 200 - 200 OK. Response body: node.management.cattle.io \"c-tmsv8/m-0edc6a1b0eff\" not found" error="websocket: bad handshake"
time="2020-09-07T10:34:04Z" level=error msg="Remotedialer proxy error" error="websocket: bad handshake"
time="2020-09-07T10:34:14Z" level=info msg="Connecting to wss://172.16.1.69/v3/connect with token cb8m9szbwjp2v8ddk5mmg26d64dphc4f9fsn5g7h5nrztfkrc5xcck"
time="2020-09-07T10:34:14Z" level=info msg="Connecting to proxy" url="wss://172.16.1.69/v3/connect"
time="2020-09-07T10:34:14Z" level=error msg="Failed to connect to proxy. Response status: 200 - 200 OK. Response body: node.management.cattle.io \"c-tmsv8/m-0edc6a1b0eff\" not found" error="websocket: bad handshake"
time="2020-09-07T10:34:14Z" level=error msg="Remotedialer proxy error" error="websocket: bad handshake"

问题解决

修改主机名及host

hostnamectl set-hostname pet-k8s-master

vi /etc/hosts
x.x.x.x  pet-k8s-master

删除本地运行的agent重新执行

注意image要加速使用国内加速地址

posted @ 2020-09-08 09:14  mvpbang  阅读(3421)  评论(0编辑  收藏  举报