--user=root 以root身份进入容器

--privileged=true 让docker 应用容器 获取宿主机root权限(特殊权限)
在这里插入图片描述
用root进入容器里就是docker exec -it --user=root 容器id /bin/bash

踩坑:加入主机后一直等待register

docker logs rancher容器查看日志:

time="2021-01-18T09:13:00Z" level=info msg="Connecting to proxy" url="wss://192.168.1.50:1443/v3/connect/register"
time="2021-01-18T09:13:00Z" level=error msg="Failed to connect to proxy. Response status: 200 - 200 OK. Response body: Operation cannot be fulfilled on nodes.management.cattl\": the object has been modified; please apply your changes to the latest version and try again" error="websocket: bad handshake"
time="2021-01-18T09:13:00Z" level=error msg="Remotedialer proxy error" error="websocket: bad handshake"
time="2021-01-18T09:13:44Z" level=info msg="Plan monitor checking 120 seconds"
time="2021-01-18T09:13:47Z" level=info msg="Plan monitor checking 120 seconds"
time="2021-01-18T09:13:56Z" level=info msg="Plan monitor checking 120 seconds"

看日志发现跟kubeletproxy有关,于是删掉相关容器,重新注册就好了。
删掉

docker rm nginx-proxy
docker rm share-mnt
docker rm kube-proxy
docker rm kubelet

有时候会出现这个报错,等一下就好了,不用管他:
在这里插入图片描述
实在不行就参考:https://www.freesion.com/article/4614705238/

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐