Update from Sync Service
This commit is contained in:
@@ -1,7 +1,55 @@
|
|||||||
==.==
|
# 在同一主机运行 Rancher Server 和 Agent
|
||||||
==在您想要使用单个节点运行Rancher并且能够将相同节点添加到集群的情况下,您必须调整为====rancher/rancher====容器映射的主机端口。==
|
|
||||||
==如果一个节点被添加到集群,它将部署使用端口80和443的ingress控制器。这与====rancher/rancher====容器默认映射的端口冲突。==
|
## 背景
|
||||||
==注意不建议在生产中把Rancher/Rancher和Rancher/Rancher-Agent运行在一台主机上,但可用于开发/演示。==
|
|
||||||
==要更改主机端口映射,替换====-p 80:80 -p 443:443====为====-p 8080:80 -p 8443:443====:==
|
当单个节点既作为 Rancher Server 又作为被管理的集群节点时,会有端口冲突:
|
||||||
docker run -d --restart=unless-stopped \ -p 8080:80 -p 8443:443 \ -v <主机路径>:/var/lib/rancher/ \ rancher/rancher:stable (或者rancher/rancher:latest)
|
|
||||||
> 来自 <[https://docs.rancher.cn/rancher2x/faqs/important-issue.html#_4-%E6%95%B0%E6%8D%AE%E6%8C%81%E4%B9%85](https://docs.rancher.cn/rancher2x/faqs/important-issue.html#_4-%E6%95%B0%E6%8D%AE%E6%8C%81%E4%B9%85)>
|
- Rancher Server 容器默认映射:`80` 和 `443`
|
||||||
|
- Rancher Agent 部署的 Ingress Controller 也使用:`80` 和 `443`
|
||||||
|
|
||||||
|
## 解决方案
|
||||||
|
|
||||||
|
修改 Rancher 容器的主机端口映射,避免冲突。
|
||||||
|
|
||||||
|
## 操作步骤
|
||||||
|
|
||||||
|
### 1. 停止现有 Rancher 容器
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker stop rancher
|
||||||
|
docker rm rancher
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 使用修改后的端口重新启动
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -d --restart=unless-stopped \
|
||||||
|
-p 8080:80 -p 8443:443 \
|
||||||
|
-v <主机路径>:/var/lib/rancher/ \
|
||||||
|
rancher/rancher:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
### 端口映射对照
|
||||||
|
|
||||||
|
| 原端口 | 新端口 | 说明 |
|
||||||
|
|--------|--------|------|
|
||||||
|
| 80 | 8080 | HTTP 入口 |
|
||||||
|
| 443 | 8443 | HTTPS 入口 |
|
||||||
|
|
||||||
|
### 3. 访问 Rancher
|
||||||
|
|
||||||
|
启动后通过新端口访问:
|
||||||
|
- HTTP:`http://<主机IP>:8080`
|
||||||
|
- HTTPS:`https://<主机IP>:8443`
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
> ⚠️ **不建议在生产环境中这样使用**,仅适合开发/演示环境。
|
||||||
|
|
||||||
|
生产环境建议:
|
||||||
|
- Rancher Server 单独部署
|
||||||
|
- 管理节点和 workload 节点分开
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> 参考:[Rancher 官方文档](https://docs.rancher.cn/rancher2x/faqs/important-issue.html)
|
||||||
|
|||||||
Reference in New Issue
Block a user