- ☸️ Установка производственного кластера Kubernetes с Rancher RKE
- Что такое RKE?
- Подготовка рабочей станции
- Установка Kubernetes с RKE
- RKE Поддерживаемые операционные системы
- Шаг 1: Обновите вашу систему Linux
- Шаг 2: Создайте пользователя rke
- Используя Ansible Playbook:
- Создание пользователя вручную на всех хостах
- Шаг 3: Включите необходимые модули ядра:
- Ручной способ
- Шаг 4: Отключите SWAP и измените записи sysctl
- Шаг 5: Установите поддерживаемую версию Docker
- Шаг 6: Откройте порты на брандмауэре
- Шаг 6: разрешить проброс SSH TCP
- Шаг 7: Сгенерируйте файл конфигурации кластера RKE.
- Installation Requirements
- Operating Systems and Container Runtime Requirements
- RKE Specific Requirements
- K3s Specific Requirements
- RancherD Specific Requirements
- RKE2 Specific Requirements
- Installing Docker
- Hardware Requirements
- CPU and Memory
- RKE and Hosted Kubernetes
- K3s Kubernetes
- RancherD
- RKE2 Kubernetes
- Docker
- Ingress
- Ingress for RKE2
- Ingress for EKS
- Disks
- Networking Requirements
- Node IP Addresses
- Port Requirements
- RancherD on SELinux Enforcing CentOS 8 or RHEL 8 Nodes
☸️ Установка производственного кластера Kubernetes с Rancher RKE
Как использовать RKE для развертывания готового кластера Kubernetes?
Kubernetes приобрел большую популярность и теперь является стандартным уровнем оркестрации для контейнерных рабочих нагрузок.
Если вам нужна система с открытым исходным кодом для автоматизации развертывания контейнерных приложений, не беспокоясь о масштабировании и управлении, то Kubernetes – подходящий инструмент.
Что такое RKE?
Подготовка рабочей станции
1. kubectl:
2. rke
3. helm
Установка Kubernetes с RKE
Я буду работать на 5 узлах:
- 3 мастер ноды – etcd и controlplane ( 3 для HA)
- 2воркер ноды– м асштабируйте для удовлетворения ваших потребностей
- Мастера – 8 ГБ ОЗУ и 4 vcpus
- Воркеры – 16 ГБ ОЗУ и 8 vpcus
RKE Поддерживаемые операционные системы
RKE работает практически на любой ОС Linux с установленным Docker.
Rancher был протестирован и поддерживает работу с:
- Red Hat Enterprise Linux
- Oracle Enterprise Linux
- CentOS Linux
- Ubuntu
- RancherOS
Шаг 1: Обновите вашу систему Linux
Первым шагом является обновление ваших машин Linux, которые будут использоваться для создания кластера.
Шаг 2: Создайте пользователя rke
Если вы используете Red Hat Enterprise Linux, Oracle Enterprise Linux или CentOS, вы не можете использовать пользователя root в качестве пользователя SSH из-за Bugzilla 1527565.
По этой причине мы создадим учетную запись пользователя с именем rke для целей развертывания.
Используя Ansible Playbook:
Создание пользователя вручную на всех хостах
Войдите в каждый из узлов вашего кластера и создайте пользователя rke.
Включите sudo без пароля для пользователя:
Шаг 3: Включите необходимые модули ядра:
Создайте плейбук с содержимым, показанным ниже и запустите его для инвентаризации ваших серверов RKE.
Ручной способ
Войдите на каждый хост и включите модули ядра, необходимые для запуска Kubernetes.
Шаг 4: Отключите SWAP и измените записи sysctl
Рекомендация Kubernetes – отключить swap и добавить некоторые значения sysctl.
Шаг 5: Установите поддерживаемую версию Docker
Каждая версия Kubernetes поддерживает разные версии Docker.
Примечания к выпуску Kubernetes содержат текущий список проверенных версий Docker.
На момент этой статьи, поддерживаются следующие версии Docker:
Версия Docker | скрипт установки |
---|---|
18.09.2 | curl https://releases.rancher.com/install-docker/18.09.2.sh | sh |
18.06.2 | curl https://releases.rancher.com/install-docker/18.06.2.sh | sh |
17.03.2 | curl https://releases.rancher.com/install-docker/17.03.2.sh | sh |
Запустите и включите службу Docker:
Добавить пользователя rke в группу Docker.
Шаг 6: Откройте порты на брандмауэре
- Для установки с одним узлом вам нужно только открыть порты, необходимые для того, чтобы Rancher мог взаимодействовать с нижестоящими пользовательскими кластерами.
- Для установки HA необходимо открыть те же порты, а также дополнительные порты, необходимые для настройки кластера Kubernetes, на котором установлен Rancher.
Таблицу портов можно посмотреть тут : https://rancher.com/docs/rancher/v2.x/en/installation/requirements/#operating-systems-and-docker-requirements
Шаг 6: разрешить проброс SSH TCP
Вам необходимо включить общесистемный проброс TCP вашего сервера SSH.
Откройте файл конфигурации ssh, расположенный в /etc/ssh/sshd_config:
Перезапустите службу ssh после внесения изменений.
Шаг 7: Сгенерируйте файл конфигурации кластера RKE.
RKE использует файл конфигурации кластера, называемый cluster.yml, чтобы определить, какие узлы будут в кластере и как развернуть Kubernetes.
Есть много параметров конфигурации, которые могут быть установлены в cluster.yml.
Этот файл может быть создан из минимальных примеров шаблонов или сгенерирован командой rke config.
Запустите команду rke config, чтобы создать новый cluster.yml в вашем текущем каталоге.
Эта команда запросит у вас всю информацию, необходимую для создания кластера.
Если вы хотите создать пустой файл шаблона cluster.yml, укажите флаг –empty.
Вот так выглядит мой файл конфигурации кластера – не копируйте и не вставляйте, просто используйте его как ссылку для создания собственной конфигурации.
Источник
Installation Requirements
This page describes the software, hardware, and networking requirements for the nodes where the Rancher server will be installed. The Rancher server can be installed on a single node or a high-availability Kubernetes cluster.
It is important to note that if you install Rancher on a Kubernetes cluster, requirements are different from the node requirements for downstream user clusters, which will run your apps and services.
Make sure the node(s) for the Rancher server fulfill the following requirements:
For a list of best practices that we recommend for running the Rancher server in production, refer to the best practices section.
The Rancher UI works best in Firefox or Chrome.
Operating Systems and Container Runtime Requirements
Rancher should work with any modern Linux distribution.
Docker is required for nodes that will run RKE Kubernetes clusters. It is not required for RancherD or RKE2 Kubernetes installs.
Rancher needs to be installed on a supported Kubernetes version. To find out which versions of Kubernetes are supported for your Rancher version, refer to the support maintenance terms.
For details on which OS and Docker versions were tested with each Rancher version, refer to the support maintenance terms.
All supported operating systems are 64-bit x86.
The ntp (Network Time Protocol) package should be installed. This prevents errors with certificate validation that can occur when the time is not synchronized between the client and server.
Some distributions of Linux may have default firewall rules that block communication with Helm. We recommend disabling firewalld. For Kubernetes 1.19 and 1.20, firewalld must be turned off.
If you don’t feel comfortable doing so you might check suggestions in the respective issue. Some users were successful creating a separate firewalld zone with a policy of ACCEPT for the Pod CIDR.
If you plan to run Rancher on ARM64, see Running on ARM64 (Experimental).
RKE Specific Requirements
For the container runtime, RKE should work with any modern Docker version.
K3s Specific Requirements
For the container runtime, K3s should work with any modern version of Docker or containerd.
Rancher needs to be installed on a supported Kubernetes version. To find out which versions of Kubernetes are supported for your Rancher version, refer to the support maintenance terms. To specify the K3s version, use the INSTALL_K3S_VERSION environment variable when running the K3s installation script.
If you are installing Rancher on a K3s cluster with Raspbian Buster, follow these steps to switch to legacy iptables.
If you are installing Rancher on a K3s cluster with Alpine Linux, follow these steps for additional setup.
RancherD Specific Requirements
The RancherD install is available as of v2.5.4. It is an experimental feature.
At this time, only Linux OSes that leverage systemd are supported.
To install RancherD on SELinux Enforcing CentOS 8 or RHEL 8 nodes, some additional steps are required.
Docker is not required for RancherD installs.
RKE2 Specific Requirements
The RKE2 install is available as of v2.5.6.
For details on which OS versions were tested with RKE2, refer to the support maintenance terms.
Docker is not required for RKE2 installs.
The Ingress should be deployed as DaemonSet to ensure your load balancer can successfully route traffic to all nodes. Currently, RKE2 deploys nginx-ingress as a deployment by default, so you will need to deploy it as a DaemonSet by following these steps.
Installing Docker
Docker is required for Helm chart installs, and it can be installed by following the steps in the official Docker documentation. Rancher also provides scripts to install Docker with one command.
Docker is not required for RancherD installs.
Hardware Requirements
The following sections describe the CPU, memory, and disk requirements for the nodes where the Rancher server is installed.
CPU and Memory
Hardware requirements scale based on the size of your Rancher deployment. Provision each individual node according to the requirements. The requirements are different depending on if you are installing Rancher in a single container with Docker, or if you are installing Rancher on a Kubernetes cluster.
RKE and Hosted Kubernetes
These CPU and memory requirements apply to each host in the Kubernetes cluster where the Rancher server is installed.
These requirements apply to RKE Kubernetes clusters, as well as to hosted Kubernetes clusters such as EKS.
Deployment Size | Clusters | Nodes | vCPUs | RAM |
---|---|---|---|---|
Small | Up to 150 | Up to 1500 | 2 | 8 GB |
Medium | Up to 300 | Up to 3000 | 4 | 16 GB |
Large | Up to 500 | Up to 5000 | 8 | 32 GB |
X-Large | Up to 1000 | Up to 10,000 | 16 | 64 GB |
XX-Large | Up to 2000 | Up to 20,000 | 32 | 128 GB |
Contact Rancher for more than 2000 clusters and/or 20,000 nodes.
K3s Kubernetes
These CPU and memory requirements apply to each host in a K3s Kubernetes cluster where the Rancher server is installed.
Deployment Size | Clusters | Nodes | vCPUs | RAM | Database Size |
---|---|---|---|---|---|
Small | Up to 150 | Up to 1500 | 2 | 8 GB | 2 cores, 4 GB + 1000 IOPS |
Medium | Up to 300 | Up to 3000 | 4 | 16 GB | 2 cores, 4 GB + 1000 IOPS |
Large | Up to 500 | Up to 5000 | 8 | 32 GB | 2 cores, 4 GB + 1000 IOPS |
X-Large | Up to 1000 | Up to 10,000 | 16 | 64 GB | 2 cores, 4 GB + 1000 IOPS |
XX-Large | Up to 2000 | Up to 20,000 | 32 | 128 GB | 2 cores, 4 GB + 1000 IOPS |
Contact Rancher for more than 2000 clusters and/or 20,000 nodes.
RancherD
RancherD is available as of v2.5.4. It is an experimental feature.
These CPU and memory requirements apply to each instance with RancherD installed. Minimum recommendations are outlined here.
Deployment Size | Clusters | Nodes | vCPUs | RAM |
---|---|---|---|---|
Small | Up to 5 | Up to 50 | 2 | 5 GB |
Medium | Up to 15 | Up to 200 | 3 | 9 GB |
RKE2 Kubernetes
These CPU and memory requirements apply to each instance with RKE2 installed. Minimum recommendations are outlined here.
Deployment Size | Clusters | Nodes | vCPUs | RAM |
---|---|---|---|---|
Small | Up to 5 | Up to 50 | 2 | 5 GB |
Medium | Up to 15 | Up to 200 | 3 | 9 GB |
Docker
These CPU and memory requirements apply to a host with a single-node installation of Rancher.
Deployment Size | Clusters | Nodes | vCPUs | RAM |
---|---|---|---|---|
Small | Up to 5 | Up to 50 | 1 | 4 GB |
Medium | Up to 15 | Up to 200 | 2 | 8 GB |
Ingress
Each node in the Kubernetes cluster that Rancher is installed on should run an Ingress.
The Ingress should be deployed as DaemonSet to ensure your load balancer can successfully route traffic to all nodes.
For RKE, K3s and RancherD installations, you don’t have to install the Ingress manually because is is installed by default.
For hosted Kubernetes clusters (EKS, GKE, AKS) and RKE2 Kubernetes installations, you will need to set up the ingress.
Ingress for RKE2
Currently, RKE2 deploys nginx-ingress as a deployment by default, so you will need to deploy it as a DaemonSet by following these steps.
Ingress for EKS
For an example of how to deploy an nginx-ingress-controller with a LoadBalancer service, refer to this section.
Disks
Rancher performance depends on etcd in the cluster performance. To ensure optimal speed, we recommend always using SSD disks to back your Rancher management Kubernetes cluster. On cloud providers, you will also want to use the minimum size that allows the maximum IOPS. In larger clusters, consider using dedicated storage devices for etcd data and wal directories.
Networking Requirements
This section describes the networking requirements for the node(s) where the Rancher server is installed.
Node IP Addresses
Each node used should have a static IP configured, regardless of whether you are installing Rancher on a single node or on an HA cluster. In case of DHCP, each node should have a DHCP reservation to make sure the node gets the same IP allocated.
Port Requirements
To operate properly, Rancher requires a number of ports to be open on Rancher nodes and on downstream Kubernetes cluster nodes. Port Requirements lists all the necessary ports for Rancher and Downstream Clusters for the different cluster types.
RancherD on SELinux Enforcing CentOS 8 or RHEL 8 Nodes
Before installing Rancher on SELinux Enforcing CentOS 8 nodes or RHEL 8 nodes, you must install container-selinux and iptables :
Источник