cloud-security-wiki/docs/ci-cd/rancher/README.md

51 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Rancher
Rancher 是供采用容器的团队使用的完整软件堆栈。它解决了管理多个Kubernetes集群的运营和安全挑战并为DevOps团队提供用于运行容器化工作负载的集成工具。简单来说是一个k8s的管理软件!
## 安装
rancher的latest版本是2.6以上,本次安装v2.4.15
```
docker run -d --privileged --restart=unless-stopped -p 80:80 -p 443:443 --privileged rancher/rancher:v2.4.15
```
访问(注意是https)
https://ip-server
输入admin 的密码
![1659861472908.png](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/fb2b9226948d4a1c8f418c637d843bde~tplv-k3u1fbpfcp-zoom-1.image)
点击下一步,设置rancher的访问url,如果有域名则填写域名
![1659861565669.png](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/a152c8f679ea4133a35ebc7d4fa2d792~tplv-k3u1fbpfcp-zoom-1.image)
进入管理页面
![1659861619139.png](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/b59e72f4933a49ca886f143d91d8c425~tplv-k3u1fbpfcp-zoom-1.image)
## 添加集群
点击右上角的添加集群
![1659861716608.png](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/f11c3112091e4dcf8a796bc3d7f1e1b3~tplv-k3u1fbpfcp-zoom-1.image)
选择自定义
![1659861756287.png](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/1f85561e78cd4da2b6faff2ac22d030f~tplv-k3u1fbpfcp-zoom-1.image)
配置集训信息
![1659861839152.png](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/63ec1b53ebd341f1b8d935669f711116~tplv-k3u1fbpfcp-zoom-1.image)
点击下一步进入添加节点页面,由于当前集群还没有节点,所以主机选项中的每一个角色都需要选择
![1659861949108.png](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/042325d209af4830840285ef8550b6ce~tplv-k3u1fbpfcp-zoom-1.image)
复制下方的命令到装有docker的主机中运行即可,注意rancher安装的主机和其他节点主机的**ip都必须为静态ip**,不然主机重启后集群就失效了,原因为主机重启后ip变更,k8s不能够通过ip找到对应的节点
![1659862145815.png](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/9ea0b40680144096aa7bab7b7c747c4a~tplv-k3u1fbpfcp-zoom-1.image)
集群正在添加节点(等待时间很漫长)
![1659862165132.png](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/1cc87a62468f46d88bc9f6d97ee7f803~tplv-k3u1fbpfcp-zoom-1.image)
添加完成
![1659862423973.png](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/35e4e436b4b9498d9c9fed01a26b5d56~tplv-k3u1fbpfcp-zoom-1.image)
![1659862458725.png](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/023794f8136646fe904989fb381d0795~tplv-k3u1fbpfcp-zoom-1.image)