https://rancher.com/docs/rancher/v2.x/en/
https://rancher.com/docs/rancher/v2.x/en/overview/architecture-recommendations/
https://rancher.com/docs/rancher/v2.x/en/quick-start-guide/deployment/quickstart-manual-setup/
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
第一次打开:https://172.0.11.153/
设置管理员密码,url 之后进入网页界面:
通过Rancher 创建一个集群:
From the Clusters page, click Add Cluster.
Choose Custom.
Enter a Cluster Name.
Skip Member Roles and Cluster Options. We’ll tell you about them later.
Click Next.
From Node Role, select all the roles: etcd, Control, and Worker.
Optional: Rancher auto-detects the IP addresses used for Rancher communication and cluster communication. You can override these using
Public Address
andInternal Address
in the Node Address section.Skip the Labels stuff. It’s not important for now.
Copy the command displayed on screen to your clipboard. (来到这一步之后,将页面上显示的命令,到各个node上去执行,比如你是想将vm1,vm2,vm3 通过rancher创建成一个集群,那么,到vm1-3 上去执行这些命令,这些设备必须提前装好docker )
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.
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
修改完registry-mirrors之后,重启docker
root@vm64:/etc/docker# cat daemon.json { "registry-mirrors": ["https://xxxx.mirror.aliyuncs.com"] } systemctl daemon-reload systemctl restart docker
两个节点都重启之后,刷新rancher 界面会发现,集群页面的部署进展一直在滚动,表明刚刚的修改生效。
No Leanote account? Sign up now.