|
|
List of required vSphere resources
| Список необходимых ресурсов vSphere
|
- User with required set of permissions.
- Network with DHCP server and access to the Internet
- Datacenter with a tag in
k8s-region category.
- Cluster with a tag in
k8s-zone category.
- Datastore with required tags.
- Template — prepared VM image.
|
- User с необходимым набором прав.
- Network с DHCP и доступом в интернет.
- Datacenter с соответствующим тегом
k8s-region .
- Cluster с соответствующим тегом
k8s-zone .
- Datastore в любом количестве с соответствующими тегами.
- Template — подготовленный образ виртуальной машины.
|
vSphere configuration
| Конфигурация vSphere
|
Installing govc
| Установка govc
|
You’ll need the vSphere CLI — govc — to proceed with the rest of the guide.
| Для дальнейшей конфигурации vSphere вам понадобится vSphere CLI — govc.
|
After the installation is complete, set the environment variables required to work with vCenter:
| После установки задайте переменные окружения для работы с vCenter:
|
shell
export GOVC_URL=example.com
export GOVC_USERNAME=@vsphere.local
export GOVC_PASSWORD=
export GOVC_INSECURE=1
| shell
export GOVC_URL=example.com
export GOVC_USERNAME=@vsphere.local
export GOVC_PASSWORD=
export GOVC_INSECURE=1
|
| Создание тегов и категорий тегов
|
Instead of “regions” and “zones”, VMware vSphere provides Datacenter and Cluster objects. We will use tags to match them with “regions”/”zones”. These tags fall into two categories: one for “regions” tags and the other for “zones” tags.
| В VMware vSphere нет понятий «регион» и «зона». «Регионом» в vSphere является Datacenter , а «зоной» — Cluster . Для создания этой связи используются теги.
|
Create a tag category using the following commands:
| Создайте категории тегов с помощью команд:
|
shell
govc tags.category.create -d “Kubernetes Region” k8s-region
govc tags.category.create -d “Kubernetes Zone” k8s-zone
| shell
govc tags.category.create -d “Kubernetes Region” k8s-region
govc tags.category.create -d “Kubernetes Zone” k8s-zone
|
Create tags in each category. If you intend to use multiple “zones” (Cluster ), create a tag for each one of them:
| Создайте теги в каждой категории. Если вы планируете использовать несколько «зон» (Cluster ), создайте тег для каждой из них:
|
shell
govc tags.create -d “Kubernetes Region” -c k8s-region test-region
govc tags.create -d “Kubernetes Zone Test 1” -c k8s-zone test-zone-1
govc tags.create -d “Kubernetes Zone Test 2” -c k8s-zone test-zone-2
| shell
govc tags.create -d “Kubernetes Region” -c k8s-region test-region
govc tags.create -d “Kubernetes Zone Test 1” -c k8s-zone test-zone-1
govc tags.create -d “Kubernetes Zone Test 2” -c k8s-zone test-zone-2
|
Attach the “region” tag to Datacenter :
| Назначьте тег «региона» на Datacenter :
|
shell
govc tags.attach -c k8s-region test-region /
| shell
govc tags.attach -c k8s-region test-region /
|
Attach “zone” tags to the Cluster objects:
| Назначьте теги «зон» на объекты Cluster :
|
shell
govc tags.attach -c k8s-zone test-zone-1 //host/
govc tags.attach -c k8s-zone test-zone-2 //host/
| shell
govc tags.attach -c k8s-zone test-zone-1 //host/
govc tags.attach -c k8s-zone test-zone-2 //host/
|
Datastore configuration
| Конфигурация Datastore
|
For dynamic PersistentVolume provisioning, a Datastore must be available on each ESXi host (shared datastore).
| Для динамического заказа PersistentVolume необходимо, чтобы Datastore был доступен на каждом хосте ESXi (shared datastore).
|
Assign the “region” and “zone” tags to the Datastore objects to automatically create a StorageClass in the Kubernetes cluster:
| Для автоматического создания StorageClass в кластере Kubernetes назначьте созданные ранее теги «региона» и «зоны» на объекты Datastore :
|
shell
govc tags.attach -c k8s-region test-region //datastore/
govc tags.attach -c k8s-zone test-zone-1 //datastore/
| shell
govc tags.attach -c k8s-region test-region //datastore/
govc tags.attach -c k8s-zone test-zone-1 //datastore/
|
govc tags.attach -c k8s-region test-region //datastore/
govc tags.attach -c k8s-zone test-zone-2 //datastore/
| govc tags.attach -c k8s-region test-region //datastore/
govc tags.attach -c k8s-zone test-zone-2 //datastore/
|
Creating and assigning a role
| Создание и назначение роли
|
We’ve intentionally skipped User creation since there are many ways to authenticate a user in the vSphere.
| Ввиду разнообразия подключаемых к vSphere SSO-провайдеров шаги по созданию пользователя в данной статье не рассматриваются.
|
This all-encompassing Role should be enough for all Deckhouse components. For a detailed list of privileges, refer to the documentation. If you need a more granular Role, please contact your Deckhouse support.
| Роль, которую предлагается создать далее, включает в себя все возможные права для всех компонентов Deckhouse.
Для получения детального списка привилегий, обратитесь к документации.
При необходимости получения более гранулярных прав обратитесь в техподдержку Deckhouse.
|
Create a role with the corresponding permissions:
| Создайте роль с необходимыми правами:
|
shell
govc role.create deckhouse
Cns.Searchable Datastore.AllocateSpace Datastore.Browse Datastore.FileManagement
Global.GlobalTag Global.SystemTag Network.Assign StorageProfile.View
$(govc role.ls Admin | grep -F -e ‘Folder.’ -e ‘InventoryService.’ -e ‘Resource.’ -e ‘VirtualMachine.’)
| shell
govc role.create deckhouse
Cns.Searchable Datastore.AllocateSpace Datastore.Browse Datastore.FileManagement
Global.GlobalTag Global.SystemTag Network.Assign StorageProfile.View
$(govc role.ls Admin | grep -F -e ‘Folder.’ -e ‘InventoryService.’ -e ‘Resource.’ -e ‘VirtualMachine.’)
|
Assign the role to a user on the vCenter object:
| Назначьте пользователю роль на объекте vCenter :
|
shell
govc permissions.set -principal @vsphere.local -role deckhouse /
| shell
govc permissions.set -principal @vsphere.local -role deckhouse /
|
Preparing a virtual machine image
| Подготовка образа виртуальной машины
|
It is recommended to use a pre-built cloud image/OVA file provided by the OS vendor to create a Template :
| Для создания шаблона виртуальной машины (Template ) рекомендуется использовать готовый cloud-образ/OVA-файл, предоставляемый вендором ОС:
|
|
|
Virtual machine image requirements
| Если вы планируете использовать дистрибутив отечественной ОС, обратитесь к вендору ОС для получения образа/OVA-файла.
|
Deckhouse uses cloud-init to configure a virtual machine after startup. To do this, the following packages must be installed in the image:
| Требования к образу виртуальной машины
|
| Deckhouse использует cloud-init для настройки виртуальной машины после запуска. Для этого в образе должны быть установлены следующие пакеты:
|
Also, after the virtual machine is started, the following services associated with these packages must be started:
|
|
cloud-config.service
cloud-final.service
cloud-init.service
| Также после запуска виртуальной машины должны быть запущены следующие службы, связанные с этими пакетами:
|
To add SSH keys to user’s authorized keys, the default_user parameter must be specified in the /etc/cloud/cloud.cfg file.
|
cloud-config.service
cloud-final.service
cloud-init.service
|
Deckhouse creates virtual machine disks of the eagerZeroedThick type, however, the disk type of the created VMs will be changed without any notice to match the VM Storage Policy as configured in vSphere.
You can read more in the documentation.
| Для добавления SSH-ключа, в файле /etc/cloud/cloud.cfg должен быть указан параметр default_user .
|
Deckhouse uses the ens192 interface as the default interface for virtual machines in vSphere. Therefore, when using static IP addresses in mainNetwork , you must create an interface named ens192 in the OS image as the default interface.
| Deckhouse создаёт диски виртуальных машин с типом eagerZeroedThick , но тип дисков созданных ВМ будет изменён без уведомления, согласно настроенным в vSphere VM Storage Policy .
Подробнее можно прочитать в документации.
|
Infrastructure
| Deckhouse использует интерфейс ens192 , как интерфейс по умолчанию для виртуальных машин в vSphere. Поэтому, при использовании статических IP-адресов в mainNetwork , вы должны в образе ОС создать интерфейс с именем ens192 , как интерфейс по умолчанию.
|
Networking
| Инфраструктура
|
A VLAN with DHCP and Internet access is required for the running cluster:
- If the VLAN is public (public addresses), then you have to create a second network to deploy cluster nodes (DHCP is not needed in this network).
- If the VLAN is private (private addresses), then this network can be used for cluster nodes.
| Сети
|
Inbound traffic
| Для работы кластера необходим VLAN с DHCP и доступом в интернет:
- Если VLAN публичный (публичные адреса), нужна вторая сеть, в которой необходимо развернуть сеть узлов кластера (в этой сети DHCP не нужен).
- Если VLAN внутренний (приватные адреса), эта же сеть будет сетью узлов кластера.
|
- You can use an internal load balancer (if present) and direct traffic directly to the front nodes of the cluster.
- If there is no load balancer, you can use MetalLB in BGP mode to organize fault-tolerant load balancers (recommended). In this case, front nodes of the cluster will have two interfaces. For this, you will need:
- A dedicated VLAN for traffic exchange between BGP routers and MetalLB. This VLAN must have DHCP and Internet access.
- IP addresses of BGP routers.
- ASN — the AS number on the BGP router.
- ASN — the AS number in the cluster.
- A range to announce addresses from.
| Входящий трафик
|
Using the data store
|
- Если у вас имеется внутренний балансировщик запросов, можно обойтись им и направлять трафик напрямую на frontend-узлы кластера.
- Если балансировщика нет, для организации отказоустойчивых LoadBalancer’ов рекомендуется использовать MetalLB в режиме BGP. В кластере будут созданы frontend-узлы с двумя интерфейсами. Для этого дополнительно потребуются:
- отдельный VLAN для обмена трафиком между BGP-роутерами и MetalLB. В этом VLAN’e должны быть DHCP и доступ в интернет;
- IP-адреса BGP-роутеров;
- ASN (номер автономной системы) на BGP-роутере;
- ASN (номер автономной системы) в кластере;
- диапазон, из которого анонсировать адреса.
|
Various types of storage can be used in the cluster; for the minimum configuration, you will need:
- Datastore for provisioning PersistentVolumes to the Kubernetes cluster.
- Datastore for provisioning root disks for the VMs (it can be the same Datastore as for PersistentVolume).
| Использование хранилища данных
|
| В кластере может одновременно использоваться различное количество типов хранилищ. В минимальной конфигурации потребуются:
Datastore , в котором Kubernetes-кластер будет заказывать PersistentVolume ;
Datastore , в котором будут заказываться root-диски для виртуальной машины (это может быть тот же Datastore , что и для PersistentVolume ).
|