mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-09-25 20:48:11 +00:00
Update v2.7 Chinese translation
This commit is contained in:
+19
-17
@@ -302,36 +302,38 @@ SUSE Linux may have a firewall that blocks all ports by default. To open the por
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="SLES 15 / openSUSE Leap 15">
|
||||
|
||||
1. SSH into the instance.
|
||||
1. Start YaST in text mode:
|
||||
```
|
||||
sudo yast2
|
||||
```
|
||||
```
|
||||
sudo yast2
|
||||
```
|
||||
|
||||
1. Navigate to **Security and Users** > **Firewall** > **Zones:public** > **Ports**. To navigate within the interface, follow the instructions [here](https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha-yast-text.html#sec-yast-cli-navigate).
|
||||
1. To open the required ports, enter them into the **TCP Ports** and **UDP Ports** fields. In this example, ports 9796 and 10250 are also opened for monitoring. The resulting fields should look similar to the following:
|
||||
```yaml
|
||||
TCP Ports
|
||||
22, 80, 443, 2376, 2379, 2380, 6443, 9099, 9796, 10250, 10254, 30000-32767
|
||||
UDP Ports
|
||||
8472, 30000-32767
|
||||
```
|
||||
```yaml
|
||||
TCP Ports
|
||||
22, 80, 443, 2376, 2379, 2380, 6443, 9099, 9796, 10250, 10254, 30000-32767
|
||||
UDP Ports
|
||||
8472, 30000-32767
|
||||
```
|
||||
|
||||
1. When all required ports are enter, select **Accept**.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="SLES 12 / openSUSE Leap 42">
|
||||
|
||||
1. SSH into the instance.
|
||||
1. Edit /`etc/sysconfig/SuSEfirewall2` and open the required ports. In this example, ports 9796 and 10250 are also opened for monitoring:
|
||||
```
|
||||
FW_SERVICES_EXT_TCP="22 80 443 2376 2379 2380 6443 9099 9796 10250 10254 30000:32767"
|
||||
FW_SERVICES_EXT_UDP="8472 30000:32767"
|
||||
FW_ROUTE=yes
|
||||
```
|
||||
```
|
||||
FW_SERVICES_EXT_TCP="22 80 443 2376 2379 2380 6443 9099 9796 10250 10254 30000:32767"
|
||||
FW_SERVICES_EXT_UDP="8472 30000:32767"
|
||||
FW_ROUTE=yes
|
||||
```
|
||||
1. Restart the firewall with the new ports:
|
||||
```
|
||||
SuSEfirewall2
|
||||
```
|
||||
```
|
||||
SuSEfirewall2
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ For Kubernetes v1.21 and up, the NGINX Ingress controller no longer runs in host
|
||||
|
||||
Because of this change to the controller, the default behavior no longer sets `hostNetwork` to `true`. However, you must set `hostNetwork` to `true` for TCP- and UDP-based Services to work.
|
||||
|
||||
:::note
|
||||
:::
|
||||
|
||||
## Specify a hostname to use
|
||||
|
||||
|
||||
+2
@@ -118,6 +118,8 @@ Your active configuration is: [default]
|
||||
|
||||
在选择 Kubernetes 版本时,请务必先查阅[支持矩阵](https://rancher.com/support-matrix/),以找出已针对你的 Rancher 版本验证的最新 Kubernetes 版本。
|
||||
|
||||
要使用 Rancher 成功创建 GKE 集群,GKE 必须处于 Standard 模式。GKE 在创建 Kubernetes 集群时有两种运行模式,分别是 Autopilot 和 Standard 模式。Autopilot 模式的集群配置对编辑 kube-system 命名空间有限制。但是,Rancher 在安装时需要在 kube-system 命名空间中创建资源。因此,你将无法在以 Autopilot 模式创建的 GKE 集群上安装 Rancher。如需详细了解 GKE Autopilot 模式和 Standard 模式之间的差异,请访问[比较 GKE Autopilot 和 Standard ](https://cloud.google.com/kubernetes-engine/docs/resources/autopilot-standard-feature-comparison)。
|
||||
|
||||
**注意**:如果 Kubernetes 的版本更新到 v1.22 或更高版本,则 ingress-nginx 的版本也需要[更新](https://kubernetes.github.io/ingress-nginx/#faq-migration-to-apiversion-networkingk8siov1)。
|
||||
|
||||
```
|
||||
|
||||
+23
@@ -1,6 +1,29 @@
|
||||
---
|
||||
title: 回滚
|
||||
---
|
||||
## 使用 Rancher 2.6.4+ 进行回滚的其他步骤
|
||||
|
||||
Rancher v2.6.4 将 cluster-api 模块从 v0.4.4 升级到 v1.0.2。反过来,cluster-api 的 v1.0.2 版本将集群 API 的自定义资源定义 (CRD) 从 `cluster.x-k8s.io/v1alpha4` 升级到 `cluster.x-k8s.io/v1beta1`。当你尝试将 Rancher v2.6.4 回滚到以前版本的 Rancher v2.6.x 时,CRD 升级到 v1beta1 会导致回滚失败。这是因为使用旧 apiVersion (v1alpha4) 的 CRD 与 v1beta1 不兼容。
|
||||
|
||||
要避免回滚失败,你需要在尝试恢复操作或回滚**之前**运行以下 Rancher 脚本:
|
||||
|
||||
* `verify.sh`:检查集群中是否有任何与 Rancher 相关的资源。
|
||||
* `cleanup.sh`:清理集群。
|
||||
|
||||
有关详细信息和源代码,请参阅 [rancher/rancher-cleanup repo](https://github.com/rancher/rancher-cleanup)。
|
||||
|
||||
:::caution
|
||||
|
||||
`cleanup.sh` 运行的时候会有停机时间,这是因为脚本会删除 Rancher 创建的资源。
|
||||
|
||||
:::
|
||||
|
||||
### 从 v2.6.4+ 回滚到较低版本的 v2.6.x
|
||||
|
||||
1. 按照[说明](https://github.com/rancher/rancher-cleanup/blob/main/README.md)运行脚本。
|
||||
1. 按照[说明](https://rancher.com/docs/rancher/v2.6/en/backups/migrating-rancher/)在现有集群上安装 rancher-backup Helm Chart 并恢复之前的状态。
|
||||
1. 省略步骤 3。
|
||||
1. 执行到步骤 4 时,在要回滚到的 local 集群上安装 Rancher 2.6.x 版本。
|
||||
|
||||
## 回滚到 Rancher 2.5.0+
|
||||
|
||||
|
||||
+24
-22
@@ -106,7 +106,7 @@ K3s server 需要开放端口 6443 才能供节点访问。
|
||||
|
||||
| 协议 | 端口 | 目标 | 描述 |
|
||||
|-----|-----|----------------|---|
|
||||
| TCP | 443 | `35.160.43.145`,`35.167.242.46`,`52.33.59.17` | Rancher catalog(git.rancher.io) |
|
||||
| TCP | 443 | git.rancher.io | Rancher catalog |
|
||||
| TCP | 22 | 使用 Node Driver 创建的任何节点 | Node Driver 通过 SSH 配置节点 |
|
||||
| TCP | 2376 | 使用 Node Driver 创建的任何节点 | Node Driver 使用的 Docker daemon TLS 端口 |
|
||||
| TCP | 6443 | 托管/导入的 Kubernetes API | Kubernetes API Server |
|
||||
@@ -135,16 +135,16 @@ RKE2 server 需要开放端口 6443 和 9345 才能供集群中的其他节点
|
||||
|
||||
| 协议 | 端口 | 源 | 描述 |
|
||||
|-----|-----|----------------|---|
|
||||
| TCP | 9345 | RKE2 Agent 节点 | Kubernetes API |
|
||||
| TCP | 9345 | RKE2 Server 和 Agent 节点 | 节点注册。需要在所有 Server 节点上将端口开放给集群中的所有其他节点。 |
|
||||
| TCP | 6443 | RKE2 Agent 节点 | Kubernetes API |
|
||||
| UDP | 8472 | RKE2 Server 和 Agent 节点 | 仅 Flannel VXLAN 需要 |
|
||||
| TCP | 10250 | RKE2 Server 和 Agent 节点 | kubelet |
|
||||
| TCP | 2379 | RKE2 Server 节点 | etcd 客户端端口 |
|
||||
| TCP | 2380 | RKE2 Server 节点 | etcd 对等端口 |
|
||||
| TCP | 30000-32767 | RKE2 Server 和 Agent 节点 | NodePort 端口范围 |
|
||||
| TCP | 30000-32767 | RKE2 Server 和 Agent 节点 | NodePort 端口范围。可以使用 TCP 或 UDP。 |
|
||||
| TCP | 5473 | Calico-node pod 连接到 typha pod | 使用 Calico 部署时需要 |
|
||||
| HTTP | 8080 | 执行外部 SSL 终止的负载均衡器/代理 | 使用外部 SSL 终止时的 Rancher UI/API |
|
||||
| HTTPS | 8443 | <ul><li>托管/注册的 Kubernetes</li><li>任何需要使用 Rancher UI 或 API 的源</li></ul> | Rancher Agent,Rancher UI/API,kubectl。如果负载均衡执行 TLS 终止,则不需要。 |
|
||||
| HTTP | 80 | 执行外部 SSL 终止的负载均衡器/代理 | 使用外部 SSL 终止时的 Rancher UI/API |
|
||||
| HTTPS | 443 | <ul><li>托管/注册的 Kubernetes</li><li>任何需要使用 Rancher UI 或 API 的源</li></ul> | Rancher Agent,Rancher UI/API,kubectl。如果负载均衡器执行 TLS 终止,则不需要。 |
|
||||
|
||||
所有出站流量通常都是允许的。
|
||||
</details>
|
||||
@@ -304,36 +304,38 @@ SUSE Linux 可能有一个防火墙,默认情况下会阻止所有端口。要
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="SLES 15 / openSUSE Leap 15">
|
||||
|
||||
1. SSH 进入实例。
|
||||
1. 以文本模式启动 YaST:
|
||||
```
|
||||
sudo yast2
|
||||
```
|
||||
```
|
||||
sudo yast2
|
||||
```
|
||||
|
||||
1. 导航到**安全和用户** > **防火墙** > **区域:公共** > **端口**。要在界面内导航,请参照[指示](https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha-yast-text.html#sec-yast-cli-navigate)。
|
||||
1. 要打开所需的端口,把它们输入到 **TCP 端口** 和 **UDP 端口** 字段。在这个例子中,端口 9796 和 10250 也被打开,用于监控。由此产生的字段应类似于以下内容:
|
||||
```yaml
|
||||
TCP Ports
|
||||
22, 80, 443, 2376, 2379, 2380, 6443, 9099, 9796, 10250, 10254, 30000-32767
|
||||
UDP Ports
|
||||
8472, 30000-32767
|
||||
```
|
||||
```yaml
|
||||
TCP Ports
|
||||
22, 80, 443, 2376, 2379, 2380, 6443, 9099, 9796, 10250, 10254, 30000-32767
|
||||
UDP Ports
|
||||
8472, 30000-32767
|
||||
```
|
||||
|
||||
1. 所有必须端口都输入后,选择**接受**。
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="SLES 12 / openSUSE Leap 42">
|
||||
|
||||
1. SSH 进入实例。
|
||||
1. 编辑 `/etc/sysconfig/SuSEfirewall2` 并打开所需的端口。在这个例子中,端口 9796 和 10250 也被打开,用于监控。
|
||||
```
|
||||
FW_SERVICES_EXT_TCP="22 80 443 2376 2379 2380 6443 9099 9796 10250 10254 30000:32767"
|
||||
FW_SERVICES_EXT_UDP="8472 30000:32767"
|
||||
FW_ROUTE=yes
|
||||
```
|
||||
```
|
||||
FW_SERVICES_EXT_TCP="22 80 443 2376 2379 2380 6443 9099 9796 10250 10254 30000:32767"
|
||||
FW_SERVICES_EXT_UDP="8472 30000:32767"
|
||||
FW_ROUTE=yes
|
||||
```
|
||||
1. 用新的端口重启防火墙:
|
||||
```
|
||||
SuSEfirewall2
|
||||
```
|
||||
```
|
||||
SuSEfirewall2
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
+19
-11
@@ -2,7 +2,7 @@
|
||||
title: '1. 设置基础设施和私有镜像仓库'
|
||||
---
|
||||
|
||||
本文介绍如何在离线环境中,为 Rancher Management server 配置底层基础设施。你还将设置 Rancher 节点中必须可用的 Docker 私有仓库。
|
||||
本文介绍如何在离线环境中,为 Rancher Management server 配置底层基础设施。你还将设置 Rancher 节点中必须可用的私有容器镜像仓库。
|
||||
|
||||
离线环境是 Rancher Server 离线安装或安装在防火墙后面的环境。
|
||||
|
||||
@@ -19,7 +19,7 @@ Rancher 可以安装在任何 Kubernetes 集群上。为了阅读方便,我们
|
||||
- **1 个外部数据库**:用于存储集群数据。支持 PostgreSQL, MySQL 和 etcd。
|
||||
- **1 个负载均衡器**:用于将流量转发到这两个节点中。
|
||||
- **1 个 DNS 记录**:用于将 URL 映射到负载均衡器。此 DNS 记录将成为 Rancher Server 的 URL,下游集群需要可以访问到这个地址。
|
||||
- **1 个私有 Docker 镜像仓库**:用于将 Docker 镜像分发到你的主机。
|
||||
- **私有镜像仓库**,用于将容器镜像分发到你的主机。
|
||||
|
||||
### 1. 配置 Linux 节点
|
||||
|
||||
@@ -78,13 +78,17 @@ K3s 与其他 Kubernetes 发行版不同,在于其支持使用 etcd 以外的
|
||||
|
||||
有关设置 DNS 记录以将域流量转发到 Amazon ELB 负载均衡器的指南,请参见 [AWS 官方文档](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-elb-load-balancer)。
|
||||
|
||||
### 5. 配置私有 Docker 镜像仓库
|
||||
### 5. 配置私有镜像仓库
|
||||
|
||||
Rancher 支持使用私有镜像仓库进行离线安装。你必须有自己的私有镜像仓库或使用其他方式将 Docker 镜像分发到主机。
|
||||
Rancher 支持使用私有镜像仓库进行离线安装。你必须有自己的私有镜像仓库或使用其他方式将容器镜像分发到主机。
|
||||
|
||||
在后续设置 K3s Kubernetes 集群时,你需要创建一个[私有镜像仓库配置文件](https://rancher.com/docs/k3s/latest/en/installation/private-registry/),其中包含此镜像仓库的信息。
|
||||
|
||||
如需获得创建私有镜像仓库的帮助,请参见 [Docker 官方文档](https://docs.docker.com/registry/deploying/#run-an-externally-accessible-registry)。
|
||||
如果你需要创建私有镜像仓库,请参阅相应运行时的文档:
|
||||
|
||||
* [Containerd](https://github.com/containerd/containerd/blob/main/docs/cri/config.md#registry-configuration).
|
||||
* [Nerdctl 命令和镜像仓库托管服务](https://github.com/containerd/nerdctl/blob/main/docs/registry.md)
|
||||
* [Docker](https://docs.docker.com/registry/deploying/).
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="RKE">
|
||||
@@ -94,7 +98,7 @@ Rancher 支持使用私有镜像仓库进行离线安装。你必须有自己的
|
||||
- **3 个 Linux 节点**:可以是你的云提供商(例如 Amazon EC2,GCE 或 vSphere)中的虚拟机。
|
||||
- **1 个负载均衡器**:用于将前端流量转发到这三个节点中。
|
||||
- **1 个 DNS 记录**:用于将 URL 映射到负载均衡器。此 DNS 记录将成为 Rancher Server 的 URL,下游集群需要可以访问到这个地址。
|
||||
- **1 个私有 Docker 镜像仓库**:用于将 Docker 镜像分发到你的主机。
|
||||
- **私有镜像仓库**,用于将容器镜像分发到你的主机。
|
||||
|
||||
这些节点必须位于同一个区域或数据中心。但是你可以把这些服务器放在不同的可用区。
|
||||
|
||||
@@ -145,13 +149,17 @@ Rancher 支持使用私有镜像仓库进行离线安装。你必须有自己的
|
||||
|
||||
有关设置 DNS 记录以将域流量转发到 Amazon ELB 负载均衡器的指南,请参见 [AWS 官方文档](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-elb-load-balancer)。
|
||||
|
||||
### 4. 配置私有 Docker 镜像仓库
|
||||
### 4. 配置私有镜像仓库
|
||||
|
||||
Rancher 支持使用安全的 Docker 私有镜像仓库进行离线安装。你必须有自己的私有镜像仓库或使用其他方式将 Docker 镜像分发到主机。
|
||||
Rancher 支持使用安全的私有镜像仓库进行离线安装。你必须有自己的私有镜像仓库或使用其他方式将容器镜像分发到主机。
|
||||
|
||||
在后续设置 RKE Kubernetes 集群时,你需要创建一个[私有镜像仓库配置文件](https://rancher.com/docs/rke/latest/en/config-options/private-registries/),其中包含此镜像仓库的信息。
|
||||
|
||||
如需获得创建私有镜像仓库的帮助,请参见 [Docker 官方文档](https://docs.docker.com/registry/deploying/#run-an-externally-accessible-registry)。
|
||||
如果你需要创建私有镜像仓库,请参阅相应运行时的文档:
|
||||
|
||||
* [Containerd](https://github.com/containerd/containerd/blob/main/docs/cri/config.md#registry-configuration).
|
||||
* [Nerdctl 命令和镜像仓库托管服务](https://github.com/containerd/nerdctl/blob/main/docs/registry.md)
|
||||
* [Docker](https://docs.docker.com/registry/deploying/).
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="Docker">
|
||||
@@ -168,13 +176,13 @@ Rancher 支持使用安全的 Docker 私有镜像仓库进行离线安装。你
|
||||
|
||||
此主机会断开互联网链接,但需要能与你的私有镜像仓库连接。
|
||||
|
||||
请确保你的节点满足[操作系统,Docker,硬件和网络](../../../../pages-for-subheaders/installation-requirements.md)的常规要求。
|
||||
请确保你的节点满足[操作系统,容器,硬件和网络](../../../../pages-for-subheaders/installation-requirements.md)的常规安装要求。
|
||||
|
||||
如需获取配置 Linux 节点的示例,请参见[在 Amazon EC2 中配置节点](../../../../how-to-guides/new-user-guides/infrastructure-setup/nodes-in-amazon-ec2.md)的教程。
|
||||
|
||||
### 2. 配置私有 Docker 镜像仓库
|
||||
|
||||
Rancher 支持使用 Docker 私有镜像仓库在堡垒服务器中进行离线安装。你必须有自己的私有镜像仓库或使用其他方式将 Docker 镜像分发到主机。
|
||||
Rancher 支持使用私有镜像仓库在堡垒服务器中进行离线安装。你必须有自己的私有镜像仓库或使用其他方式将容器镜像分发到主机。
|
||||
|
||||
如需获得创建私有镜像仓库的帮助,请参见 [Docker 官方文档](https://docs.docker.com/registry/)。
|
||||
|
||||
|
||||
+84
-11
@@ -2,11 +2,11 @@
|
||||
title: '2. 安装 Kubernetes'
|
||||
---
|
||||
|
||||
基础设施配置好后,你可以设置一个 RKE 集群来安装 Rancher。
|
||||
基础设施配置好后,你可以设置一个 Kubernetes 集群来安装 Rancher。
|
||||
|
||||
首先,你需要在所有三个 Linux 节点上安装 Docker 并设置 HTTP 代理。因此,你可以在这三个节点上执行以下步骤。
|
||||
设置 RKE、RKE2 或 K3s 的步骤如下所示。
|
||||
|
||||
为方便起见,将代理的 IP 地址和端口导出到一个环境变量中,并为你当前的 shell 设置 HTTP_PROXY 变量:
|
||||
为方便起见,将代理的 IP 地址和端口导出到一个环境变量中,并在每个节点上为你当前的 shell 设置 HTTP_PROXY 变量:
|
||||
|
||||
```
|
||||
export proxy_host="10.0.0.5:8888"
|
||||
@@ -15,6 +15,84 @@ export HTTPS_PROXY=http://${proxy_host}
|
||||
export NO_PROXY=127.0.0.0/8,10.0.0.0/8,cattle-system.svc,172.16.0.0/12,192.168.0.0/16
|
||||
```
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="K3s">
|
||||
|
||||
首先在 K3s systemd 服务上配置 HTTP 代理设置,让 K3s 的 containerd 可以通过代理拉取镜像:
|
||||
|
||||
```
|
||||
cat <<'EOF' | sudo tee /etc/default/k3s > /dev/null
|
||||
HTTP_PROXY=http://${proxy_host}
|
||||
HTTPS_PROXY=http://${proxy_host}"
|
||||
NO_PROXY=127.0.0.0/8,10.0.0.0/8,cattle-system.svc,172.16.0.0/12,192.168.0.0/16,.svc,.cluster.local
|
||||
EOF
|
||||
```
|
||||
|
||||
然后运行 K3s 安装脚本创建一个新的 K3s 集群。确保你安装的 K3s 版本受 [Rancher 支持](https://www.suse.com/suse-rancher/support-matrix/all-supported-versions/)。
|
||||
|
||||
在第一个节点上,创建一个新集群:
|
||||
```
|
||||
curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=v1.xx K3S_TOKEN=your_secret sh -s - server --cluster-init
|
||||
```
|
||||
|
||||
然后加入其他节点:
|
||||
```
|
||||
curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=v1.xx K3S_TOKEN=your_secret sh -s - server --server https://<ip or hostname of server1>:6443
|
||||
```
|
||||
|
||||
有关安装 K3s 的更多信息,请参阅 [K3s 安装文档](https://docs.k3s.io/installation)。
|
||||
|
||||
如需查看集群,请运行以下命令:
|
||||
|
||||
```
|
||||
kubectl cluster-info
|
||||
kubectl get pods --all-namespaces
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="RKE2">
|
||||
|
||||
在每个节点上,运行 RKE2 安装脚本。确保你安装的 RKE2 版本受 [Rancher 支持](https://www.suse.com/suse-rancher/support-matrix/all-supported-versions/)。
|
||||
|
||||
```
|
||||
curl -sfL https://get.rke2.io | INSTALL_RKE2_CHANNEL=v1.xx sh -
|
||||
```
|
||||
|
||||
然后,你必须在 RKE2 systemd 服务上配置 HTTP 代理设置,让 RKE2 的 containerd 可以通过代理拉取镜像:
|
||||
|
||||
```
|
||||
cat <<'EOF' | sudo tee /etc/default/rke2-server > /dev/null
|
||||
HTTP_PROXY=http://${proxy_host}
|
||||
HTTPS_PROXY=http://${proxy_host}"
|
||||
NO_PROXY=127.0.0.0/8,10.0.0.0/8,cattle-system.svc,172.16.0.0/12,192.168.0.0/16,.svc,.cluster.local
|
||||
EOF
|
||||
```
|
||||
|
||||
接下来,按照 [RKE2 高可用性文档](https://docs.rke2.io/install/ha)在每个节点上创建 RKE2 配置文件。
|
||||
|
||||
之后启动并启用 `rke2-server` 服务:
|
||||
|
||||
```
|
||||
systemctl enable rke2-server.service
|
||||
systemctl start rke2-server.service
|
||||
```
|
||||
|
||||
有关安装 RKE2 的更多信息,请参阅 [RKE2 安装文档](https://docs.rke2.io/install/)。
|
||||
|
||||
如需查看集群,请运行以下命令:
|
||||
|
||||
```
|
||||
export KUBECONFIG=/etc/rancher/rke2/rke2.yaml
|
||||
alias kubectl=/var/lib/rancher/rke2/bin/kubectl
|
||||
kubectl cluster-info
|
||||
kubectl get pods --all-namespaces
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="RKE">
|
||||
|
||||
首先,你需要在所有三个 Linux 节点上安装 Docker 并设置 HTTP 代理。因此,你可以在这三个节点上执行以下步骤。
|
||||
|
||||
接下来配置 apt 以在安装包时使用这个代理。如果你使用的不是 Ubuntu,请相应调整步骤。
|
||||
|
||||
```
|
||||
@@ -92,14 +170,6 @@ chmod +x ./kubectl
|
||||
sudo mv ./kubectl /usr/local/bin/kubectl
|
||||
```
|
||||
|
||||
* [helm](https://helm.sh/docs/intro/install/)
|
||||
|
||||
```
|
||||
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
|
||||
chmod +x get_helm.sh
|
||||
sudo ./get_helm.sh
|
||||
```
|
||||
|
||||
接下来,创建一个描述 RKE 集群的 YAML 文件。确保节点的 IP 地址和 SSH 用户名是正确的。有关集群 YAML 的详情,请参见 [RKE 官方文档](https://rancher.com/docs/rke/latest/en/example-yamls/)。
|
||||
|
||||
```yml
|
||||
@@ -166,6 +236,9 @@ default backend - 404
|
||||
|
||||
:::
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### 故障排除
|
||||
|
||||
参见[故障排除](../../install-upgrade-on-a-kubernetes-cluster/troubleshooting.md)页面。
|
||||
|
||||
+7
-3
@@ -4,11 +4,15 @@ title: 3. 安装 Rancher
|
||||
|
||||
在前文的操作后,你已经有了一个运行的 RKE 集群,现在可以在其中安装 Rancher 了。出于安全考虑,所有到 Rancher 的流量都必须使用 TLS 加密。在本教程中,你将使用 [cert-manager](https://cert-manager.io/)自动颁发自签名证书。在实际使用情况下,你可使用 Let's Encrypt 或自己的证书。
|
||||
|
||||
:::note
|
||||
### 安装 Helm CLI
|
||||
|
||||
这些安装指南假定你使用的是 Helm 3。
|
||||
在具有 kubeconfig 的主机上安装 [Helm](https://helm.sh/docs/intro/install/) CLI 以访问 Kubernetes 集群:
|
||||
|
||||
:::
|
||||
```
|
||||
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
|
||||
chmod +x get_helm.sh
|
||||
sudo ./get_helm.sh
|
||||
```
|
||||
|
||||
### 安装 cert-manager
|
||||
|
||||
|
||||
+2
-2
@@ -25,9 +25,9 @@ kubectl -n cattle-system create secret tls tls-rancher-ingress \
|
||||
|
||||
## 使用私有 CA 签名证书
|
||||
|
||||
如果你使用的是私有 CA,Rancher 需要你提供 CA 证书的副本,用来校验 Rancher Agent 与 Server 的连接。
|
||||
如果你使用的是私有 CA,Rancher 需要私有 CA 的根证书或证书链的副本,Rancher Agent 使用它来校验与 Server 的连接。
|
||||
|
||||
将 CA 证书拷贝到名为 `cacerts.pem` 的文件中,然后使用 `kubectl` 在 `cattle-system` 命名空间中创建 `tls-ca` 密文。
|
||||
创建一个名为 `cacerts.pem` 的文件,该文件仅包含私有 CA 的根 CA 证书或证书链,并使用 `kubectl` 在 `cattle-system` 命名空间中创建 `tls-ca` Secret。
|
||||
|
||||
```
|
||||
kubectl -n cattle-system create secret generic tls-ca \
|
||||
|
||||
+1
-2
@@ -2,7 +2,7 @@
|
||||
title: 离线安装中设置本地 System Charts
|
||||
---
|
||||
|
||||
[System Charts](https://github.com/rancher/system-charts) 仓库包含 Monitoring、Logging、告警和全局 DNS 等功能所需的所有应用项。
|
||||
[Charts](https://github.com/rancher/charts) 仓库包含 Monitoring、Logging、告警和 Istio 等功能所需的所有 Helm 目录项。
|
||||
|
||||
在 Rancher 的离线安装中,你需要配置 Rancher 以使用 System Charts 的本地副本。本节介绍如何通过 CLI 标志使用本地 System Charts。
|
||||
|
||||
@@ -11,4 +11,3 @@ title: 离线安装中设置本地 System Charts
|
||||
`system-charts` 的一个本地副本已经打包到 `rancher/rancher` 容器中。为了在离线安装中使用这些功能,你需要使用额外的环境变量 `CATTLE_SYSTEM_CATALOG=bundled` 来运行 Rancher 安装命令,该环境变量告诉 Rancher 使用 Chart 的本地副本,而不是尝试从 GitHub 获取 Chart。
|
||||
|
||||
带有 `system-charts` 的 Rancher 安装命令示例包含在 Docker 和 Helm 的[离线安装说明](../../../pages-for-subheaders/air-gapped-helm-cli-install.md)中。
|
||||
|
||||
|
||||
+2
-2
@@ -147,7 +147,7 @@ kubectl annotate clusters.management.cattle.io <CLUSTER_ID> io.cattle.agent.forc
|
||||
将 `CATTLE_CA_CHECKSUM` 环境变量更新为匹配新 CA 证书校验和的值,从而手动为 Agent Kubernetes 对象打上补丁。通过以下操作生成新的校验和:
|
||||
|
||||
```bash
|
||||
curl -k -s -fL <RANCHER_SERVER_URL>/v3/settings/cacerts | jq -r .value | sha256sum cacert.tmp | awk '{print $1}'
|
||||
curl -k -s -fL <RANCHER_SERVER_URL>/v3/settings/cacerts | jq -r .value | sha256sum | awk '{print $1}'
|
||||
```
|
||||
|
||||
为每个下游集群使用 Kubeconfig 更新两个 Agent 部署的环境变量。如果集群启用了 [ACE](../../../how-to-guides/new-user-guides/manage-clusters/access-clusters/authorized-cluster-endpoint),你可以[调整 kubectl 上下文](../../../how-to-guides/new-user-guides/manage-clusters/access-clusters/use-kubectl-and-kubeconfig#直接使用下游集群进行身份验证),从而直接连接到下游集群。
|
||||
@@ -260,4 +260,4 @@ helm ls -n cattle-system
|
||||
|
||||
#### 为什么要执行这一步骤?
|
||||
|
||||
Rancher 管理的集群中的 Fleet agent 存储了用于连接到 Rancher 的 kubeconfig。kubeconfig 包含一个 `certificate-authority-data` 字段,该字段包含 Rancher 使用的证书的 CA。更改 CA 时,你需要更新此块来允许 fleet-agent 信任 Rancher 使用的证书。
|
||||
Rancher 管理的集群中的 Fleet agent 存储了用于连接到 Rancher 的 kubeconfig。kubeconfig 包含一个 `certificate-authority-data` 字段,该字段包含 Rancher 使用的证书的 CA。更改 CA 时,你需要更新此块来允许 fleet-agent 信任 Rancher 使用的证书。
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ Rancher Server 会定期刷新 `rke-metadata-config` 来下载新的 Kubernetes
|
||||
|
||||
要将 Rancher 与 RKE 元数据的本地镜像同步,管理员需要配置 `rke-metadata-config` 来指向镜像。详情请参考[配置元数据同步](#配置元数据同步)
|
||||
|
||||
在将新的 Kubernetes 版本加载到 Rancher Server 中之后,需要执行其他步骤才能使用它们启动集群。Rancher 需要访问更新的系统镜像。虽然只有管理员可以更改元数据设置,但任何用户都可以下载 Rancher 系统镜像并为镜像准备私有 Docker 镜像仓库。
|
||||
在将新的 Kubernetes 版本加载到 Rancher Server 中之后,需要执行其他步骤才能使用它们启动集群。Rancher 需要访问更新的系统镜像。虽然只有管理员可以更改元数据设置,但任何用户都可以下载 Rancher 系统镜像并为镜像准备私有容器镜像仓库。
|
||||
|
||||
1. 要把系统镜像下载到私有镜像仓库,请单击 Rancher UI 左下角的 Rancher Server 版本。
|
||||
1. 下载适用于 Linux 或 Windows 操作系统的镜像。
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ AWS 模块只创建一个 EC2 密钥对、一个 EC2 安全组和一个 EC2 实
|
||||
|
||||
1. 使用命令行工具,执行 `git clone https://github.com/rancher/quickstart` 把 [Rancher Quickstart](https://github.com/rancher/quickstart) 克隆到本地。
|
||||
|
||||
2. 执行 `cd quickstart/rancher/aws` 命令,进入包含 terraform 文件的 AWS 文件夹。
|
||||
2. 执行 `cd quickstart/rancher/aws` 命令,进入包含 Terraform 文件的 AWS 文件夹。
|
||||
|
||||
3. 把 `terraform.tfvars.example` 文件重命名为 `terraform.tfvars`。
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ description: 阅读此分步 Rancher Azure 指南,以快速部署带有单节
|
||||
|
||||
1. 使用命令行工具,执行 `git clone https://github.com/rancher/quickstart` 把 [Rancher Quickstart](https://github.com/rancher/quickstart) 克隆到本地。
|
||||
|
||||
2. 执行 `cd quickstart/rancher/azure` 命令,进入包含 terraform 文件的 Azure 文件夹。
|
||||
2. 执行 `cd quickstart/rancher/azure` 命令,进入包含 Terraform 文件的 Azure 文件夹。
|
||||
|
||||
3. 把 `terraform.tfvars.example` 文件重命名为 `terraform.tfvars`。
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ description: 阅读此分步 Rancher DigitalOcean 指南,以快速部署带有
|
||||
|
||||
1. 使用命令行工具,执行 `git clone https://github.com/rancher/quickstart` 把 [Rancher Quickstart](https://github.com/rancher/quickstart) 克隆到本地。
|
||||
|
||||
2. 执行 `cd quickstart/rancher/do` 命令,进入包含 terraform 文件的 DigitalOcean 文件夹。
|
||||
2. 执行 `cd quickstart/rancher/do` 命令,进入包含 Terraform 文件的 DigitalOcean 文件夹。
|
||||
|
||||
3. 把 `terraform.tfvars.example` 文件重命名为 `terraform.tfvars`。
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ description: 阅读此分步 Rancher GCP 指南,以快速部署带有单节点
|
||||
|
||||
1. 使用命令行工具,执行 `git clone https://github.com/rancher/quickstart` 把 [Rancher Quickstart](https://github.com/rancher/quickstart) 克隆到本地。
|
||||
|
||||
2. 执行 `cd quickstart/rancher/gcp` 命令,进入包含 terraform 文件的 GCP 文件夹。
|
||||
2. 执行 `cd quickstart/rancher/gcp` 命令,进入包含 Terraform 文件的 GCP 文件夹。
|
||||
|
||||
3. 把 `terraform.tfvars.example` 文件重命名为 `terraform.tfvars`。
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ description: 阅读此分步 Rancher Hetzner Cloud 指南,以快速部署带
|
||||
|
||||
1. 使用命令行工具,执行 `git clone https://github.com/rancher/quickstart` 把 [Rancher Quickstart](https://github.com/rancher/quickstart) 克隆到本地。
|
||||
|
||||
2. 执行 `cd quickstart/rancher/hcloud` 命令,进入包含 terraform 文件的 Hetzner 文件夹。
|
||||
2. 执行 `cd quickstart/rancher/hcloud` 命令,进入包含 Terraform 文件的 Hetzner 文件夹。
|
||||
|
||||
3. 把 `terraform.tfvars.example` 文件重命名为 `terraform.tfvars`。
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ description: 阅读此分步 Rancher Outscale 指南,以快速部署带有单
|
||||
|
||||
1. 使用命令行工具,执行 `git clone https://github.com/rancher/quickstart` 把 [Rancher Quickstart](https://github.com/rancher/quickstart) 克隆到本地。
|
||||
|
||||
2. 执行 `cd quickstart/rancher/outscale` 命令,进入包含 terraform 文件的 Outscale 文件夹。
|
||||
2. 执行 `cd quickstart/rancher/outscale` 命令,进入包含 Terraform 文件的 Outscale 文件夹。
|
||||
|
||||
3. 把 `terraform.tfvars.example` 文件重命名为 `terraform.tfvars`。
|
||||
|
||||
|
||||
+1
-1
@@ -2,6 +2,6 @@
|
||||
title: Rancher Prime
|
||||
---
|
||||
|
||||
Rancher v2.7 引入了 Rancher Prime,这是一款专注于安全性的 Rancher 产品。Rancher Prime 是使用相同源代码构建的新版 Rancher。使用 Rancher Prime,安装 asset 会托管在由 Rancher 管理的安全可信镜像仓库中。
|
||||
Rancher 在 v2.7 中引入了 Rancher Prime,这是 Rancher 企业级产品的进化。Rancher Prime 是基于相同源代码构建的商业化、企业级的新版本。因此,Rancher 的产品将继续保持 100% 开源,并通过安全、延长生命周期、访问重点架构和 Kubernetes 公告体现额外价值。Rancher Prime 还将提供选项,让用户获得创新 Rancher 项目的生产支持。使用 Rancher Prime,安装 asset 会托管在由 Rancher 持有和管理的可信镜像仓库中。
|
||||
|
||||
要开始使用 Rancher Prime,请[转到此页面](https://www.rancher.com/quick-start)并填写表格。
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ title: 添加项目成员
|
||||
1. 在左上角,单击 **☰ > 集群管理**。
|
||||
1. 在**集群**页面上,转到要添加项目成员的集群,然后单击 **Explore**。
|
||||
1. 单击**集群 > 项目/命名空间**。
|
||||
1. 转到要添加成员的项目,然后单击 **⋮ > 编辑配置**。
|
||||
1. 转到要添加成员的项目。在项目名称上方的**创建命名空间**按钮旁边,单击 **☰**。选择 **编辑配置**。
|
||||
1. 在**成员**选项卡中,单击**添加**。
|
||||
1. 搜索要添加到项目的用户或组。
|
||||
|
||||
|
||||
+11
-6
@@ -12,24 +12,29 @@ title: 还原 Rancher
|
||||
|
||||
:::
|
||||
|
||||
### 使用 Rancher 2.6.4+ 进行回滚的其他步骤
|
||||
## 使用 Rancher 2.6.4+ 进行回滚的其他步骤
|
||||
|
||||
在 Rancher v2.6.4 中,cluster-api 模块已从 v0.4.4 升级到 v1.0.2,其中 CAPI CRD 的 apiVersion 已从 `cluster.x-k8s.io/v1alpha4` 升级到 `cluster.x-k8s.io/v1beta1`。由于需要回滚的 CRD 在 v1beta1 中不再可用,因此从 Rancher v2.6.4 回滚到任何 Rancher v2.6.x 先前版本都会失败。
|
||||
Rancher v2.6.4 将 cluster-api 模块从 v0.4.4 升级到 v1.0.2。反过来,cluster-api 的 v1.0.2 版本将集群 API 的自定义资源定义 (CRD) 从 `cluster.x-k8s.io/v1alpha4` 升级到 `cluster.x-k8s.io/v1beta1`。当你尝试将 Rancher v2.6.4 回滚到以前版本的 Rancher v2.6.x 时,CRD 升级到 v1beta1 会导致回滚失败。这是因为使用旧 apiVersion (v1alpha4) 的 CRD 与 v1beta1 不兼容。
|
||||
|
||||
为避免这种情况,请在还原或回滚**之前**先运行 Rancher 资源清理脚本。因此,我们创建了两个脚本来帮助你进行操作,一个用于清理集群(`cleanup.sh`),一个用于检查集群中与 Rancher 相关的资源 (`verify.sh`)。有关清理脚本的详细信息,请参见 [rancher/rancher-cleanup repo](https://github.com/rancher/rancher-cleanup)。
|
||||
要避免回滚失败,你需要在尝试恢复操作或回滚**之前**运行以下 Rancher 脚本:
|
||||
|
||||
* `verify.sh`:检查集群中是否有任何与 Rancher 相关的资源。
|
||||
* `cleanup.sh`:清理集群。
|
||||
|
||||
有关详细信息和源代码,请参阅 [rancher/rancher-cleanup repo](https://github.com/rancher/rancher-cleanup)。
|
||||
|
||||
:::caution
|
||||
|
||||
Rancher 将在运行 `cleanup` 脚本时关闭,因为它会删除 Rancher 创建的资源。
|
||||
`cleanup.sh` 运行的时候会有停机时间,这是因为脚本会删除 Rancher 创建的资源。
|
||||
|
||||
:::
|
||||
|
||||
额外准备:
|
||||
### 从 v2.6.4+ 回滚到较低版本的 v2.6.x
|
||||
|
||||
1. 按照[说明](https://github.com/rancher/rancher-cleanup/blob/main/README.md)运行脚本。
|
||||
1. 按照[说明](https://rancher.com/docs/rancher/v2.6/en/backups/migrating-rancher/)在现有集群上安装 rancher-backup Helm Chart 并恢复之前的状态。
|
||||
1. 省略步骤 3。
|
||||
1. 执行到第 4 步时,在要回滚的本地集群上安装所需的 Rancher 2.6.x 版本。
|
||||
1. 执行到步骤 4 时,在要回滚到的 local 集群上安装 Rancher 2.6.x 版本。
|
||||
|
||||
### 创建 Restore 自定义资源
|
||||
|
||||
|
||||
+14
-4
@@ -62,11 +62,21 @@ title: 配置 NGINX 负载均衡器
|
||||
server <IP_NODE_2>:443 max_fails=3 fail_timeout=5s;
|
||||
server <IP_NODE_3>:443 max_fails=3 fail_timeout=5s;
|
||||
}
|
||||
server {
|
||||
listen 443;
|
||||
proxy_pass rancher_servers_https;
|
||||
}
|
||||
}
|
||||
|
||||
http {
|
||||
server {
|
||||
listen 443 ssl;
|
||||
proxy_pass rancher_servers_https;
|
||||
ssl_certificate /path/to/tls.crt;
|
||||
ssl_certificate_key /path/to/key.key;
|
||||
location / {
|
||||
proxy_pass https://rancher_servers_https;
|
||||
proxy_set_header Host <rancher UI URL>;
|
||||
proxy_ssl_server_name on;
|
||||
proxy_ssl_name <rancher UI URL>
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
+7
-1
@@ -15,6 +15,12 @@ weight: 1
|
||||
1. [创建一个 IAM 角色并附加到实例](#1-创建-iam-角色并附加到实例)
|
||||
2. [配置 ClusterID](#2-创建-clusterid)
|
||||
|
||||
:::note 重要提示:
|
||||
|
||||
从 Kubernetes 1.23 开始,你必须停用 `CSIMigrationAWS` 特性开关才能使用树内 AWS 云提供商。为此,你可以在高级集群配置中将 `feature-gates=CSIMigrationAWS=false` 设置为集群 Kubelet、Controller Manager、API Server 和 Scheduler 的附加参数。
|
||||
|
||||
:::
|
||||
|
||||
### 1. 创建 IAM 角色并附加到实例
|
||||
|
||||
添加到集群的所有节点都必须能够与 EC2 交互,以便它们可以创建和删除资源。你可以使用附加到实例的 IAM 角色来启用交互。请参阅 [Amazon 文档:创建 IAM 角色](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html#create-iam-role) 来创建 IAM 角色。有两个示例策略:
|
||||
@@ -151,4 +157,4 @@ weight: 1
|
||||
|
||||
### 使用 Amazon Elastic Container Registry (ECR)
|
||||
|
||||
在将[创建 IAM 角色并附加到实例](#1-创建-iam-角色并附加到实例)中的 IAM 配置文件附加到实例时,kubelet 组件能够自动获取 ECR 凭证。使用低于 v1.15.0 的 Kubernetes 版本时,需要在集群中配置 Amazon 云提供商。从 Kubernetes 版本 v1.15.0 开始,kubelet 无需在集群中配置 Amazon 云提供商即可获取 ECR 凭证。
|
||||
在将[创建 IAM 角色并附加到实例](#1-创建-iam-角色并附加到实例)中的 IAM 配置文件附加到实例时,kubelet 组件能够自动获取 ECR 凭证。使用低于 v1.15.0 的 Kubernetes 版本时,需要在集群中配置 Amazon 云提供商。从 Kubernetes 版本 v1.15.0 开始,kubelet 无需在集群中配置 Amazon 云提供商即可获取 ECR 凭证。
|
||||
|
||||
+327
@@ -0,0 +1,327 @@
|
||||
---
|
||||
title: 创建 EKS 集群
|
||||
---
|
||||
Amazon EKS 为 Kubernetes 集群提供托管的 controlplane。Amazon EKS 跨多个可用区运行 Kubernetes controlplane 实例,以确保高可用性。Rancher 提供了一个直观的用户界面,用于管理和部署你运行在 Amazon EKS 中的 Kubernetes 集群。通过本指南,你将使用 Rancher 在你的 AWS 账户中快速轻松地启动 Amazon EKS Kubernetes 集群。有关 Amazon EKS 的更多信息,请参阅此[文档](https://docs.aws.amazon.com/eks/latest/userguide/what-is-eks.html)。
|
||||
|
||||
|
||||
## Amazon Web 服务的先决条件
|
||||
|
||||
:::caution
|
||||
|
||||
部署到 Amazon AWS 会产生费用。有关详细信息,请参阅 [EKS 定价页面](https://aws.amazon.com/eks/pricing/)。
|
||||
|
||||
:::
|
||||
|
||||
要在 EKS 上设置集群,你需要设置 Amazon VPC(虚拟私有云)。你还需要确保用于创建 EKS 集群的账号具有适当的[权限](#最小-eks-权限)。详情请参阅 [Amazon EKS 先决条件官方指南](https://docs.aws.amazon.com/eks/latest/userguide/getting-started-console.html#eks-prereqs)。
|
||||
|
||||
### Amazon VPC
|
||||
|
||||
你需要建立一个 Amazon VPC 来启动 EKS 集群。VPC 使你能够将 AWS 资源启动到你定义的虚拟网络中。你可以自己设置一个 VPC,并在 Rancher 中创建集群时提供它。如果你创建过程中没有提供,Rancher 将创建一个 VPC。详情请参阅[教程:为你的 Amazon EKS 集群创建具有公有和私有子网的 VPC](https://docs.aws.amazon.com/eks/latest/userguide/create-public-private-vpc.html)。
|
||||
|
||||
### IAM 策略
|
||||
|
||||
Rancher 需要访问你的 AWS 账户才能在 Amazon EKS 中预置和管理你的 Kubernetes 集群。你需要在 AWS 账户中为 Rancher 创建一个用户,并定义该用户可以访问的内容。
|
||||
|
||||
1. 按照[此处](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html)的步骤创建具有编程访问权限的用户。
|
||||
|
||||
2. 创建一个 IAM 策略,定义该用户在 AWS 账户中有权访问的内容。请务必仅授予此用户所需的最小访问权限。[此处](#最小-eks-权限)列出了 EKS 集群所需的最低权限。请按照[此处](https://docs.aws.amazon.com/eks/latest/userguide/EKS_IAM_user_policies.html)的步骤创建 IAM 策略并将策略绑定到你的用户。
|
||||
|
||||
3. 最后,按照[此处](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html#Using_CreateAccessKey)的步骤为该用户创建访问密钥和密文密钥。
|
||||
|
||||
:::note 重要提示:
|
||||
|
||||
定期轮换访问密钥和密文密钥非常重要。有关详细信息,请参阅此[文档](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html#rotating_access_keys_console)。
|
||||
|
||||
:::
|
||||
|
||||
有关 EKS 的 IAM 策略的更多详细信息,请参阅 [Amazon EKS IAM 策略、角色和权限的官方文档](https://docs.aws.amazon.com/eks/latest/userguide/IAM_policies.html)。
|
||||
|
||||
|
||||
## 创建 EKS 集群
|
||||
|
||||
使用 Rancher 配置你的 Kubernetes 集群。
|
||||
|
||||
1. 点击 **☰ > 集群管理**。
|
||||
1. 在**集群**页面上,单击**创建**。
|
||||
1. 选择 **Amazon EKS**。
|
||||
1. 输入**集群名称**。
|
||||
1. 使用**成员角色**为集群配置用户授权。点击**添加成员**添加可以访问集群的用户。使用**角色**下拉菜单为每个用户设置权限。
|
||||
1. 完成表单的其余部分。如需帮助,请参阅[配置参考](#eks-集群配置参考)。
|
||||
1. 单击**创建**。
|
||||
|
||||
**结果**:
|
||||
|
||||
你已创建集群,集群的状态是**配置中**。Rancher 已在你的集群中。
|
||||
|
||||
当集群状态变为 **Active** 后,你可访问集群。
|
||||
|
||||
**Active** 状态的集群会分配到两个项目:
|
||||
|
||||
- `Default`:包含 `default` 命名空间
|
||||
- `System`:包含 `cattle-system`,`ingress-nginx`,`kube-public` 和 `kube-system` 命名空间。
|
||||
|
||||
## EKS 集群配置参考
|
||||
|
||||
有关 EKS 集群配置选项的完整列表,请参阅[此页面](../../../../reference-guides/cluster-configuration/rancher-server-configuration/eks-cluster-configuration.md)。
|
||||
|
||||
## 架构
|
||||
|
||||
下图展示了 Rancher 2.x 的上层架构。下图中,Rancher Server 管理两个 Kubernetes 集群,其中一个由 RKE 创建,另一个由 EKS 创建。
|
||||
|
||||
<figcaption>通过 Rancher 的认证代理管理 Kubernetes 集群</figcaption>
|
||||
|
||||

|
||||
|
||||
## AWS 服务事件
|
||||
|
||||
有关 AWS 服务事件的信息,请参阅[此页面](https://status.aws.amazon.com/)。
|
||||
|
||||
## 安全与合规
|
||||
|
||||
默认情况下,只有创建集群的 IAM 用户或角色才能访问该集群。在没有额外配置的情况下,使用其他用户或角色访问集群将导致错误。在 Rancher 中,这意味着使用映射到未用于创建集群的用户或角色的凭证,导致未经授权的错误。除非用于注册集群的凭证与 EKSCtl 使用的角色或用户匹配,否则 EKSCtl 集群将不会注册到 Rancher。通过将其他用户和角色添加到 kube-system 命名空间中的 aws-auth configmap,可以授权其他用户和角色访问集群。如需更深入的解释和详细说明,请参阅此[文档](https://aws.amazon.com/premiumsupport/knowledge-center/amazon-eks-cluster-access/)。
|
||||
|
||||
有关 Amazon EKS Kubernetes 集群的安全性和合规性的更多信息,请参阅此[文档](https://docs.aws.amazon.com/eks/latest/userguide/shared-responsibilty.html)。
|
||||
|
||||
## 教程
|
||||
|
||||
AWS 开源博客上的这篇[教程](https://aws.amazon.com/blogs/opensource/managing-eks-clusters-rancher/)将指导你使用 Rancher 设置一个 EKS 集群,部署一个可公开访问的示例应用来测试集群,并部署一个使用其他开源软件(如 Grafana 和 influxdb)来实时监控地理信息的示例项目。
|
||||
|
||||
## 最小 EKS 权限
|
||||
|
||||
这些是访问 Rancher EKS 驱动程序的全部功能所需的最低权限集。你需要 Rancher 的其他权限才能配置 `Service Role` 和 `VPC` 资源。如果你在创建集群**之前**创建了这些资源,你在配置集群时将可以使用这些资源。
|
||||
|
||||
| 资源 | 描述 |
|
||||
---------|------------
|
||||
| 服务角色 | 提供允许 Kubernetes 代表你管理资源的权限。Rancher 可以使用以下[服务角色权限](#服务角色权限)来创建服务角色。 |
|
||||
| VPC | 提供 EKS 和 Worker 节点使用的隔离网络资源。Rancher 使用以下 [VPC 权限](#vpc-权限)创建 VPC 资源。 |
|
||||
|
||||
|
||||
资源定位使用 `*` 作为在 Rancher 中创建 EKS 集群之前,无法已知创建的资源的名称(ARN)。
|
||||
|
||||
```json
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "EC2Permisssions",
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"ec2:RunInstances",
|
||||
"ec2:RevokeSecurityGroupIngress",
|
||||
"ec2:RevokeSecurityGroupEgress",
|
||||
"ec2:DescribeInstanceTypes",
|
||||
"ec2:DescribeRegions",
|
||||
"ec2:DescribeVpcs",
|
||||
"ec2:DescribeTags",
|
||||
"ec2:DescribeSubnets",
|
||||
"ec2:DescribeSecurityGroups",
|
||||
"ec2:DescribeRouteTables",
|
||||
"ec2:DescribeLaunchTemplateVersions",
|
||||
"ec2:DescribeLaunchTemplates",
|
||||
"ec2:DescribeKeyPairs",
|
||||
"ec2:DescribeInternetGateways",
|
||||
"ec2:DescribeImages",
|
||||
"ec2:DescribeAvailabilityZones",
|
||||
"ec2:DescribeAccountAttributes",
|
||||
"ec2:DeleteTags",
|
||||
"ec2:DeleteSecurityGroup",
|
||||
"ec2:DeleteKeyPair",
|
||||
"ec2:CreateTags",
|
||||
"ec2:CreateSecurityGroup",
|
||||
"ec2:CreateLaunchTemplateVersion",
|
||||
"ec2:CreateLaunchTemplate",
|
||||
"ec2:CreateKeyPair",
|
||||
"ec2:AuthorizeSecurityGroupIngress",
|
||||
"ec2:AuthorizeSecurityGroupEgress"
|
||||
],
|
||||
"Resource": "*"
|
||||
},
|
||||
{
|
||||
"Sid": "CloudFormationPermisssions",
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"cloudformation:ListStacks",
|
||||
"cloudformation:ListStackResources",
|
||||
"cloudformation:DescribeStacks",
|
||||
"cloudformation:DescribeStackResources",
|
||||
"cloudformation:DescribeStackResource",
|
||||
"cloudformation:DeleteStack",
|
||||
"cloudformation:CreateStackSet",
|
||||
"cloudformation:CreateStack"
|
||||
],
|
||||
"Resource": "*"
|
||||
},
|
||||
{
|
||||
"Sid": "IAMPermissions",
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"iam:PassRole",
|
||||
"iam:ListRoles",
|
||||
"iam:ListRoleTags",
|
||||
"iam:ListInstanceProfilesForRole",
|
||||
"iam:ListInstanceProfiles",
|
||||
"iam:ListAttachedRolePolicies",
|
||||
"iam:GetRole",
|
||||
"iam:GetInstanceProfile",
|
||||
"iam:DetachRolePolicy",
|
||||
"iam:DeleteRole",
|
||||
"iam:CreateRole",
|
||||
"iam:AttachRolePolicy"
|
||||
],
|
||||
"Resource": "*"
|
||||
},
|
||||
{
|
||||
"Sid": "KMSPermisssions",
|
||||
"Effect": "Allow",
|
||||
"Action": "kms:ListKeys",
|
||||
"Resource": "*"
|
||||
},
|
||||
{
|
||||
"Sid": "EKSPermisssions",
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"eks:UpdateNodegroupVersion",
|
||||
"eks:UpdateNodegroupConfig",
|
||||
"eks:UpdateClusterVersion",
|
||||
"eks:UpdateClusterConfig",
|
||||
"eks:UntagResource",
|
||||
"eks:TagResource",
|
||||
"eks:ListUpdates",
|
||||
"eks:ListTagsForResource",
|
||||
"eks:ListNodegroups",
|
||||
"eks:ListFargateProfiles",
|
||||
"eks:ListClusters",
|
||||
"eks:DescribeUpdate",
|
||||
"eks:DescribeNodegroup",
|
||||
"eks:DescribeFargateProfile",
|
||||
"eks:DescribeCluster",
|
||||
"eks:DeleteNodegroup",
|
||||
"eks:DeleteFargateProfile",
|
||||
"eks:DeleteCluster",
|
||||
"eks:CreateNodegroup",
|
||||
"eks:CreateFargateProfile",
|
||||
"eks:CreateCluster"
|
||||
],
|
||||
"Resource": "*"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 服务角色权限
|
||||
|
||||
这些是 EKS 集群创建期间所需的权限,以便 Rancher 可以代表用户创建服务角色。
|
||||
|
||||
```json
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "IAMPermisssions",
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"iam:AddRoleToInstanceProfile",
|
||||
"iam:AttachRolePolicy",
|
||||
"iam:CreateInstanceProfile",
|
||||
"iam:CreateRole",
|
||||
"iam:CreateServiceLinkedRole",
|
||||
"iam:DeleteInstanceProfile",
|
||||
"iam:DeleteRole",
|
||||
"iam:DetachRolePolicy",
|
||||
"iam:GetInstanceProfile",
|
||||
"iam:GetRole",
|
||||
"iam:ListAttachedRolePolicies",
|
||||
"iam:ListInstanceProfiles",
|
||||
"iam:ListInstanceProfilesForRole",
|
||||
"iam:ListRoles",
|
||||
"iam:ListRoleTags",
|
||||
"iam:PassRole",
|
||||
"iam:RemoveRoleFromInstanceProfile"
|
||||
],
|
||||
"Resource": "*"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
当你创建 EKS 集群时,Rancher 会创建一个具有以下信任策略的服务角色:
|
||||
|
||||
```json
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Action": "sts:AssumeRole",
|
||||
"Principal": {
|
||||
"Service": "eks.amazonaws.com"
|
||||
},
|
||||
"Effect": "Allow",
|
||||
"Sid": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
此角色还有两个角色策略,它们具有以下策略的 ARN:
|
||||
|
||||
```
|
||||
arn:aws:iam::aws:policy/AmazonEKSClusterPolicy
|
||||
arn:aws:iam::aws:policy/AmazonEKSServicePolicy
|
||||
```
|
||||
|
||||
### VPC 权限
|
||||
|
||||
这些是 Rancher 创建虚拟私有云 (VPC) 和相关资源所需的权限。
|
||||
|
||||
```json
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "VPCPermissions",
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"ec2:ReplaceRoute",
|
||||
"ec2:ModifyVpcAttribute",
|
||||
"ec2:ModifySubnetAttribute",
|
||||
"ec2:DisassociateRouteTable",
|
||||
"ec2:DetachInternetGateway",
|
||||
"ec2:DescribeVpcs",
|
||||
"ec2:DeleteVpc",
|
||||
"ec2:DeleteTags",
|
||||
"ec2:DeleteSubnet",
|
||||
"ec2:DeleteRouteTable",
|
||||
"ec2:DeleteRoute",
|
||||
"ec2:DeleteInternetGateway",
|
||||
"ec2:CreateVpc",
|
||||
"ec2:CreateSubnet",
|
||||
"ec2:CreateSecurityGroup",
|
||||
"ec2:CreateRouteTable",
|
||||
"ec2:CreateRoute",
|
||||
"ec2:CreateInternetGateway",
|
||||
"ec2:AttachInternetGateway",
|
||||
"ec2:AssociateRouteTable"
|
||||
],
|
||||
"Resource": "*"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## 同步
|
||||
|
||||
EKS 配置者可以在 Rancher 和提供商之间同步 EKS 集群的状态。有关其工作原理的技术说明,请参阅[同步](../../../../reference-guides/cluster-configuration/rancher-server-configuration/sync-clusters.md)。
|
||||
|
||||
有关配置刷新间隔的信息,请参阅[本节](../../../../reference-guides/cluster-configuration/rancher-server-configuration/eks-cluster-configuration.md#配置刷新间隔)。
|
||||
|
||||
## 故障排除
|
||||
|
||||
如果你的更改被覆盖,可能是集群数据与 EKS 同步的方式导致的。不要在使用其他源(例如 EKS 控制台)对集群进行更改后,又在五分钟之内在 Rancher 中进行更改。有关其工作原理,以及如何配置刷新间隔的信息,请参阅[同步](#同步)。
|
||||
|
||||
如果在修改或注册集群时返回未经授权的错误,并且集群不是使用你的凭证所属的角色或用户创建的,请参阅[安全与合规](#安全与合规)。
|
||||
|
||||
有关 Amazon EKS Kubernetes 集群的任何问题或故障排除详细信息,请参阅此[文档](https://docs.aws.amazon.com/eks/latest/userguide/troubleshooting.html)。
|
||||
|
||||
## 以编程方式创建 EKS 集群
|
||||
|
||||
通过 Rancher 以编程方式部署 EKS 集群的最常见方法是使用 Rancher 2 Terraform Provider。详情请参见[使用 Terraform 创建集群](https://registry.terraform.io/providers/rancher/rancher2/latest/docs/resources/cluster)。
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: 管理 GKE 集群
|
||||
title: 创建 GKE 集群
|
||||
---
|
||||
|
||||
## 先决条件
|
||||
@@ -49,7 +49,8 @@ title: 管理 GKE 集群
|
||||
**结果**:你已创建 Rancher 用于配置新 GKE 集群的凭证。
|
||||
|
||||
### 2. 创建 GKE 集群
|
||||
使用 Rancher 配置你的 Kubernetes 集群。
|
||||
使用 Rancher 配置你的 Kubernetes 集群。要使用 Rancher 成功创建 GKE 集群,GKE 必须处于 Standard 模式。GKE 在创建 Kubernetes 集群时有两种运行模式,分别是 Autopilot 和 Standard 模式。Autopilot 模式的集群配置对编辑 kube-system 命名空间有限制。但是,Rancher 在安装时需要在 kube-system 命名空间中创建资源。因此,你将无法创建 Autopilot 模式的 GKE 集群。如需详细了解 GKE Autopilot 模式和 Standard 模式之间的差异,请访问[比较 GKE Autopilot 和 Standard ](https://cloud.google.com/kubernetes-engine/docs/resources/autopilot-standard-feature-comparison)。
|
||||
|
||||
|
||||
1. 点击 **☰ > 集群管理**。
|
||||
1. 在**集群**页面上,单击**创建**。
|
||||
@@ -97,4 +98,4 @@ GKE 配置者可以在 Rancher 和提供商之间同步 GKE 集群的状态。
|
||||
|
||||
## 以编程方式创建 GKE 集群
|
||||
|
||||
通过 Rancher 以编程方式部署 GKE 集群的最常见方法是使用 Rancher 2 Terraform Provider。详情请参见[使用 Terraform 创建集群](https://registry.terraform.io/providers/rancher/rancher2/latest/docs/resources/cluster)。
|
||||
通过 Rancher 以编程方式部署 GKE 集群的最常见方法是使用 Rancher 2 Terraform Provider。详情请参见[使用 Terraform 创建集群](https://registry.terraform.io/providers/rancher/rancher2/latest/docs/resources/cluster)。
|
||||
|
||||
+22
-10
@@ -1,15 +1,15 @@
|
||||
---
|
||||
title: Kubernetes 镜像仓库和 Docker 镜像仓库
|
||||
description: 了解 Docker 镜像仓库和 Kubernetes 镜像仓库、它们的用例以及如何在 Rancher UI 中使用私有镜像仓库
|
||||
title: Kubernetes 镜像仓库和容器镜像仓库
|
||||
description: 了解容器镜像仓库和 Kubernetes 镜像仓库、它们的用例以及如何在 Rancher UI 中使用私有镜像仓库
|
||||
---
|
||||
镜像仓库是 Kubernetes 密文(Secret),包含用于向[私有 Docker 镜像仓库](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/)进行身份验证的凭证。
|
||||
镜像仓库是 Kubernetes 密文(Secret),包含用于向[私有容器镜像仓库](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/)进行身份验证的凭证。
|
||||
|
||||
“Registry” 这个词可能有两种意思,可指代 Docker 或 Kubernetes 镜像仓库:
|
||||
“Registry” 这个词可能有两种意思,可指代容器或 Kubernetes 镜像仓库:
|
||||
|
||||
- **Docker 镜像仓库**包含 Docker 镜像,你可以拉取镜像以便在 deployment 中使用镜像。镜像仓库是一个无状态、可扩展的服务器端应用程序,用于存储和分发 Docker 镜像。
|
||||
- **Kubernetes 镜像仓库**是一个镜像拉取密文,你的 deployment 使用该密文来向 Docker 镜像仓库进行身份验证。
|
||||
- **容器镜像仓库**(以前称为“Docker 镜像仓库”)包含你可以拉取和部署的容器镜像。镜像仓库是一个无状态、可扩展的服务器端应用程序,用于存储和分发容器镜像。
|
||||
- **Kubernetes 镜像仓库**是一个镜像拉取密文,你的 deployment 使用该密文来向容器镜像仓库进行身份验证。
|
||||
|
||||
Deployment 使用 Kubernetes 镜像仓库密文向私有 Docker 镜像仓库进行身份验证,然后拉取托管在仓库上的 Docker 镜像。
|
||||
Deployment 使用 Kubernetes 镜像仓库密文向私有容器镜像仓库进行身份验证,然后拉取托管在仓库上的容器镜像。
|
||||
|
||||
目前,只有在 Rancher UI 中创建工作负载时(通过 kubectl 创建的工作负载不可以),Deployment 才会自动拉取私有镜像仓库凭证。
|
||||
|
||||
@@ -17,7 +17,13 @@ Deployment 使用 Kubernetes 镜像仓库密文向私有 Docker 镜像仓库进
|
||||
|
||||
:::note 先决条件:
|
||||
|
||||
你必须有一个可用的[私有镜像仓库](https://docs.docker.com/registry/deploying/)。
|
||||
你必须已经部署了一个可用的私有镜像仓库。
|
||||
|
||||
如果你需要创建私有镜像仓库,请参阅相应运行时的文档:
|
||||
|
||||
* [Containerd](https://github.com/containerd/containerd/blob/main/docs/cri/config.md#registry-configuration).
|
||||
* [Nerdctl 命令和镜像仓库托管服务](https://github.com/containerd/nerdctl/blob/main/docs/registry.md)
|
||||
* [Docker](https://docs.docker.com/registry/deploying/).
|
||||
|
||||
:::
|
||||
|
||||
@@ -48,7 +54,13 @@ Deployment 使用 Kubernetes 镜像仓库密文向私有 Docker 镜像仓库进
|
||||
|
||||
:::note 先决条件:
|
||||
|
||||
你必须有一个可用的[私有镜像仓库](https://docs.docker.com/registry/deploying/)。
|
||||
你必须已经部署了一个可用的私有镜像仓库。
|
||||
|
||||
如果你需要创建私有镜像仓库,请参阅相应运行时的文档:
|
||||
|
||||
* [Containerd](https://github.com/containerd/containerd/blob/main/docs/cri/config.md#registry-configuration).
|
||||
* [Nerdctl 命令和镜像仓库托管服务](https://github.com/containerd/nerdctl/blob/main/docs/registry.md)
|
||||
* [Docker](https://docs.docker.com/registry/deploying/).
|
||||
|
||||
:::
|
||||
|
||||
@@ -104,7 +116,7 @@ local 集群上的项目级别镜像仓库仅在选择单个项目时可见。
|
||||
1. 在**容器镜像**字段中,输入私有镜像仓库中镜像的路径 URL。例如,如果你的私有镜像仓库位于 Quay.io,你可以使用 `quay.io/<Quay profile name>/<Image name>`。
|
||||
1. 单击**创建**。
|
||||
|
||||
**结果**:你的 deployment 能启动,能使用你在 Rancher UI 中添加的私有镜像仓库凭证进行身份验证,并拉取指定的 Docker 镜像。
|
||||
**结果**:你的 deployment 能启动,能使用你在 Rancher UI 中添加的私有镜像仓库凭证进行身份验证,并拉取指定的容器镜像。
|
||||
|
||||
### 通过 kubectl 使用私有镜像仓库
|
||||
|
||||
|
||||
+23
-25
@@ -3,41 +3,39 @@ title: Ingress 配置
|
||||
description: Ingress 配置
|
||||
---
|
||||
|
||||
### Kubernetes 1.21 中的 NGINX Ingress Controller 变更
|
||||
|
||||
在 Kubernetes 1.21 及更高版本中,NGINX Ingress Controller 不再运行在 hostNetwork 中,而是将 hostPorts 用于端口 80 和端口 443。这样可以将 admission webhook 配置为使用 ClusterIP 访问,从而只在集群内部访问它。
|
||||
|
||||
## Ingress 规则配置
|
||||
|
||||
- [指定要使用的主机名](#指定要使用的主机名)
|
||||
- [用作默认后端](#用作默认后端)
|
||||
- [证书](#证书)
|
||||
- [标签和注释](#标签和注释)
|
||||
|
||||
### 指定要使用的主机名
|
||||
|
||||
如果使用此选项,Ingress 会将主机名请求路由到你指定的服务或工作负载。
|
||||
|
||||
1. 输入**请求主机**,你的 Ingress 会为它处理请求转发。例如,`www.mysite.com`。
|
||||
1. 添加一个**目标服务**。
|
||||
1. **可选**:如果你想在将请求发送到特定主机名路径时指定工作负载或服务,请为目标添加**路径**。例如,如果你希望将 `www.mysite.com/contact-us` 的请求发送到与 `www.mysite.com` 不同的服务,在**路径**字段中输入 `/contact-us`。通常情况下,你创建的第一条规则不包含路径。
|
||||
1. 输入每个目标操作的**端口**号。
|
||||
### 证书
|
||||
|
||||
:::note
|
||||
|
||||
你必须具有 SSL 证书,Ingress 可使用该证书来加密/解密通信。有关详细信息,请参阅[添加 SSL 证书](../encrypt-http-communication.md)。
|
||||
在 Kubernetes v1.21 及更高版本中,NGINX Ingress Controller 不再默认运行在 hostNetwork 中。它改为将 hostPorts 用于端口 80 和端口 443,因此你可以将准入 Webhook 配置为只能通过 ClusterIP 访问。这确保了只能从集群内部访问 webhook。
|
||||
|
||||
由于 controller 的这一更改,默认不再将 `hostNetwork` 设置为 `true`。但是,你必须将 `hostNetwork` 设置为 `true` 才能使基于 TCP 和 UDP 的 Service 正常工作。
|
||||
|
||||
:::
|
||||
|
||||
1. 创建 Ingress 时,单击**证书**选项卡。
|
||||
## 指定要使用的主机名
|
||||
|
||||
如果使用此选项,Ingress 会将主机名请求路由到你指定的服务或工作负载。
|
||||
|
||||
1. 输入**请求主机**,你的 Ingress Controller 会为它处理请求转发。例如,`www.mysite.com`。
|
||||
1. 添加一个**目标服务**。
|
||||
1. **可选**:如果你想在将请求发送到特定主机名路径时指定工作负载或服务,请为目标添加**路径**。例如,如果你希望将 `www.mysite.com/contact-us` 的请求发送到与 `www.mysite.com` 不同的服务,在**路径**中输入 `/contact-us`。通常情况下,你创建的第一条规则不包含路径。
|
||||
1. 输入每个目标操作的**端口**号。
|
||||
|
||||
## 证书
|
||||
|
||||
:::note
|
||||
|
||||
你必须具有 SSL 证书,Ingress 可使用该证书来加密和解密通信。有关详细信息,请参阅[添加 SSL 证书](../encrypt-http-communication.md)。
|
||||
|
||||
:::
|
||||
|
||||
1. 要创建 Ingress Controller,单击**证书**选项卡。
|
||||
1. 单击**添加证书**。
|
||||
1. 从下拉列表中选择一个**证书 - 密文名称**。
|
||||
1. 使用加密通信进入主机。
|
||||
1. 要添加使用证书的其他主机,请单击**添加主机**。
|
||||
|
||||
### 标签和注释
|
||||
## 标签和注释
|
||||
|
||||
添加[标签](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/)和/或[注释](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/)为你的 Ingress 提供元数据。
|
||||
添加[标签](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/)和/或[注释](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/)来为你的 Ingress Controller 提供元数据。
|
||||
|
||||
有关可用的注释列表,请参阅 [Nginx Ingress Controller 文档](https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/)。
|
||||
|
||||
+3
-1
@@ -19,7 +19,9 @@ Rancher 管理的集群上部署了两种不同的 Agent 资源:
|
||||
|
||||
### 调度规则
|
||||
|
||||
`cattle-cluster-agent` 使用如下一组固定的容忍度(如果集群中没有可见的 controlplane 节点),或基于应用于 controlplane 节点的污点动态添加的容忍度。这种结构允许[基于污点进行驱逐](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/#taint-based-evictions)为 `cattle-cluster-agent` 正常工作。默认的容忍度如下。如果集群中存在 controlplane 节点,则容忍度将替换为与 controlplane 节点的污点匹配的容忍度。
|
||||
`cattle-cluster-agent` 使用一组固定的容忍度,或基于应用于 control plane 节点的污点动态添加的容忍度。这种结构允许[基于污点进行驱逐](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/#taint-based-evictions)为 `cattle-cluster-agent` 正常工作。
|
||||
|
||||
如果集群中存在 control plane 节点,则默认容忍度将替换为与 control plane 节点的污点匹配的容忍度。默认的容忍度如下。
|
||||
|
||||
| 组件 | nodeAffinity nodeSelectorTerms | nodeSelector | 容忍度 |
|
||||
| ---------------------- | ------------------------------------------ | ------------ | ------------------------------------------------------------------------------ |
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ RKE1 和 RKE2 有一些细微的差异,本文将重点介绍这些差异。
|
||||
|
||||
### controlplane 组件
|
||||
|
||||
RKE1 使用 Docker 来部署和管理 controlplane 组件,还使用 Docker 作为 Kubernetes 的容器运行时。相比之下,RKE2 将 controlplane 组件作为由 kubelet 管理的静态 pod 启动。RKE2 的容器运行时是 containerd,它允许容器镜像仓库 mirror 等内容(RKE1 和 Docker 不允许)。
|
||||
RKE1 使用 Docker 来部署和管理 controlplane 组件,还使用 Docker 作为 Kubernetes 的容器运行时。相比之下,RKE2 将 controlplane 组件作为由 kubelet 管理的静态 pod 启动。RKE2 的容器运行时是 Containerd,它允许 Mirror 容器镜像仓库等内容。使用 Docker 的 RKE1 不允许 Mirror。
|
||||
|
||||
### Cluster API
|
||||
|
||||
|
||||
+2
-1
@@ -2,8 +2,9 @@
|
||||
title: Flows 和 ClusterFlows
|
||||
---
|
||||
|
||||
有关配置 `Flow` 和 `ClusterFlow` 的完整详细信息,请参阅 [Banzai Cloud Logging Operator 文档](https://banzaicloud.com/docs/one-eye/logging-operator/configuration/flow/)。
|
||||
有关如何配置 `Flow` 和 `ClusterFlow` 的完整详细信息,请参阅 [Banzai Cloud Logging Operator 文档](https://banzaicloud.com/docs/one-eye/logging-operator/configuration/flow/)。
|
||||
|
||||
有关如何解决 Logging 缓冲区的内存问题,请参阅 [Rancher 与 Logging 服务的集成:故障排除](../../../pages-for-subheaders/logging.md#日志缓冲区导致-pod-过载)。
|
||||
|
||||
## Flows
|
||||
|
||||
|
||||
+3
-1
@@ -2,7 +2,9 @@
|
||||
title: Outputs 和 ClusterOutputs
|
||||
---
|
||||
|
||||
有关配置 `Output` 和 `ClusterOutput` 的完整详细信息,请参阅 [Banzai Cloud Logging Operator 文档](https://banzaicloud.com/docs/one-eye/logging-operator/configuration/output/)。
|
||||
有关如何配置 `Flow` 和 `ClusterFlow` 的完整详细信息,请参阅 [Banzai Cloud Logging Operator 文档](https://banzaicloud.com/docs/one-eye/logging-operator/configuration/flow/)。
|
||||
|
||||
有关如何解决 Logging 缓冲区的内存问题,请参阅 [Rancher 与 Logging 服务的集成:故障排除](../../../pages-for-subheaders/logging.md#日志缓冲区导致-pod-过载)。
|
||||
|
||||
## Outputs
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ Rancher 中有两种类型的驱动:
|
||||
|
||||
默认情况下,Rancher 已激活多个托管 Kubernetes 云提供商,包括:
|
||||
|
||||
* [Amazon EKS](amazon-eks-permissions.md)
|
||||
* [Amazon EKS](../how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/set-up-clusters-from-hosted-kubernetes-providers/eks.md)
|
||||
* [Google GKE](../how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/set-up-clusters-from-hosted-kubernetes-providers/gke.md)
|
||||
* [Azure AKS](../how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/set-up-clusters-from-hosted-kubernetes-providers/aks.md)
|
||||
|
||||
|
||||
+2
-1
@@ -25,7 +25,8 @@ Rancher 可以安装在任何 Kubernetes 集群上。这个集群可以使用上
|
||||
- **RKE2:** :[安装 RKE2 Kubernetes 集群的教程](../how-to-guides/new-user-guides/kubernetes-cluster-setup/rke2-for-rancher.md);[设置高可用 RKE2 集群的基础设施的教程](../how-to-guides/new-user-guides/infrastructure-setup/ha-rke2-kubernetes-cluster.md)。
|
||||
- **Amazon EKS**:[在 Amazon EKS 上安装 Rancher 以及如何安装 Ingress Controller 以访问 Rancher Server](../getting-started/installation-and-upgrade/install-upgrade-on-a-kubernetes-cluster/rancher-on-amazon-eks.md)。
|
||||
- **AKS**:[使用 Azure Kubernetes 服务安装 Rancher 以及如何安装 Ingress Controller 以访问 Rancher Server](../getting-started/installation-and-upgrade/install-upgrade-on-a-kubernetes-cluster/rancher-on-aks.md)。
|
||||
- **GKE**:[使用 GKE 安装 Rancher 以及如何安装 Ingress Controller 以访问 Rancher Server](../getting-started/installation-and-upgrade/install-upgrade-on-a-kubernetes-cluster/rancher-on-gke.md)。
|
||||
- **GKE**:有关如何使用 GKE 安装 Rancher,包括如何安装 Ingress Controller 以便可以访问 Rancher Server,请参阅[此页面](../getting-started/installation-and-upgrade/install-upgrade-on-a-kubernetes-cluster/rancher-on-gke.md)。GKE 创建 Kubernetes 集群时有两种运行模式,分别是 Autopilot 和 Standard 模式。Autopilot 模式的集群配置对编辑 kube-system 命名空间有限制。但是,Rancher 在安装时需要在 kube-system 命名空间中创建资源。因此,你将无法在以 Autopilot 模式创建的 GKE 集群上安装 Rancher。
|
||||
|
||||
|
||||
### Ingress Controller
|
||||
|
||||
|
||||
@@ -55,8 +55,6 @@ Jaeger 是用于跟踪分布式系统的工具。我们的 Istio 安装程序包
|
||||
|
||||
如果要在 RKE2 集群上安装 Istio,则需要执行一些额外的步骤。有关详细信息,请参阅[本节](#在-rke2-集群上安装-istio-的其他步骤)。
|
||||
|
||||
请注意,Istio v2(上游 Istio v1.7+)无法在离线环境中升级。
|
||||
|
||||
## 设置指南
|
||||
|
||||
如需了解如何设置 Istio 并在项目中使用它,请参阅[设置指南](istio-setup-guide.md)。
|
||||
@@ -114,3 +112,26 @@ Istio 安装了一个服务网格,它使用 [Envoy](https://www.envoyproxy.io/
|
||||
## 在 RKE2 集群上安装 Istio 的其他步骤
|
||||
|
||||
要在 RKE2 集群上安装 Istio,请按照[步骤](../integrations-in-rancher/istio/configuration-options/install-istio-on-rke2-cluster.md)进行操作。
|
||||
|
||||
## 在离线环境中升级 Istio
|
||||
|
||||
现在,Istio Pod 安全策略默认启用。新值 `installer.releaseMirror.enabled` 已添加到 rancher-istio Chart 中,以启用和禁用支持离线升级的 Server。请注意,`installer.releaseMirror.enabled` 默认设置为 `false`。你可以在安装或升级时根据需要设置该值。按照以下步骤执行:
|
||||
|
||||
1. 在 Rancher UI 中配置离线 Rancher 实例和离线自定义集群。
|
||||
2. 在集群中安装 Monitoring:**Cluster Explorer > Apps & Marketplace > Charts > Monitoring**。
|
||||
3. 将 Istio 所需的所有镜像拉入在离线环境中使用的私有镜像仓库。
|
||||
4. 在集群中安装 Istio:**Cluster Explorer > Apps & Marketplace > Charts > Istio**。
|
||||
|
||||
:::note
|
||||
|
||||
你可以在新安装的 Istio 上启用 [Jaeger](https://www.jaegertracing.io/[) 和 [Kiali](https://kiali.io/)。为确保 Jaeger 和 Kiali 正常工作,请在安装期间将 `values.yaml` 中的 `installer.releaseMirror.enabled` 设置为 `true`。
|
||||
|
||||
:::
|
||||
|
||||
5. 升级 Istio。
|
||||
|
||||
:::caution
|
||||
|
||||
如果你还没有执行操作,请设置 `installer.releaseMirror.enabled=true` 以升级 Istio。
|
||||
|
||||
:::
|
||||
|
||||
@@ -84,6 +84,12 @@ Windows 集群支持 Logging,你可以收集 Windows 节点的日志。
|
||||
|
||||
## 故障排除
|
||||
|
||||
### 日志缓冲区导致 Pod 过载
|
||||
|
||||
根据你的配置,默认缓冲区大小可能太大并导致 Pod 故障。减少负载的一种方法是降低记录器的刷新间隔。这可以防止日志溢出缓冲区。你还可以添加更多刷新线程来处理大量日志试图同时填充缓冲区的情况。
|
||||
|
||||
有关如何配置日志缓冲区来满足企业需求的更完整说明,请参阅 [缓冲区](https://banzaicloud.com/docs/one-eye/logging-operator/configuration/plugins/outputs/buffer/)和 [Fluentd 配置](https://banzaicloud.com/docs/one-eye/logging-operator/configuration/fluentd/)的官方 BanzaiCloud 文档。
|
||||
|
||||
### `cattle-logging` 命名空间正在重新创建
|
||||
|
||||
如果你的集群之前在旧版 Rancher UI 的全局视图中部署了 Logging,`cattle-logging` 命名空间可能会不断被重新创建。
|
||||
@@ -109,6 +115,6 @@ https://<your-url>/dashboard/c/<cluster-id>/
|
||||
*警告*:请当前未使用确保 Logging(从旧版 Rancher UI 全局视图中安装的版本)。
|
||||
|
||||
```bash
|
||||
kubectl delete clusterloggings.management.cattle.io -n <cluster-id>
|
||||
kubectl delete projectloggings.management.cattle.io -n <cluster-id>
|
||||
kubectl delete crd clusterloggings.management.cattle.io -n <cluster-id>
|
||||
kubectl delete crd projectloggings.management.cattle.io -n <cluster-id>
|
||||
```
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ Rancher 支持以下 Kubernetes 提供商:
|
||||
使用 Rancher 创建由提供商托管的集群时,你需要输入身份验证信息。Rancher 会使用验证信息来访问云厂商的 API。有关如何获取此信息的详情,请参阅:
|
||||
|
||||
- [创建 GKE 集群](../how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/set-up-clusters-from-hosted-kubernetes-providers/gke.md)
|
||||
- [创建 EKS 集群](amazon-eks-permissions.md)
|
||||
- [创建 EKS 集群](../how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/set-up-clusters-from-hosted-kubernetes-providers/eks.md)
|
||||
- [创建 AKS 集群](../how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/set-up-clusters-from-hosted-kubernetes-providers/aks.md)
|
||||
- [创建 ACK 集群](../how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/set-up-clusters-from-hosted-kubernetes-providers/alibaba.md)
|
||||
- [创建 TKE 集群](../how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/set-up-clusters-from-hosted-kubernetes-providers/tencent.md)
|
||||
|
||||
+1
-1
@@ -46,4 +46,4 @@ title: EC2 节点模板配置
|
||||
|
||||
### 引擎选项
|
||||
|
||||
在节点模板的**引擎选项**中,你可以配置 Docker daemon。你可能需要指定 Docker 版本或 Docker 仓库镜像。
|
||||
在节点模板的**引擎选项**中,你可以配置容器 daemon。你可能需要指定容器版本或容器镜像仓库 Mirror。
|
||||
|
||||
+2
-2
@@ -16,9 +16,9 @@ title: Azure 节点模板配置
|
||||
|
||||
:::
|
||||
|
||||
[Docker daemon](https://docs.docker.com/engine/docker-overview/#the-docker-daemon) 配置选项包括:
|
||||
如果你使用 Docker,[Docker daemon](https://docs.docker.com/engine/docker-overview/#the-docker-daemon) 配置选项包括:
|
||||
|
||||
- **标签**:有关标签的信息,请参阅 [Docker 对象标签文档](https://docs.docker.com/config/labels-custom-metadata/)。
|
||||
- **Docker 引擎安装 URL**:确定要在实例上安装的 Docker 版本。
|
||||
- **镜像仓库 mirror**:Docker daemon 使用的 Docker 镜像仓库镜像。
|
||||
- **其他高级选项**:参见 [Docker daemon 选项参考](https://docs.docker.com/engine/reference/commandline/dockerd/)。
|
||||
- **其他高级选项**:参见 [Docker daemon 选项参考](https://docs.docker.com/engine/reference/commandline/dockerd/)。
|
||||
|
||||
+2
-2
@@ -10,9 +10,9 @@ title: DigitalOcean 节点模板配置
|
||||
|
||||
### Docker Daemon
|
||||
|
||||
[Docker daemon](https://docs.docker.com/engine/docker-overview/#the-docker-daemon) 配置选项包括:
|
||||
如果你使用 Docker,[Docker daemon](https://docs.docker.com/engine/docker-overview/#the-docker-daemon) 配置选项包括:
|
||||
|
||||
- **标签**:有关标签的信息,请参阅 [Docker 对象标签文档](https://docs.docker.com/config/labels-custom-metadata/)。
|
||||
- **Docker 引擎安装 URL**:确定要在实例上安装的 Docker 版本。
|
||||
- **镜像仓库 mirror**:Docker daemon 使用的 Docker 镜像仓库镜像。
|
||||
- **其他高级选项**:参见 [Docker daemon 选项参考](https://docs.docker.com/engine/reference/commandline/dockerd/)。
|
||||
- **其他高级选项**:参见 [Docker daemon 选项参考](https://docs.docker.com/engine/reference/commandline/dockerd/)。
|
||||
|
||||
+5
-5
@@ -9,7 +9,7 @@ title: RKE2 集群配置参考
|
||||
你可以通过以下两种方式之一来配置 Kubernetes 选项:
|
||||
|
||||
- [Rancher UI](#rancher-ui-中的配置选项):使用 Rancher UI 来选择设置 Kubernetes 集群时常用的自定义选项。
|
||||
- [集群配置文件](#集群配置文件):高级用户可以创建一个 RKE2 配置文件,而不是使用 Rancher UI 来为集群选择 Kubernetes 选项。配置文件让你能设置更多可用于 RKE2 的其他[安装选项](https://docs.rke2.io/install/install_options/install_options)。
|
||||
- [集群配置文件](#集群配置文件):高级用户可以创建一个 RKE2 配置文件,而不是使用 Rancher UI 来为集群选择 Kubernetes 选项。配置文件让你能设置更多可用于 RKE2 的其他[安装选项](https://docs.rke2.io/install/configuration)。
|
||||
|
||||
## 在 Rancher UI 中使用表单编辑集群
|
||||
|
||||
@@ -32,7 +32,7 @@ title: RKE2 集群配置参考
|
||||
|
||||
:::tip
|
||||
|
||||
一些高级配置选项没有在 Rancher UI 表单中开放,但你可以通过在 YAML 中编辑 RKE2 集群配置文件来启用这些选项。有关 YAML 中 RKE2 Kubernetes 集群的可配置选项的完整参考,请参阅 [RKE2 文档](https://docs.rke2.io/install/install_options/install_options/)。
|
||||
一些高级配置选项没有在 Rancher UI 表单中开放,但你可以通过在 YAML 中编辑 RKE2 集群配置文件来启用这些选项。有关 YAML 中 RKE2 Kubernetes 集群的可配置选项的完整参考,请参阅 [RKE2 文档](https://docs.rke2.io/install/configuration)。
|
||||
|
||||
:::
|
||||
|
||||
@@ -126,7 +126,7 @@ Rancher 与以下开箱即用的网络提供商兼容:
|
||||
|
||||
#### 默认 Pod 安全策略
|
||||
|
||||
为集群选择默认的 [pod 安全策略](../../../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md)。请参阅 [RKE2 文档](https://docs.rke2.io/security/policies/)来了解每个可用策略的规范。
|
||||
为集群选择默认的 [pod 安全策略](../../../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md)。请参阅 [RKE2 文档](https://docs.rke2.io/security/pod_security_policies)来了解每个可用策略的规范。
|
||||
|
||||
#### Worker CIS 配置文件
|
||||
|
||||
@@ -160,7 +160,7 @@ Rancher 与以下开箱即用的网络提供商兼容:
|
||||
|
||||
### Agent 环境变量
|
||||
|
||||
为 [Rancher agent](https://rancher.com/docs/rancher/v2.6/en/cluster-provisioning/rke-clusters/rancher-agents/) 设置环境变量的选项。你可以使用键值对设置环境变量。有关详细信息,请参阅 [RKE2 文档](https://docs.rke2.io/install/install_options/linux_agent_config/)。
|
||||
为 [Rancher agent](https://rancher.com/docs/rancher/v2.6/en/cluster-provisioning/rke-clusters/rancher-agents/) 设置环境变量的选项。你可以使用键值对设置环境变量。有关详细信息,请参阅 [RKE2 文档](https://docs.rke2.io/reference/linux_agent_config)。
|
||||
|
||||
### etcd
|
||||
|
||||
@@ -248,7 +248,7 @@ Rancher 与以下开箱即用的网络提供商兼容:
|
||||
|
||||
## 集群配置文件参考
|
||||
|
||||
高级用户可以创建一个配置文件,而不是使用 Rancher UI 来为集群选择 Kubernetes 选项。配置文件允许你为 RKE2 设置[可用的选项](https://docs.rke2.io/install/install_options/server_config/),其中包括已经在 [Rancher UI 配置选项](#rancher-ui-中的配置选项)中列出的选项以及 Rancher 特定的参数。
|
||||
高级用户可以创建一个配置文件,而不是使用 Rancher UI 来为集群选择 Kubernetes 选项。配置文件允许你为 RKE2 设置[可用的选项](https://docs.rke2.io/install/configuration),其中包括已经在 [Rancher UI 配置选项](#rancher-ui-中的配置选项)中列出的选项以及 Rancher 特定的参数。
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
|
||||
+13
-6
@@ -2,7 +2,11 @@
|
||||
title: 同步
|
||||
---
|
||||
|
||||
同步是 EKS 和 GKE 集群的功能,它使 Rancher 更新集群的值,以便它们与托管在 Kubernetes 提供商中的相应集群对象保持一致。这使得 Rancher 不是托管集群状态的唯一所有者。其最大的局限性是,在同一时间或在 5 分钟内处理 Rancher 和另一个来源的更新时,可能会导致其中一个来源的状态被完全覆盖。
|
||||
同步允许 Rancher 更新集群值,以便与托管在 AKS、EKS 或 GKE 中的集群对象保持同步。这使得 Rancher 以外的来源能够获取托管集群的状态。这是 UI 中显示的内容。
|
||||
|
||||
:::caution
|
||||
如果你同时处理来自另一个来源的更新,你可能会不小心覆盖一个来源的状态。如果你在完成一个来源的更新后 5 分钟内处理另一个来源的更新,也可能会发生这种情况。
|
||||
:::
|
||||
|
||||
### 工作原理
|
||||
|
||||
@@ -10,25 +14,28 @@ title: 同步
|
||||
|
||||
1. 集群的 config 对象,位于集群的规范上:
|
||||
|
||||
* 对于 AKS,该字段称为 AKSConfig
|
||||
* 对于 EKS,该字段称为 EKSConfig
|
||||
* 对于 GKE,该字段称为 GKEConfig
|
||||
|
||||
2. UpstreamSpec 对象
|
||||
|
||||
* 对于 AKS,它位于群集状态的 AKSStatus 字段中。
|
||||
* 对于 EKS,它位于集群状态的 EKSStatus 字段中。
|
||||
* 对于 GKE,它位于集群状态的 GKEStatus 字段中。
|
||||
|
||||
定义这些对象的结构类型可以在它们对应的 operator 项目中找到:
|
||||
|
||||
* [aks-operator](https://github.com/rancher/aks-operator/blob/master/pkg/apis/aks.cattle.io/v1/types.go)
|
||||
* [eks-operator](https://github.com/rancher/eks-operator/blob/master/pkg/apis/eks.cattle.io/v1/types.go)
|
||||
* [gke-operator](https://github.com/rancher/gke-operator/blob/master/pkg/apis/gke.cattle.io/v1/types.go)
|
||||
|
||||
除集群名称、位置(区域或地区)、导入和云凭证引用之外,所有字段在此 Spec 对象上都是可为空的。
|
||||
除集群名称、位置(区域或地区)、导入和云凭证引用外,所有字段均可为空。
|
||||
|
||||
EKSConfig 和 GKEConfig 代表其非零值的期望状态。配置对象中非零的字段可以被认为是“管理的”。在 Rancher 中创建集群时,所有字段都是非零的,因此都是“管理”的。在把一个已存在的集群注册到 Rancher 时,所有可为空字段都是 nil 并且不是“管理”的。一旦 Rancher 更改了这些字段的值,这些字段就会被管理。
|
||||
AKSConfig、EKSConfig 或 GKEConfig 表示所需的状态。零值会被忽略。配置对象中非零的字段可以被认为是“管理的”。在 Rancher 中创建集群时,所有字段都是非零的,因此都是“管理”的。在把一个已存在的集群注册到 Rancher 时,所有可为空字段都是 nil 并且不是“管理”的。一旦 Rancher 更改了这些字段的值,这些字段就会被管理。
|
||||
|
||||
UpstreamSpec 代表集群在托管的 Kubernetes 提供商中的情况,并以 5 分钟的时间间隔刷新。刷新 UpstreamSpec 后,Rancher 会检查集群是否正在进行更新。如果它正在更新,则不做任何进一步处理。如果它目前没有更新,EKSConfig 或 GKEConfig 上的任何 "管理" 字段都会被最近更新的 UpstreamSpec 上的相应值覆盖。
|
||||
UpstreamSpec 代表集群在托管的 Kubernetes 提供商中的情况。它每 5 分钟刷新一次。刷新 UpstreamSpec 后,Rancher 会检查集群是否正在进行更新。如果它正在更新,则不做任何进一步处理。如果它目前没有更新,AKSConfig、EKSConfig 或 GKEConfig 上的任何 "管理" 字段都会被最近更新的 UpstreamSpec 上的相应值覆盖。
|
||||
|
||||
有效的期望状态可以被认为是 UpstreamSpec + EKSConfig 或 GKEConfig 中的所有非零字段。这是 UI 中显示的内容。
|
||||
有效的期望状态可以被认为是 UpstreamSpec,加上 AKSConfig、EKSConfig 或 GKEConfig 中的所有非零字段。这是 UI 中显示的内容。
|
||||
|
||||
如果 Rancher 和另一个来源试图在同一时间或在更新完成后的 5 分钟尝试更新集群,那么任何 "管理" 的字段都有可能陷入争用状态。以 EKS 为例,集群可能将 PrivateAccess 作为管理字段。如果 PrivateAccess 为 false,然后在 EKS 控制台中启用,且在 11:01 完成。在这种情况下,在 11:05 之前从 Rancher 更新的标签的值可能会被覆盖。如果在集群处理更新时更新了标签,也会发生这种情况。如果集群已注册并且 PrivateAccess 字段为零,那么在上述情况下,这个问题应该不会发生。
|
||||
如果 Rancher 和另一个来源试图在同一时间或在更新完成后的 5 分钟尝试更新集群,任何管理字段都可能陷入竞争状态。以 EKS 为例,集群可能将 PrivateAccess 作为管理字段。如果 PrivateAccess 为 false,在 11:01 在 EKS 控制台中启用,然后 Rancher 在 11:05 之前更新标签,那么该值很可能被覆盖。如果在集群处理更新时更新了标签,也会发生这种情况。如果集群已注册并且 PrivateAccess 字段为 nil,则不应发生此示例中描述的问题。
|
||||
|
||||
+5
@@ -6,6 +6,11 @@ Rancher 致力于向社区披露我们产品的安全问题。我们会针对已
|
||||
|
||||
| ID | 描述 | 日期 | 解决 |
|
||||
|----|-------------|------|------------|
|
||||
| [CVE-2022-43758](https://github.com/rancher/rancher/security/advisories/GHSA-34p5-jp77-fcrc) | 在 Rancher 2.5.0 至 2.5.16、2.6.0 至 2.6.9 和 2.7.0 版本中发现了一个问题,Rancher Git 包中存在命令注入漏洞。这个包使用 Rancher 容器镜像中可用的底层 Git 二进制文件来执行 Git 操作。特制的命令如果没有消除歧义,可能会在通过 Git 执行时造成混淆,导致在底层 Rancher 主机中进行命令注入。 | 2023 年 1 月 24 日 | Rancher [v2.7.1](https://github.com/rancher/rancher/releases/tag/v2.7.1)、[v2.6.10](https://github.com/rancher/rancher/releases/tag/v2.6.10) 和 [v2.5.17](https://github.com/rancher/rancher/releases/tag/v2.5.17) |
|
||||
| [CVE-2022-43757](https://github.com/rancher/rancher/security/advisories/GHSA-cq4p-vp5q-4522) | 此问题影响 Rancher 2.5.0 到 2.5.16,2.6.0 至 2.6.9 和 2.7.0。我们发现 Rancher 之前发布的安全公告 [CVE-2021-36782](https://github.com/advisories/GHSA-g7j7-h4q8-8w2f) 没有解决某些敏感字段、Secret Token、加密密钥和 SSH 密钥,这些字段仍然以明文形式直接存储在 Kubernetes 上 `Clusters` 之类的对象。在 Rancher 中,集群中已认证的 `Cluster Owners`、`Cluster Members`、`Project Owners` 和 `Project Members` 可以看到公开的凭证。 | 2023 年 1 月 24 日 | Rancher [v2.7.1](https://github.com/rancher/rancher/releases/tag/v2.7.1)、[v2.6.10](https://github.com/rancher/rancher/releases/tag/v2.6.10) 和 [v2.5.17](https://github.com/rancher/rancher/releases/tag/v2.5.17) |
|
||||
| [CVE-2022-43755](https://github.com/rancher/rancher/security/advisories/GHSA-8c69-r38j-rpfj) | 在 Rancher 2.6.9 和 2.7.0 之前的版本中发现了一个问题,即 `cattle-cluster-agent` 使用的 `cattle-token` Secret 是可预测的。重新生成 Token 之后,Token 的值依然相同。如果 Token 被泄露并且出于安全目的需要重新创建,这可能会造成严重的问题。Rancher 的 `cattle-cluster-agent` 使用 `cattle-token` 来连接到 Rancher 配置的下游集群 Kubernetes API。 | 2023 年 1 月 24 日 | Rancher [v2.7.1](https://github.com/rancher/rancher/releases/tag/v2.7.1) 和 [v2.6.10](https://github.com/rancher/rancher/releases/tag/v2.6.10) |
|
||||
| [CVE-2022-21953](https://github.com/rancher/rancher/security/advisories/GHSA-g25r-gvq3-wrq7) | 在 Rancher 2.5.16、2.6.9 和 2.7.0 之前的版本中发现了一个问题。由于授权逻辑缺陷,任何下游集群上经过身份认证的用户都能在 Rancher `local` 集群中打开一个 shell pod (1),而且对 kubectl 具有有限的访问权限 (2)。预期的行为是:除非明确授予权限,否则用户在 Rancher `local` 集群中没有这样的访问权限。 | 2023 年 1 月 24 日 | Rancher [v2.7.1](https://github.com/rancher/rancher/releases/tag/v2.7.1)、[v2.6.10](https://github.com/rancher/rancher/releases/tag/v2.6.10) 和 [v2.5.17](https://github.com/rancher/rancher/releases/tag/v2.5.17) |
|
||||
| [GHSA-c45c-39f6-6gw9](https://github.com/rancher/rancher/security/advisories/GHSA-c45c-39f6-6gw9) | 此问题影响 Rancher 2.5.0 到 2.5.16,2.6.0 至 2.6.9 和 2.7.0。只会影响配置了或配置过外部身份认证提供程序的 Rancher 设置。我们发现,当在 Rancher 中配置外部身份认证提供程序然后将其禁用时,Rancher 生成的 Token 如果关联了通过现已禁用的身份认证提供程序授予访问权限的用户,那么 Token 不会被撤销。 | 2023 年 1 月 24 日 | Rancher [v2.7.1](https://github.com/rancher/rancher/releases/tag/v2.7.1)、[v2.6.10](https://github.com/rancher/rancher/releases/tag/v2.6.10) 和 [v2.5.17](https://github.com/rancher/rancher/releases/tag/v2.5.17) |
|
||||
| [CVE-2022-31247](https://github.com/rancher/rancher/security/advisories/GHSA-6x34-89p7-95wg) | 在 2.5.15(包括)到 2.6.6(包括)的 Rancher 版本中发现了一个问题,其中的授权逻辑缺陷允许在下游集群中通过集群角色模板绑定 (CRTB) 和项目角色模板绑定 (PRTB) 来提升权限。任何有权限创建/编辑 CRTB 或 PRTB 的用户(例如 `cluster-owner`、`manage cluster members`、`project-owner` 和 `manage project members`)都可以利用该漏洞,在同一集群的另一个项目或不同下游集群的另一个项目中获得所有者权限。 | 2022 年 8 月 18 日 | [Rancher 2.6.7](https://github.com/rancher/rancher/releases/tag/v2.6.7) 和 [Rancher 2.5.16](https://github.com/rancher/rancher/releases/tag/v2.5.16) |
|
||||
| [CVE-2021-36783](https://github.com/rancher/rancher/security/advisories/GHSA-8w87-58w6-hfv8) | 2.5.12 到 2.6.3 的 Rancher 版本无法正确清理集群模板 answer 中的凭证。此错误可能会导致明文存储以及凭证、密码和 API 令牌被暴露。在 Rancher 中,已认证的 `Cluster Owner`、`Cluster Member`、`Project Owner` 和 `Project Member` 可以在 `/v1/management.cattle.io.clusters`、`/v3/clusters` 和 `/k8s/clusters/local/apis/management.cattle.io/v3/clusters` 端点上看到暴露的凭证。 | 2022 年 8 月 18 日 | [Rancher 2.6.7](https://github.com/rancher/rancher/releases/tag/v2.6.7) 和 [Rancher 2.5.16](https://github.com/rancher/rancher/releases/tag/v2.5.16) |
|
||||
| [CVE-2021-36782](https://github.com/rancher/rancher/security/advisories/GHSA-g7j7-h4q8-8w2f) | 在 2.5.15 到 2.6.6 的 Rancher 版本中发现了一个问题,其中密码、API 密钥和 Rancher 的 ServiceAccount 令牌(用于配置集群)等敏感字段直接以明文形式存储在 `Cluster` 等 Kubernetes 对象上(例如,`cluster.management.cattle.io`)。任何能够读取 Kubernetes API 中的对象的用户都可以检索这些敏感数据的明文版本。该问题由 Florian Struck(来自 [Continum AG](https://www.continum.net/))和 [Marco Stuurman](https://github.com/fe-ax)(来自 [Shock Media B.V.](https://www.shockmedia.nl/))发现并报告。 | 2022 年 8 月 18 日 | [Rancher 2.6.7](https://github.com/rancher/rancher/releases/tag/v2.6.7) 和 [Rancher 2.5.16](https://github.com/rancher/rancher/releases/tag/v2.5.16) |
|
||||
|
||||
+19
@@ -2,6 +2,8 @@
|
||||
title: Logging
|
||||
---
|
||||
|
||||
## 日志级别
|
||||
|
||||
Rancher 使用了以下日志级别:
|
||||
|
||||
| 名称 | 描述 |
|
||||
@@ -51,3 +53,20 @@ $ docker logs -f <container_id>
|
||||
$ docker exec -ti <container_id> loglevel --set info
|
||||
OK
|
||||
```
|
||||
|
||||
## Rancher 主机调试日志
|
||||
如果需要解决在基础设施提供商中创建对象的问题,你可以使用 `rancher-machine` 调试日志。
|
||||
|
||||
你可以在启动 Rancher 时设置环境变量来为 `rancher-machine` 启用调试日志。
|
||||
|
||||
`CATTLE_WHITELIST_ENVVARS` 环境变量允许用户将特定环境变量列入白名单,让它们能在配置期间传递给 `rancher-machine`。
|
||||
|
||||
`MACHINE_DEBUG` 变量在 `rancher-machine` 中启用调试日志。
|
||||
|
||||
因此,通过设置 `MACHINE_DEBUG=true` 并将 `MACHINE_DEBUG` 添加到 `CATTLE_WHITELIST_ENVVARS` 中的变量默认列表(例如 `CATTLE_WHITELIST_ENVVARS=HTTP_PROXY,HTTPS_PROXY,NO_PROXY,MACHINE_DEBUG`),你可以在配置 RKE1、RKE2 和 K3s 集群时在 `rancher-machine` 中启用调试日志。
|
||||
|
||||
:::caution
|
||||
|
||||
像上面的 `trace` 日志级别一样,`rancher-machine` 调试日志可以包含敏感信息。
|
||||
|
||||
:::
|
||||
|
||||
+17
-17
@@ -280,18 +280,18 @@ SUSE Linux may have a firewall that blocks all ports by default. To open the por
|
||||
|
||||
1. SSH into the instance.
|
||||
1. Start YaST in text mode:
|
||||
```
|
||||
sudo yast2
|
||||
```
|
||||
```
|
||||
sudo yast2
|
||||
```
|
||||
|
||||
1. Navigate to **Security and Users** > **Firewall** > **Zones:public** > **Ports**. To navigate within the interface, follow the instructions [here](https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha-yast-text.html#sec-yast-cli-navigate).
|
||||
1. To open the required ports, enter them into the **TCP Ports** and **UDP Ports** fields. In this example, ports 9796 and 10250 are also opened for monitoring. The resulting fields should look similar to the following:
|
||||
```yaml
|
||||
TCP Ports
|
||||
22, 80, 443, 2376, 2379, 2380, 6443, 9099, 9796, 10250, 10254, 30000-32767
|
||||
UDP Ports
|
||||
8472, 30000-32767
|
||||
```
|
||||
```yaml
|
||||
TCP Ports
|
||||
22, 80, 443, 2376, 2379, 2380, 6443, 9099, 9796, 10250, 10254, 30000-32767
|
||||
UDP Ports
|
||||
8472, 30000-32767
|
||||
```
|
||||
|
||||
1. When all required ports are enter, select **Accept**.
|
||||
|
||||
@@ -301,15 +301,15 @@ UDP Ports
|
||||
|
||||
1. SSH into the instance.
|
||||
1. Edit /`etc/sysconfig/SuSEfirewall2` and open the required ports. In this example, ports 9796 and 10250 are also opened for monitoring:
|
||||
```
|
||||
FW_SERVICES_EXT_TCP="22 80 443 2376 2379 2380 6443 9099 9796 10250 10254 30000:32767"
|
||||
FW_SERVICES_EXT_UDP="8472 30000:32767"
|
||||
FW_ROUTE=yes
|
||||
```
|
||||
```
|
||||
FW_SERVICES_EXT_TCP="22 80 443 2376 2379 2380 6443 9099 9796 10250 10254 30000:32767"
|
||||
FW_SERVICES_EXT_UDP="8472 30000:32767"
|
||||
FW_ROUTE=yes
|
||||
```
|
||||
1. Restart the firewall with the new ports:
|
||||
```
|
||||
SuSEfirewall2
|
||||
```
|
||||
```
|
||||
SuSEfirewall2
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
+19
-17
@@ -298,36 +298,38 @@ SUSE Linux may have a firewall that blocks all ports by default. To open the por
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="SLES 15 / openSUSE Leap 15">
|
||||
|
||||
1. SSH into the instance.
|
||||
1. Start YaST in text mode:
|
||||
```
|
||||
sudo yast2
|
||||
```
|
||||
```
|
||||
sudo yast2
|
||||
```
|
||||
|
||||
1. Navigate to **Security and Users** > **Firewall** > **Zones:public** > **Ports**. To navigate within the interface, follow the instructions [here](https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha-yast-text.html#sec-yast-cli-navigate).
|
||||
1. To open the required ports, enter them into the **TCP Ports** and **UDP Ports** fields. In this example, ports 9796 and 10250 are also opened for monitoring. The resulting fields should look similar to the following:
|
||||
```yaml
|
||||
TCP Ports
|
||||
22, 80, 443, 2376, 2379, 2380, 6443, 9099, 9796, 10250, 10254, 30000-32767
|
||||
UDP Ports
|
||||
8472, 30000-32767
|
||||
```
|
||||
```yaml
|
||||
TCP Ports
|
||||
22, 80, 443, 2376, 2379, 2380, 6443, 9099, 9796, 10250, 10254, 30000-32767
|
||||
UDP Ports
|
||||
8472, 30000-32767
|
||||
```
|
||||
|
||||
1. When all required ports are enter, select **Accept**.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="SLES 12 / openSUSE Leap 42">
|
||||
|
||||
1. SSH into the instance.
|
||||
1. Edit /`etc/sysconfig/SuSEfirewall2` and open the required ports. In this example, ports 9796 and 10250 are also opened for monitoring:
|
||||
```
|
||||
FW_SERVICES_EXT_TCP="22 80 443 2376 2379 2380 6443 9099 9796 10250 10254 30000:32767"
|
||||
FW_SERVICES_EXT_UDP="8472 30000:32767"
|
||||
FW_ROUTE=yes
|
||||
```
|
||||
```
|
||||
FW_SERVICES_EXT_TCP="22 80 443 2376 2379 2380 6443 9099 9796 10250 10254 30000:32767"
|
||||
FW_SERVICES_EXT_UDP="8472 30000:32767"
|
||||
FW_ROUTE=yes
|
||||
```
|
||||
1. Restart the firewall with the new ports:
|
||||
```
|
||||
SuSEfirewall2
|
||||
```
|
||||
```
|
||||
SuSEfirewall2
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ For Kubernetes v1.21 and up, the NGINX Ingress controller no longer runs in host
|
||||
|
||||
Because of this change to the controller, the default behavior no longer sets `hostNetwork` to `true`. However, you must set `hostNetwork` to `true` for TCP- and UDP-based Services to work.
|
||||
|
||||
:::note
|
||||
:::
|
||||
|
||||
|
||||
- [Specify a hostname to use](#specify-a-hostname-to-use)
|
||||
|
||||
Reference in New Issue
Block a user