修改rancher的端口,k8smaster加入不了集群

修改rancher端口号为10443,并且在rancherUI上修改rancherUL添加端口号,重启rancher以后,在k8s集群的master节点启动rancher-agent 第一次启动手动指定的参数为10443,命令如下,第二次自启动的rancher-agent日志显示server参数还是原来的443端口是怎么回事呢? 大神帮帮忙。。

sudo docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes  -v /var/run:/var/run registry.dlsc.com:18082/rancher/rancher-agent:v2.5.5 --server https://rancher.dlsc.sgcc.com:10443 --token  94hldsdfcjdkznl5mpj7hs9s8tqhkdnt --ca-checksum 1a65053f0820ebe55877f9dcaa ee88df2c671f379d --etcd --controlplane

日志 手动启动的rancher-agent日志

[yunwei@bj-dljy-k8s-149 ~]$ docker logs -f 37ad33a3b9ce
INFO: Arguments: --server https://rancher.dlsc.sgcc.com:10444 --token REDACTED --ca-checksum 1a65053f0820e 140d784aee88df2c671f379d --etcd --controlplane
INFO: Environment: CATTLE_ADDRESS=192.168.203.149 CATTLE_INTERNAL_ADDRESS= CATTLE_NODE_NAME=bj-dljy-k8s-149 CATTLE_ROLE=,etcd,controlplane CATTLE_SERVER=https://rancher.dlsc.sgcc.com:10444 CATTLE_TOKEN=REDACTED
INFO: Using resolv.conf: nameserver 192.168.203.156 nameserver 192.168.203.157
INFO: https://rancher.dlsc.sgcc.com:10444/ping is accessible
INFO: rancher.dlsc.sgcc.com resolves to 192.168.203.171
INFO: Value from https://rancher.dlsc.sgcc.com:10444/v3/settings/cacerts is an x509 certificate
time=“2022-11-26T09:44:30Z” level=info msg=“Listening on /tmp/log.sock”
time=“2022-11-26T09:44:30Z” level=info msg=“Rancher agent version v2.5.5 is starting”
time=“2022-11-26T09:44:30Z” level=info msg=“Option worker=false”
time=“2022-11-26T09:44:30Z” level=info msg=“Option requestedHostname=bj-dljy-k8s-149”
time=“2022-11-26T09:44:30Z” level=info msg=“Option customConfig=map[address:192.168.203.149 internalAddress: label:map roles:[etcd controlplane] taints:]”
time=“2022-11-26T09:44:30Z” level=info msg=“Option etcd=true”
time=“2022-11-26T09:44:30Z” level=info msg=“Option controlPlane=true”
time=“2022-11-26T09:44:30Z” level=info msg=“Connecting to wss://rancher.dlsc.sgcc.com:10444/v3/connect/register with token 646gkhvtzcstmw45k68s7w94hldsdfcjdkznl5mpj7hs9s8tqhkdnt”
time=“2022-11-26T09:44:30Z” level=info msg=“Connecting to proxy” url=“wss://rancher.dlsc.sgcc.com:10444/v3/connect/register”
time=“2022-11-26T09:44:32Z” level=info msg=“Starting plan monitor, checking every 120 seconds”

自动启动的rancher-agent日志
[yunwei@bj-dljy-k8s-149 ~]$ docker logs -f 6ea7f9fe11e3
INFO: Arguments: --server https://rancher.dlsc.sgcc.com:10443 --token REDACTED --ca-checksum 1a65053f0820ebe5 4aee88df2c671f379d --no-register --only-write-certs --node-name bj-dljy-k8s-149
INFO: Environment: CATTLE_ADDRESS=192.168.203.149 CATTLE_AGENT_CONNECT=true CATTLE_INTERNAL_ADDRESS= CATTLE_NODE_NAME=bj-dljy-k8s-149 CATTLE_SERVER=https://rancher.dlsc.sgcc.com:10443 CATTLE_TOKEN=REDACTED CATTLE_WRITE_CERT_ONLY=true
INFO: Using resolv.conf: nameserver 192.168.203.156 nameserver 192.168.203.157
ERROR: https://rancher.dlsc.sgcc.com:10443/ping is not accessible (Failed to connect to rancher.dlsc.sgcc.com port 10443: Connection timed out)
INFO: Arguments: --server https://rancher.dlsc.sgcc.com:10443 --token REDACTED --ca-checksum 1a65053f0820ebe55877f9dcaabb62d9473c2a62140d784aee88df2c671f379d --no-register --only-write-certs --node-name bj-dljy-k8s-149
INFO: Environment: CATTLE_ADDRESS=192.168.203.149 CATTLE_AGENT_CONNECT=true CATTLE_INTERNAL_ADDRESS= CATTLE_NODE_NAME=bj-dljy-k8s-149 CATTLE_SERVER=https://rancher.dlsc.sgcc.com:10443 CATTLE_TOKEN=REDACTED CATTLE_WRITE_CERT_ONLY=true
INFO: Using resolv.conf: nameserver 192.168.203.156 nameserver 192.168.203.157
ERROR: https://rancher.dlsc.sgcc.com:10443/ping is not accessible (Failed to connect to rancher.dlsc.sgcc.com port 10443: Connection timed out)
INFO: Arguments: --server https://rancher.dlsc.sgcc.com:10443 --token REDACTED --ca-checksum 1a65053f0820ebe55877f9dcaabb62d9473c2a62140d784aee88df2c671f379d --no-register --only-write-certs --node-name bj-dljy-k8s-149
INFO: Environment: CATTLE_ADDRESS=192.168.203.149 CATTLE_AGENT_CONNECT=true CATTLE_INTERNAL_ADDRESS= CATTLE_NODE_NAME=bj-dljy-k8s-149 CATTLE_SERVER=https://rancher.dlsc.sgcc.com:10443 CATTLE_TOKEN=REDACTED CATTLE_WRITE_CERT_ONLY=true
INFO: Using resolv.conf: nameserver 192.168.203.156 nameserver 192.168.203.157

程序自动启动的rancher-agent怎么端口和手动执行的端口不一致呢???

参考下面文章修改 rancher 的 IP 地址和端口

你好 k8s集群2个master执行了rke-clean.sh清理脚本了,apiserver sheduler controller都停止了,我想用rancher-agent重新装一下这些程序,手动启动的这个参数是没问题的 但是这个程序还会自启动一个rancher-agent 启动参数的server跟我手动启动的不一致,是需要再哪里配置吗

一个话题只讨论一个问题,建议把想下文和操作步骤重新提交到一个新话题总

好的

说的是一个问题呀 我再建一个话题

不是人说,Rancher 也太霸道了吧?我启动了一个Rancher 服务,只有映射的宿主机端口必须和Rancher 一致,docker run -d --name rancher --privileged --restart unless-stopped -p 80:80 -p 443:443 rancher/rancher:v2.5-head,像这样才能正常运行,如果我改一下映射端口比如:docker run -d --name rancher --privileged --restart unless-stopped -p 8000:80 -p 4430:443 rancher/rancher:v2.5-head,服务就启动不了了?不是,那我nginx怎么办?我其他服务怎么办?

你这也是奇怪,第一,你说起不来,也不发个日志,谁知道啥情况。第二,你用的 head 版本是开发版本,除了 rancher 的研发人员,几乎没人用这个版本。

我的环境,任意映射端口号都没问题