Rancher 2.x
2020-03-13 09:44:33    6899    0    0







sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher

当启动后无法访问查看容器log,发现以下error 时,加一个--privileged

Error: rancher can not be ran without --privileged flag outside kubernetes.

docker container ls
docker container logs 3aa2569cda85
docker container stop 3aa2569cda85
docker run --privileged -d  --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher
docker container logs c554478d2aaa554565d29bf2ef6a32b45f920592b719057f7e8722bf6b6d559e​




设置管理员密码,url 之后进入网页界面:

 通过Rancher 创建一个集群:

  1. From the Clusters page, click Add Cluster.

  1. Choose Custom.

  2. Enter a Cluster Name.

  3. Skip Member Roles and Cluster Options. We’ll tell you about them later.

  4. Click Next.

  5. From Node Role, select all the roles: etcd, Control, and Worker.

  6. Optional: Rancher auto-detects the IP addresses used for Rancher communication and cluster communication. You can override these using Public Address and Internal Address in the Node Address section.

  7. Skip the Labels stuff. It’s not important for now.

  8. Copy the command displayed on screen to your clipboard. (来到这一步之后,将页面上显示的命令,到各个node上去执行,比如你是想将vm1,vm2,vm3 通过rancher创建成一个集群,那么,到vm1-3 上去执行这些命令,这些设备必须提前装好docker )

  9. Log in to your Linux host using your preferred shell, such as PuTTy or a remote Terminal connection. Run the command copied to your clipboard.

  10. When you finish running the command on your Linux host, click Done.





Pre-pulling kubernetes images:


点进集群之后,发现集群一直在准备中,没有就绪,处在“Pre-pulling kubernetes images”的过程中没有进展,可能是网络原因无法pull 相关镜像,在daemon 中增加一个阿里的加速镜像链接。

获取阿里mirror 的方法,登录进官网https://cr.console.aliyun.com/#/accelerator,在加速镜像中copy 自己的链接http://xxxxxxxx.m.daocloud.io​

root@vm64:/etc/docker# cat daemon.json 
        "registry-mirrors": ["https://xxxx.mirror.aliyuncs.com"]
systemctl daemon-reload
systemctl  restart docker

两个节点都重启之后,刷新rancher 界面会发现,集群页面的部署进展一直在滚动,表明刚刚的修改生效。




Pre: k8s集群中常见问题

Next: 使用 cloudinit 在初始化安装qcow2 时 个性化修改

Sign in to leave a comment.
No Leanote account? Sign up now.
Table of content