diff --git a/docs/how-to-guides/new-user-guides/kubernetes-cluster-setup/rke1-for-rancher.md b/docs/how-to-guides/new-user-guides/kubernetes-cluster-setup/rke1-for-rancher.md deleted file mode 100644 index 9455eaef0be..00000000000 --- a/docs/how-to-guides/new-user-guides/kubernetes-cluster-setup/rke1-for-rancher.md +++ /dev/null @@ -1,198 +0,0 @@ ---- -title: Setting up a High-availability RKE Kubernetes Cluster ---- - - - - - - - -This section describes how to install a Kubernetes cluster. This cluster should be dedicated to run only the Rancher server. - -:::note - -Rancher can run on any Kubernetes cluster, included hosted Kubernetes solutions such as Amazon EKS. The below instructions represent only one possible way to install Kubernetes. - -::: - -For systems without direct internet access, refer to [Air Gap: Kubernetes install.](../../../getting-started/installation-and-upgrade/other-installation-methods/air-gapped-helm-cli-install/air-gapped-helm-cli-install.md) - -:::tip Single-node Installation Tip: - -In a single-node Kubernetes cluster, the Rancher server does not have high availability, which is important for running Rancher in production. However, installing Rancher on a single-node cluster can be useful if you want to save resources by using a single node in the short term, while preserving a high-availability migration path. - -To set up a single-node RKE cluster, configure only one node in the `cluster.yml` . The single node should have all three roles: `etcd`, `controlplane`, and `worker`. - -In both single-node setups, Rancher can be installed with Helm on the Kubernetes cluster in the same way that it would be installed on any other cluster. - -::: - -## Installing Kubernetes - -### Required CLI Tools - -Install [kubectl,](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl) a Kubernetes command-line tool. - -Also install [RKE,](https://rancher.com/docs/rke/latest/en/installation/) the Rancher Kubernetes Engine, a Kubernetes distribution and command-line tool. - -### 1. Create the cluster configuration file - -In this section, you will create a Kubernetes cluster configuration file called `rancher-cluster.yml`. In a later step, when you set up the cluster with an RKE command, it will use this file to install Kubernetes on your nodes. - -Using the sample below as a guide, create the `rancher-cluster.yml` file. Replace the IP addresses in the `nodes` list with the IP address or DNS names of the 3 nodes you created. - -If your node has public and internal addresses, it is recommended to set the `internal_address:` so Kubernetes will use it for intra-cluster communication. Some services like AWS EC2 require setting the `internal_address:` if you want to use self-referencing security groups or firewalls. - -RKE will need to connect to each node over SSH, and it will look for a private key in the default location of `~/.ssh/id_rsa`. If your private key for a certain node is in a different location than the default, you will also need to configure the `ssh_key_path` option for that node. - -When choosing a Kubernetes version, be sure to first consult the [support matrix](https://rancher.com/support-matrix/) to find the highest version of Kubernetes that has been validated for your Rancher version. - -```yaml -nodes: - - address: 165.227.114.63 - internal_address: 172.16.22.12 - user: ubuntu - role: [controlplane, worker, etcd] - - address: 165.227.116.167 - internal_address: 172.16.32.37 - user: ubuntu - role: [controlplane, worker, etcd] - - address: 165.227.127.226 - internal_address: 172.16.42.73 - user: ubuntu - role: [controlplane, worker, etcd] - -services: - etcd: - snapshot: true - creation: 6h - retention: 24h - -# Required for external TLS termination with -# ingress-nginx v0.22+ -ingress: - provider: nginx - options: - use-forwarded-headers: "true" - -kubernetes_version: v1.25.6-rancher4-1 -``` - -
Common RKE Nodes Options
- -| Option | Required | Description | -| ------------------ | -------- | -------------------------------------------------------------------------------------- | -| `address` | yes | The public DNS or IP address | -| `user` | yes | A user that can run docker commands | -| `role` | yes | List of Kubernetes roles assigned to the node | -| `internal_address` | no | The private DNS or IP address for internal cluster traffic | -| `ssh_key_path` | no | Path to SSH private key used to authenticate to the node (defaults to `~/.ssh/id_rsa`) | - -:::note Advanced Configurations: - -RKE has many configuration options for customizing the install to suit your specific environment. - -Please see the [RKE Documentation](https://rancher.com/docs/rke/latest/en/config-options/) for the full list of options and capabilities. - -For tuning your etcd cluster for larger Rancher installations, see the [etcd settings guide](../../advanced-user-guides/tune-etcd-for-large-installs.md). - -For more information regarding Dockershim support, refer to [this page](../../../getting-started/installation-and-upgrade/installation-requirements/dockershim.md) - -::: - -### 2. Run RKE - -``` -rke up --config ./rancher-cluster.yml -``` - -When finished, it should end with the line: `Finished building Kubernetes cluster successfully`. - -### 3. Test Your Cluster - -This section describes how to set up your workspace so that you can interact with this cluster using the `kubectl` command-line tool. - -Assuming you have installed `kubectl`, you need to place the `kubeconfig` file in a location where `kubectl` can reach it. The `kubeconfig` file contains the credentials necessary to access your cluster with `kubectl`. - -When you ran `rke up`, RKE should have created a `kubeconfig` file named `kube_config_cluster.yml`. This file has the credentials for `kubectl` and `helm`. - -:::note - -If you have used a different file name from `rancher-cluster.yml`, then the kube config file will be named `kube_config_.yml`. - -::: - -Move this file to `$HOME/.kube/config`, or if you are working with multiple Kubernetes clusters, set the `KUBECONFIG` environmental variable to the path of `kube_config_cluster.yml`: - -``` -export KUBECONFIG=$(pwd)/kube_config_cluster.yml -``` - -Test your connectivity with `kubectl` and see if all your nodes are in `Ready` state: - -``` -kubectl get nodes - -NAME STATUS ROLES AGE VERSION -165.227.114.63 Ready controlplane,etcd,worker 11m v1.13.5 -165.227.116.167 Ready controlplane,etcd,worker 11m v1.13.5 -165.227.127.226 Ready controlplane,etcd,worker 11m v1.13.5 -``` - -### 4. Check the Health of Your Cluster Pods - -Check that all the required pods and containers are healthy are ready to continue. - -- Pods are in `Running` or `Completed` state. -- `READY` column shows all the containers are running (i.e. `3/3`) for pods with `STATUS` `Running` -- Pods with `STATUS` `Completed` are run-once Jobs. For these pods `READY` should be `0/1`. - -``` -kubectl get pods --all-namespaces - -NAMESPACE NAME READY STATUS RESTARTS AGE -ingress-nginx nginx-ingress-controller-tnsn4 1/1 Running 0 30s -ingress-nginx nginx-ingress-controller-tw2ht 1/1 Running 0 30s -ingress-nginx nginx-ingress-controller-v874b 1/1 Running 0 30s -kube-system canal-jp4hz 3/3 Running 0 30s -kube-system canal-z2hg8 3/3 Running 0 30s -kube-system canal-z6kpw 3/3 Running 0 30s -kube-system kube-dns-7588d5b5f5-sf4vh 3/3 Running 0 30s -kube-system kube-dns-autoscaler-5db9bbb766-jz2k6 1/1 Running 0 30s -kube-system metrics-server-97bc649d5-4rl2q 1/1 Running 0 30s -kube-system rke-ingress-controller-deploy-job-bhzgm 0/1 Completed 0 30s -kube-system rke-kubedns-addon-deploy-job-gl7t4 0/1 Completed 0 30s -kube-system rke-metrics-addon-deploy-job-7ljkc 0/1 Completed 0 30s -kube-system rke-network-plugin-deploy-job-6pbgj 0/1 Completed 0 30s -``` - -This confirms that you have successfully installed a Kubernetes cluster that the Rancher server will run on. - -### 5. Save Your Files - -:::note Important: - -The files mentioned below are needed to maintain, troubleshoot and upgrade your cluster. - -::: - -Save a copy of the following files in a secure location: - -- `rancher-cluster.yml`: The RKE cluster configuration file. -- `kube_config_cluster.yml`: The [Kubeconfig file](https://rancher.com/docs/rke/latest/en/kubeconfig/) for the cluster, this file contains credentials for full access to the cluster. -- `rancher-cluster.rkestate`: The [Kubernetes Cluster State file](https://rancher.com/docs/rke/latest/en/installation/#kubernetes-cluster-state), this file contains credentials for full access to the cluster.

_The Kubernetes Cluster State file is only created when using RKE v0.2.0 or higher._ - -:::note - -The "rancher-cluster" parts of the two latter file names are dependent on how you name the RKE cluster configuration file. - -::: - -### Issues or errors? - -See the [Troubleshooting](../../../getting-started/installation-and-upgrade/install-upgrade-on-a-kubernetes-cluster/troubleshooting.md) page. - - -### [Next: Install Rancher](../../../getting-started/installation-and-upgrade/install-upgrade-on-a-kubernetes-cluster/install-upgrade-on-a-kubernetes-cluster.md) - diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/how-to-guides/new-user-guides/kubernetes-cluster-setup/rke1-for-rancher.md b/i18n/zh/docusaurus-plugin-content-docs/current/how-to-guides/new-user-guides/kubernetes-cluster-setup/rke1-for-rancher.md deleted file mode 100644 index 9aa7c5d65a9..00000000000 --- a/i18n/zh/docusaurus-plugin-content-docs/current/how-to-guides/new-user-guides/kubernetes-cluster-setup/rke1-for-rancher.md +++ /dev/null @@ -1,195 +0,0 @@ ---- -title: 配置高可用的 RKE Kubernetes 集群 ---- - - - -本文介绍如何安装 Kubernetes 集群。该集群应专用于运行 Rancher Server。 - -:::note - -Rancher 可以运行在任何 Kubernetes 集群上,包括托管的 Kubernetes,例如 Amazon EKS。以下说明只是安装 Kubernetes 其中一种方式。 - -::: - -如果系统无法直接访问互联网,请参见[离线环境:Kubernetes 安装](../../../getting-started/installation-and-upgrade/other-installation-methods/air-gapped-helm-cli-install/air-gapped-helm-cli-install.md)。 - -:::tip 单节点安装提示: - -在单节点 Kubernetes 集群中,Rancher Server 不具备高可用性,而高可用性对在生产环境中运行 Rancher 非常重要。但是,如果你想要短期内使用单节点节省资源,同时又保留高可用性迁移路径,把 Rancher 安装到单节点集群也是合适的。 - -要设置单节点 RKE 集群,在 `cluster.yml` 中配置一个节点。该节点需具备所有三个角色,分别是`etcd`,`controlplane`和`worker`。 - -在这两种单节点设置中,Rancher 可以与 Helm 一起安装在 Kubernetes 集群上,安装方法与安装到其他集群上一样。 - -::: - -## 安装 Kubernetes - -### 所需的 CLI 工具 - -安装 Kubernetes 命令行工具 [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl)。 - -安装 [RKE](https://rancher.com/docs/rke/latest/en/installation/)(Rancher Kubernetes Engine,是一个 Kubernetes 发行版和命令行工具)。 - -### 1. 创建集群配置文件 - -在这部分,你将创建一个名为 `rancher-cluster.yml`的 Kubernetes 集群配置文件。在后续使用 RKE 命令设置集群的步骤中,此文件会用于在节点上安装 Kubernetes。 - -使用下面的示例作为指南,创建 `rancher-cluster.yml` 文件。将 `nodes` 列表中的 IP 地址替换为你创建的 3 个节点的 IP 地址或 DNS 名称。 - -如果你的节点有公共地址和内部地址,建议设置 `internal_address:` 以便 Kubernetes 使用它实现集群内部通信。如果你想使用引用安全组或防火墙,某些服务(如 AWS EC2)要求设置 `internal_address:`。 - -RKE 需要通过 SSH 连接到每个节点,它会在 `~/.ssh/id_rsa`的默认位置查找私钥。如果某个节点的私钥不在默认位置中,你还需要为该节点配置 `ssh_key_path` 选项。 - -在选择 Kubernetes 版本时,请务必先查阅[支持矩阵](https://rancher.com/support-matrix/),以找出已针对你的 Rancher 版本验证的最新 Kubernetes 版本。 - -```yaml -nodes: - - address: 165.227.114.63 - internal_address: 172.16.22.12 - user: ubuntu - role: [controlplane, worker, etcd] - - address: 165.227.116.167 - internal_address: 172.16.32.37 - user: ubuntu - role: [controlplane, worker, etcd] - - address: 165.227.127.226 - internal_address: 172.16.42.73 - user: ubuntu - role: [controlplane, worker, etcd] - -services: - etcd: - snapshot: true - creation: 6h - retention: 24h - -# Required for external TLS termination with -# ingress-nginx v0.22+ -ingress: - provider: nginx - options: - use-forwarded-headers: "true" - -kubernetes_version: v1.25.6-rancher4-1 -``` - -
通用 RKE 节点选项
- -| 选项 | 必填 | 描述 | -| ------------------ | -------- | -------------------------------------------------------------------------------------- | -| `address` | 是 | 公共 DNS 或 IP 地址 | -| `user` | 是 | 可以运行 docker 命令的用户 | -| `role` | 是 | 分配给节点的 Kubernetes 角色列表 | -| `internal_address` | 否 | 内部集群流量的私有 DNS 或 IP 地址 | -| `ssh_key_path` | 否 | 用来验证节点的 SSH 私钥文件路径(默认值为 `~/.ssh/id_rsa`) | - -:::note 高级配置: - -RKE 提供大量配置选项,用于针对你的环境进行自定义安装。 - -如需了解选项和功能的完整列表,请参见 [RKE 官方文档](https://rancher.com/docs/rke/latest/en/config-options/)。 - -要为大规模 Rancher 安装优化 etcd 集群,请参见 [etcd 设置指南](../../advanced-user-guides/tune-etcd-for-large-installs.md)。 - -有关 Dockershim 支持的详情,请参见[此页面](../../../getting-started/installation-and-upgrade/installation-requirements/dockershim.md)。 - -::: - -### 2. 运行 RKE - -``` -rke up --config ./rancher-cluster.yml -``` - -完成后,结束行应该是:`Finished build Kubernetes cluster succeeded`。 - -### 3. 测试集群 - -本节介绍如何设置工作区,以便你可以使用 `kubectl` 命令行工具与此集群进行交互。 - -如果你已安装 `kubectl`,你需要将 `kubeconfig` 文件放在 `kubectl` 可访问的位置。`kubeconfig` 文件包含使用 `kubectl` 访问集群所需的凭证。 - -你在运行 `rke up` 时,RKE 应该已经创建了一个名为 `kube_config_cluster.yml`的 `kubeconfig` 文件。该文件具有 `kubectl` 和 `helm`的凭证。 - -:::note - -如果你的文件名不是 `rancher-cluster.yml`,kubeconfig 文件将命名为 `kube_config_.yml`。 - -::: - -将此文件移动到 `$HOME/.kube/config`。如果你使用多个 Kubernetes 集群,将 `KUBECONFIG` 环境变量设置为 `kube_config_cluster.yml` 的路径: - -``` -export KUBECONFIG=$(pwd)/kube_config_cluster.yml -``` - -用 `kubectl` 测试你的连接性,并查看你的所有节点是否都处于 `Ready` 状态: - -``` -kubectl get nodes - -NAME STATUS ROLES AGE VERSION -165.227.114.63 Ready controlplane,etcd,worker 11m v1.13.5 -165.227.116.167 Ready controlplane,etcd,worker 11m v1.13.5 -165.227.127.226 Ready controlplane,etcd,worker 11m v1.13.5 -``` - -### 4. 检查集群 Pod 的健康状况 - -检查所有需要的 Pod 和容器是否健康。 - -- Pod 处于 `Running` 或 `Completed` 状态。 -- `READY` 表示运行 `STATUS` 为 `Running` 的 Pod 的所有容器(例如, `3/3`)。 -- `STATUS` 为 `Completed` 的 Pod 是一次运行的 Job。这些 Pod `READY` 列的值应该为 `0/1`。 - -``` -kubectl get pods --all-namespaces - -NAMESPACE NAME READY STATUS RESTARTS AGE -ingress-nginx nginx-ingress-controller-tnsn4 1/1 Running 0 30s -ingress-nginx nginx-ingress-controller-tw2ht 1/1 Running 0 30s -ingress-nginx nginx-ingress-controller-v874b 1/1 Running 0 30s -kube-system canal-jp4hz 3/3 Running 0 30s -kube-system canal-z2hg8 3/3 Running 0 30s -kube-system canal-z6kpw 3/3 Running 0 30s -kube-system kube-dns-7588d5b5f5-sf4vh 3/3 Running 0 30s -kube-system kube-dns-autoscaler-5db9bbb766-jz2k6 1/1 Running 0 30s -kube-system metrics-server-97bc649d5-4rl2q 1/1 Running 0 30s -kube-system rke-ingress-controller-deploy-job-bhzgm 0/1 Completed 0 30s -kube-system rke-kubedns-addon-deploy-job-gl7t4 0/1 Completed 0 30s -kube-system rke-metrics-addon-deploy-job-7ljkc 0/1 Completed 0 30s -kube-system rke-network-plugin-deploy-job-6pbgj 0/1 Completed 0 30s -``` - -这表示你已成功安装了可运行 Rancher Server 的 Kubernetes 集群。 - -### 5. 保存你的文件 - -:::note 重要提示: - -维护、排除问题和升级集群需要用到以下文件,请妥善保管这些文件: - -::: - -将以下文件的副本保存在安全位置: - -- `rancher-cluster.yml`:RKE 集群配置文件。 -- `kube_config_cluster.yml`:集群的 [Kubeconfig 文件](https://rancher.com/docs/rke/latest/en/kubeconfig/)。该文件包含可完全访问集群的凭证。 -- `rancher-cluster.rkestate`:[Kubernetes 状态文件](https://rancher.com/docs/rke/latest/en/installation/#kubernetes-cluster-state)。此文件包括用于完全访问集群的凭证。

_Kubernetes 集群状态文件仅在 RKE 版本是 0.2.0 或更高版本时生成。_ - -:::note - -后两个文件名中的 `rancher-cluster` 部分取决于你命名 RKE 集群配置文件的方式。 - -::: - -### 故障排除 - -参见[故障排除](../../../getting-started/installation-and-upgrade/install-upgrade-on-a-kubernetes-cluster/troubleshooting.md)页面。 - - -### 后续操作 -[安装 Rancher](../../../getting-started/installation-and-upgrade/install-upgrade-on-a-kubernetes-cluster/install-upgrade-on-a-kubernetes-cluster.md) - diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-2.12/how-to-guides/new-user-guides/kubernetes-cluster-setup/rke1-for-rancher.md b/i18n/zh/docusaurus-plugin-content-docs/version-2.12/how-to-guides/new-user-guides/kubernetes-cluster-setup/rke1-for-rancher.md deleted file mode 100644 index 9aa7c5d65a9..00000000000 --- a/i18n/zh/docusaurus-plugin-content-docs/version-2.12/how-to-guides/new-user-guides/kubernetes-cluster-setup/rke1-for-rancher.md +++ /dev/null @@ -1,195 +0,0 @@ ---- -title: 配置高可用的 RKE Kubernetes 集群 ---- - - - -本文介绍如何安装 Kubernetes 集群。该集群应专用于运行 Rancher Server。 - -:::note - -Rancher 可以运行在任何 Kubernetes 集群上,包括托管的 Kubernetes,例如 Amazon EKS。以下说明只是安装 Kubernetes 其中一种方式。 - -::: - -如果系统无法直接访问互联网,请参见[离线环境:Kubernetes 安装](../../../getting-started/installation-and-upgrade/other-installation-methods/air-gapped-helm-cli-install/air-gapped-helm-cli-install.md)。 - -:::tip 单节点安装提示: - -在单节点 Kubernetes 集群中,Rancher Server 不具备高可用性,而高可用性对在生产环境中运行 Rancher 非常重要。但是,如果你想要短期内使用单节点节省资源,同时又保留高可用性迁移路径,把 Rancher 安装到单节点集群也是合适的。 - -要设置单节点 RKE 集群,在 `cluster.yml` 中配置一个节点。该节点需具备所有三个角色,分别是`etcd`,`controlplane`和`worker`。 - -在这两种单节点设置中,Rancher 可以与 Helm 一起安装在 Kubernetes 集群上,安装方法与安装到其他集群上一样。 - -::: - -## 安装 Kubernetes - -### 所需的 CLI 工具 - -安装 Kubernetes 命令行工具 [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl)。 - -安装 [RKE](https://rancher.com/docs/rke/latest/en/installation/)(Rancher Kubernetes Engine,是一个 Kubernetes 发行版和命令行工具)。 - -### 1. 创建集群配置文件 - -在这部分,你将创建一个名为 `rancher-cluster.yml`的 Kubernetes 集群配置文件。在后续使用 RKE 命令设置集群的步骤中,此文件会用于在节点上安装 Kubernetes。 - -使用下面的示例作为指南,创建 `rancher-cluster.yml` 文件。将 `nodes` 列表中的 IP 地址替换为你创建的 3 个节点的 IP 地址或 DNS 名称。 - -如果你的节点有公共地址和内部地址,建议设置 `internal_address:` 以便 Kubernetes 使用它实现集群内部通信。如果你想使用引用安全组或防火墙,某些服务(如 AWS EC2)要求设置 `internal_address:`。 - -RKE 需要通过 SSH 连接到每个节点,它会在 `~/.ssh/id_rsa`的默认位置查找私钥。如果某个节点的私钥不在默认位置中,你还需要为该节点配置 `ssh_key_path` 选项。 - -在选择 Kubernetes 版本时,请务必先查阅[支持矩阵](https://rancher.com/support-matrix/),以找出已针对你的 Rancher 版本验证的最新 Kubernetes 版本。 - -```yaml -nodes: - - address: 165.227.114.63 - internal_address: 172.16.22.12 - user: ubuntu - role: [controlplane, worker, etcd] - - address: 165.227.116.167 - internal_address: 172.16.32.37 - user: ubuntu - role: [controlplane, worker, etcd] - - address: 165.227.127.226 - internal_address: 172.16.42.73 - user: ubuntu - role: [controlplane, worker, etcd] - -services: - etcd: - snapshot: true - creation: 6h - retention: 24h - -# Required for external TLS termination with -# ingress-nginx v0.22+ -ingress: - provider: nginx - options: - use-forwarded-headers: "true" - -kubernetes_version: v1.25.6-rancher4-1 -``` - -
通用 RKE 节点选项
- -| 选项 | 必填 | 描述 | -| ------------------ | -------- | -------------------------------------------------------------------------------------- | -| `address` | 是 | 公共 DNS 或 IP 地址 | -| `user` | 是 | 可以运行 docker 命令的用户 | -| `role` | 是 | 分配给节点的 Kubernetes 角色列表 | -| `internal_address` | 否 | 内部集群流量的私有 DNS 或 IP 地址 | -| `ssh_key_path` | 否 | 用来验证节点的 SSH 私钥文件路径(默认值为 `~/.ssh/id_rsa`) | - -:::note 高级配置: - -RKE 提供大量配置选项,用于针对你的环境进行自定义安装。 - -如需了解选项和功能的完整列表,请参见 [RKE 官方文档](https://rancher.com/docs/rke/latest/en/config-options/)。 - -要为大规模 Rancher 安装优化 etcd 集群,请参见 [etcd 设置指南](../../advanced-user-guides/tune-etcd-for-large-installs.md)。 - -有关 Dockershim 支持的详情,请参见[此页面](../../../getting-started/installation-and-upgrade/installation-requirements/dockershim.md)。 - -::: - -### 2. 运行 RKE - -``` -rke up --config ./rancher-cluster.yml -``` - -完成后,结束行应该是:`Finished build Kubernetes cluster succeeded`。 - -### 3. 测试集群 - -本节介绍如何设置工作区,以便你可以使用 `kubectl` 命令行工具与此集群进行交互。 - -如果你已安装 `kubectl`,你需要将 `kubeconfig` 文件放在 `kubectl` 可访问的位置。`kubeconfig` 文件包含使用 `kubectl` 访问集群所需的凭证。 - -你在运行 `rke up` 时,RKE 应该已经创建了一个名为 `kube_config_cluster.yml`的 `kubeconfig` 文件。该文件具有 `kubectl` 和 `helm`的凭证。 - -:::note - -如果你的文件名不是 `rancher-cluster.yml`,kubeconfig 文件将命名为 `kube_config_.yml`。 - -::: - -将此文件移动到 `$HOME/.kube/config`。如果你使用多个 Kubernetes 集群,将 `KUBECONFIG` 环境变量设置为 `kube_config_cluster.yml` 的路径: - -``` -export KUBECONFIG=$(pwd)/kube_config_cluster.yml -``` - -用 `kubectl` 测试你的连接性,并查看你的所有节点是否都处于 `Ready` 状态: - -``` -kubectl get nodes - -NAME STATUS ROLES AGE VERSION -165.227.114.63 Ready controlplane,etcd,worker 11m v1.13.5 -165.227.116.167 Ready controlplane,etcd,worker 11m v1.13.5 -165.227.127.226 Ready controlplane,etcd,worker 11m v1.13.5 -``` - -### 4. 检查集群 Pod 的健康状况 - -检查所有需要的 Pod 和容器是否健康。 - -- Pod 处于 `Running` 或 `Completed` 状态。 -- `READY` 表示运行 `STATUS` 为 `Running` 的 Pod 的所有容器(例如, `3/3`)。 -- `STATUS` 为 `Completed` 的 Pod 是一次运行的 Job。这些 Pod `READY` 列的值应该为 `0/1`。 - -``` -kubectl get pods --all-namespaces - -NAMESPACE NAME READY STATUS RESTARTS AGE -ingress-nginx nginx-ingress-controller-tnsn4 1/1 Running 0 30s -ingress-nginx nginx-ingress-controller-tw2ht 1/1 Running 0 30s -ingress-nginx nginx-ingress-controller-v874b 1/1 Running 0 30s -kube-system canal-jp4hz 3/3 Running 0 30s -kube-system canal-z2hg8 3/3 Running 0 30s -kube-system canal-z6kpw 3/3 Running 0 30s -kube-system kube-dns-7588d5b5f5-sf4vh 3/3 Running 0 30s -kube-system kube-dns-autoscaler-5db9bbb766-jz2k6 1/1 Running 0 30s -kube-system metrics-server-97bc649d5-4rl2q 1/1 Running 0 30s -kube-system rke-ingress-controller-deploy-job-bhzgm 0/1 Completed 0 30s -kube-system rke-kubedns-addon-deploy-job-gl7t4 0/1 Completed 0 30s -kube-system rke-metrics-addon-deploy-job-7ljkc 0/1 Completed 0 30s -kube-system rke-network-plugin-deploy-job-6pbgj 0/1 Completed 0 30s -``` - -这表示你已成功安装了可运行 Rancher Server 的 Kubernetes 集群。 - -### 5. 保存你的文件 - -:::note 重要提示: - -维护、排除问题和升级集群需要用到以下文件,请妥善保管这些文件: - -::: - -将以下文件的副本保存在安全位置: - -- `rancher-cluster.yml`:RKE 集群配置文件。 -- `kube_config_cluster.yml`:集群的 [Kubeconfig 文件](https://rancher.com/docs/rke/latest/en/kubeconfig/)。该文件包含可完全访问集群的凭证。 -- `rancher-cluster.rkestate`:[Kubernetes 状态文件](https://rancher.com/docs/rke/latest/en/installation/#kubernetes-cluster-state)。此文件包括用于完全访问集群的凭证。

_Kubernetes 集群状态文件仅在 RKE 版本是 0.2.0 或更高版本时生成。_ - -:::note - -后两个文件名中的 `rancher-cluster` 部分取决于你命名 RKE 集群配置文件的方式。 - -::: - -### 故障排除 - -参见[故障排除](../../../getting-started/installation-and-upgrade/install-upgrade-on-a-kubernetes-cluster/troubleshooting.md)页面。 - - -### 后续操作 -[安装 Rancher](../../../getting-started/installation-and-upgrade/install-upgrade-on-a-kubernetes-cluster/install-upgrade-on-a-kubernetes-cluster.md) - diff --git a/versioned_docs/version-2.12/how-to-guides/new-user-guides/kubernetes-cluster-setup/rke1-for-rancher.md b/versioned_docs/version-2.12/how-to-guides/new-user-guides/kubernetes-cluster-setup/rke1-for-rancher.md deleted file mode 100644 index 9455eaef0be..00000000000 --- a/versioned_docs/version-2.12/how-to-guides/new-user-guides/kubernetes-cluster-setup/rke1-for-rancher.md +++ /dev/null @@ -1,198 +0,0 @@ ---- -title: Setting up a High-availability RKE Kubernetes Cluster ---- - - - - - - - -This section describes how to install a Kubernetes cluster. This cluster should be dedicated to run only the Rancher server. - -:::note - -Rancher can run on any Kubernetes cluster, included hosted Kubernetes solutions such as Amazon EKS. The below instructions represent only one possible way to install Kubernetes. - -::: - -For systems without direct internet access, refer to [Air Gap: Kubernetes install.](../../../getting-started/installation-and-upgrade/other-installation-methods/air-gapped-helm-cli-install/air-gapped-helm-cli-install.md) - -:::tip Single-node Installation Tip: - -In a single-node Kubernetes cluster, the Rancher server does not have high availability, which is important for running Rancher in production. However, installing Rancher on a single-node cluster can be useful if you want to save resources by using a single node in the short term, while preserving a high-availability migration path. - -To set up a single-node RKE cluster, configure only one node in the `cluster.yml` . The single node should have all three roles: `etcd`, `controlplane`, and `worker`. - -In both single-node setups, Rancher can be installed with Helm on the Kubernetes cluster in the same way that it would be installed on any other cluster. - -::: - -## Installing Kubernetes - -### Required CLI Tools - -Install [kubectl,](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl) a Kubernetes command-line tool. - -Also install [RKE,](https://rancher.com/docs/rke/latest/en/installation/) the Rancher Kubernetes Engine, a Kubernetes distribution and command-line tool. - -### 1. Create the cluster configuration file - -In this section, you will create a Kubernetes cluster configuration file called `rancher-cluster.yml`. In a later step, when you set up the cluster with an RKE command, it will use this file to install Kubernetes on your nodes. - -Using the sample below as a guide, create the `rancher-cluster.yml` file. Replace the IP addresses in the `nodes` list with the IP address or DNS names of the 3 nodes you created. - -If your node has public and internal addresses, it is recommended to set the `internal_address:` so Kubernetes will use it for intra-cluster communication. Some services like AWS EC2 require setting the `internal_address:` if you want to use self-referencing security groups or firewalls. - -RKE will need to connect to each node over SSH, and it will look for a private key in the default location of `~/.ssh/id_rsa`. If your private key for a certain node is in a different location than the default, you will also need to configure the `ssh_key_path` option for that node. - -When choosing a Kubernetes version, be sure to first consult the [support matrix](https://rancher.com/support-matrix/) to find the highest version of Kubernetes that has been validated for your Rancher version. - -```yaml -nodes: - - address: 165.227.114.63 - internal_address: 172.16.22.12 - user: ubuntu - role: [controlplane, worker, etcd] - - address: 165.227.116.167 - internal_address: 172.16.32.37 - user: ubuntu - role: [controlplane, worker, etcd] - - address: 165.227.127.226 - internal_address: 172.16.42.73 - user: ubuntu - role: [controlplane, worker, etcd] - -services: - etcd: - snapshot: true - creation: 6h - retention: 24h - -# Required for external TLS termination with -# ingress-nginx v0.22+ -ingress: - provider: nginx - options: - use-forwarded-headers: "true" - -kubernetes_version: v1.25.6-rancher4-1 -``` - -
Common RKE Nodes Options
- -| Option | Required | Description | -| ------------------ | -------- | -------------------------------------------------------------------------------------- | -| `address` | yes | The public DNS or IP address | -| `user` | yes | A user that can run docker commands | -| `role` | yes | List of Kubernetes roles assigned to the node | -| `internal_address` | no | The private DNS or IP address for internal cluster traffic | -| `ssh_key_path` | no | Path to SSH private key used to authenticate to the node (defaults to `~/.ssh/id_rsa`) | - -:::note Advanced Configurations: - -RKE has many configuration options for customizing the install to suit your specific environment. - -Please see the [RKE Documentation](https://rancher.com/docs/rke/latest/en/config-options/) for the full list of options and capabilities. - -For tuning your etcd cluster for larger Rancher installations, see the [etcd settings guide](../../advanced-user-guides/tune-etcd-for-large-installs.md). - -For more information regarding Dockershim support, refer to [this page](../../../getting-started/installation-and-upgrade/installation-requirements/dockershim.md) - -::: - -### 2. Run RKE - -``` -rke up --config ./rancher-cluster.yml -``` - -When finished, it should end with the line: `Finished building Kubernetes cluster successfully`. - -### 3. Test Your Cluster - -This section describes how to set up your workspace so that you can interact with this cluster using the `kubectl` command-line tool. - -Assuming you have installed `kubectl`, you need to place the `kubeconfig` file in a location where `kubectl` can reach it. The `kubeconfig` file contains the credentials necessary to access your cluster with `kubectl`. - -When you ran `rke up`, RKE should have created a `kubeconfig` file named `kube_config_cluster.yml`. This file has the credentials for `kubectl` and `helm`. - -:::note - -If you have used a different file name from `rancher-cluster.yml`, then the kube config file will be named `kube_config_.yml`. - -::: - -Move this file to `$HOME/.kube/config`, or if you are working with multiple Kubernetes clusters, set the `KUBECONFIG` environmental variable to the path of `kube_config_cluster.yml`: - -``` -export KUBECONFIG=$(pwd)/kube_config_cluster.yml -``` - -Test your connectivity with `kubectl` and see if all your nodes are in `Ready` state: - -``` -kubectl get nodes - -NAME STATUS ROLES AGE VERSION -165.227.114.63 Ready controlplane,etcd,worker 11m v1.13.5 -165.227.116.167 Ready controlplane,etcd,worker 11m v1.13.5 -165.227.127.226 Ready controlplane,etcd,worker 11m v1.13.5 -``` - -### 4. Check the Health of Your Cluster Pods - -Check that all the required pods and containers are healthy are ready to continue. - -- Pods are in `Running` or `Completed` state. -- `READY` column shows all the containers are running (i.e. `3/3`) for pods with `STATUS` `Running` -- Pods with `STATUS` `Completed` are run-once Jobs. For these pods `READY` should be `0/1`. - -``` -kubectl get pods --all-namespaces - -NAMESPACE NAME READY STATUS RESTARTS AGE -ingress-nginx nginx-ingress-controller-tnsn4 1/1 Running 0 30s -ingress-nginx nginx-ingress-controller-tw2ht 1/1 Running 0 30s -ingress-nginx nginx-ingress-controller-v874b 1/1 Running 0 30s -kube-system canal-jp4hz 3/3 Running 0 30s -kube-system canal-z2hg8 3/3 Running 0 30s -kube-system canal-z6kpw 3/3 Running 0 30s -kube-system kube-dns-7588d5b5f5-sf4vh 3/3 Running 0 30s -kube-system kube-dns-autoscaler-5db9bbb766-jz2k6 1/1 Running 0 30s -kube-system metrics-server-97bc649d5-4rl2q 1/1 Running 0 30s -kube-system rke-ingress-controller-deploy-job-bhzgm 0/1 Completed 0 30s -kube-system rke-kubedns-addon-deploy-job-gl7t4 0/1 Completed 0 30s -kube-system rke-metrics-addon-deploy-job-7ljkc 0/1 Completed 0 30s -kube-system rke-network-plugin-deploy-job-6pbgj 0/1 Completed 0 30s -``` - -This confirms that you have successfully installed a Kubernetes cluster that the Rancher server will run on. - -### 5. Save Your Files - -:::note Important: - -The files mentioned below are needed to maintain, troubleshoot and upgrade your cluster. - -::: - -Save a copy of the following files in a secure location: - -- `rancher-cluster.yml`: The RKE cluster configuration file. -- `kube_config_cluster.yml`: The [Kubeconfig file](https://rancher.com/docs/rke/latest/en/kubeconfig/) for the cluster, this file contains credentials for full access to the cluster. -- `rancher-cluster.rkestate`: The [Kubernetes Cluster State file](https://rancher.com/docs/rke/latest/en/installation/#kubernetes-cluster-state), this file contains credentials for full access to the cluster.

_The Kubernetes Cluster State file is only created when using RKE v0.2.0 or higher._ - -:::note - -The "rancher-cluster" parts of the two latter file names are dependent on how you name the RKE cluster configuration file. - -::: - -### Issues or errors? - -See the [Troubleshooting](../../../getting-started/installation-and-upgrade/install-upgrade-on-a-kubernetes-cluster/troubleshooting.md) page. - - -### [Next: Install Rancher](../../../getting-started/installation-and-upgrade/install-upgrade-on-a-kubernetes-cluster/install-upgrade-on-a-kubernetes-cluster.md) -