Environment requirements
- vSphere version:
7.xor8.xwith support for theOnline volume expansionmechanism. - vCenter to which master nodes can connect to from within the cluster.
- Datacenter with the following components:
- VirtualMachine template.
- VM image should use
Virtual machines with hardware version 15 or later(required for online resize to work). - The following packages must be installed in the VM image:
open-vm-tools,cloud-initandcloud-init-vmware-guestinfo(if thecloud-initversion lower than 21.3 is used).
- VM image should use
- The network must be available on all ESXi where VirtualMachines will be created.
- One or more Datastores connected to all ESXi where VirtualMachines will be created.
- A tag from the tag category in
zoneTagCategory(k8s-zoneby default) must be added to Datastores. This tag will indicate the zone. All Clusters of a specific zone must have access to all Datastores within the same zone.
- A tag from the tag category in
- The cluster with the required ESXis.
- A tag from the tag category in
zoneTagCategory(k8s-zoneby default) must be added to the Cluster. This tag will indicate the zone.
- A tag from the tag category in
- Folder for VirtualMachines to be created.
- An optional parameter. By default, the root vm folder is used.
- Create a role with the appropriate set of privileges.
- Create a user and assign the above role to it.
- VirtualMachine template.
- A tag from the tag category in
regionTagCategory(k8s-regionby default) must be added to the Datacenter. This tag will indicate the region.
List of required vSphere resources
- User with required set of permissions.
- Network with DHCP server and access to the Internet
- Datacenter with a tag in
k8s-regioncategory. - Cluster with a tag in
k8s-zonecategory. - Datastore with required tags.
- Template — prepared VM image.
List of required privileges
Read the documentation on how to create and assign a role to a user.
A detailed list of privileges required for Deckhouse Kubernetes Platform to work in vSphere:
| List of privileges | Purpose |
|---|---|
Cns.SearchableStorageProfile.ViewDatastore.AllocateSpaceDatastore.BrowseDatastore.FileManagement |
To provision disks when creating virtual machines and ordering PersistentVolumes in a cluster. |
Global.GlobalTagGlobal.SystemTagInventoryService.Tagging.AttachTagInventoryService.Tagging.CreateCategoryInventoryService.Tagging.CreateTagInventoryService.Tagging.DeleteCategoryInventoryService.Tagging.DeleteTagInventoryService.Tagging.EditCategoryInventoryService.Tagging.EditTagInventoryService.Tagging.ModifyUsedByForCategoryInventoryService.Tagging.ModifyUsedByForTagInventoryService.Tagging.ObjectAttachable |
Deckhouse Kubernetes Platform uses tags to identify the Datacenter, Cluster and Datastore objects available to it, as well as, to identify the virtual machines under its control. |
Folder.CreateFolder.DeleteFolder.MoveFolder.Rename |
To group a Deckhouse Kubernetes Platform cluster in a single Folder in vSphere Inventory. |
Network.AssignResource.ApplyRecommendationResource.AssignVAppToPoolResource.AssignVMToPoolResource.ColdMigrateResource.CreatePoolResource.DeletePoolResource.EditPoolResource.HotMigrateResource.MovePoolResource.QueryVMotionResource.RenamePoolVirtualMachine.Config.AddExistingDiskVirtualMachine.Config.AddNewDiskVirtualMachine.Config.AddRemoveDeviceVirtualMachine.Config.AdvancedConfigVirtualMachine.Config.AnnotationVirtualMachine.Config.ChangeTrackingVirtualMachine.Config.CPUCountVirtualMachine.Config.DiskExtendVirtualMachine.Config.DiskLeaseVirtualMachine.Config.EditDeviceVirtualMachine.Config.HostUSBDeviceVirtualMachine.Config.ManagedByVirtualMachine.Config.MemoryVirtualMachine.Config.MksControlVirtualMachine.Config.QueryFTCompatibilityVirtualMachine.Config.QueryUnownedFilesVirtualMachine.Config.RawDeviceVirtualMachine.Config.ReloadFromPathVirtualMachine.Config.RemoveDiskVirtualMachine.Config.RenameVirtualMachine.Config.ResetGuestInfoVirtualMachine.Config.ResourceVirtualMachine.Config.SettingsVirtualMachine.Config.SwapPlacementVirtualMachine.Config.ToggleForkParentVirtualMachine.Config.UpgradeVirtualHardwareVirtualMachine.GuestOperations.ExecuteVirtualMachine.GuestOperations.ModifyVirtualMachine.GuestOperations.ModifyAliasesVirtualMachine.GuestOperations.QueryVirtualMachine.GuestOperations.QueryAliasesVirtualMachine.Hbr.ConfigureReplicationVirtualMachine.Hbr.MonitorReplicationVirtualMachine.Hbr.ReplicaManagementVirtualMachine.Interact.AnswerQuestionVirtualMachine.Interact.BackupVirtualMachine.Interact.ConsoleInteractVirtualMachine.Interact.CreateScreenshotVirtualMachine.Interact.CreateSecondaryVirtualMachine.Interact.DefragmentAllDisksVirtualMachine.Interact.DeviceConnectionVirtualMachine.Interact.DisableSecondaryVirtualMachine.Interact.DnDVirtualMachine.Interact.EnableSecondaryVirtualMachine.Interact.GuestControlVirtualMachine.Interact.MakePrimaryVirtualMachine.Interact.PauseVirtualMachine.Interact.PowerOffVirtualMachine.Interact.PowerOnVirtualMachine.Interact.PutUsbScanCodesVirtualMachine.Interact.RecordVirtualMachine.Interact.ReplayVirtualMachine.Interact.ResetVirtualMachine.Interact.SESparseMaintenanceVirtualMachine.Interact.SetCDMediaVirtualMachine.Interact.SetFloppyMediaVirtualMachine.Interact.SuspendVirtualMachine.Interact.SuspendToMemoryVirtualMachine.Interact.TerminateFaultTolerantVMVirtualMachine.Interact.ToolsInstallVirtualMachine.Interact.TurnOffFaultToleranceVirtualMachine.Inventory.CreateVirtualMachine.Inventory.CreateFromExistingVirtualMachine.Inventory.DeleteVirtualMachine.Inventory.MoveVirtualMachine.Inventory.RegisterVirtualMachine.Inventory.UnregisterVirtualMachine.Namespace.EventVirtualMachine.Namespace.EventNotifyVirtualMachine.Namespace.ManagementVirtualMachine.Namespace.ModifyContentVirtualMachine.Namespace.QueryVirtualMachine.Namespace.ReadContentVirtualMachine.Provisioning.CloneVirtualMachine.Provisioning.CloneTemplateVirtualMachine.Provisioning.CreateTemplateFromVMVirtualMachine.Provisioning.CustomizeVirtualMachine.Provisioning.DeployTemplateVirtualMachine.Provisioning.DiskRandomAccessVirtualMachine.Provisioning.DiskRandomReadVirtualMachine.Provisioning.FileRandomAccessVirtualMachine.Provisioning.GetVmFilesVirtualMachine.Provisioning.MarkAsTemplateVirtualMachine.Provisioning.MarkAsVMVirtualMachine.Provisioning.ModifyCustSpecsVirtualMachine.Provisioning.PromoteDisksVirtualMachine.Provisioning.PutVmFilesVirtualMachine.Provisioning.ReadCustSpecsVirtualMachine.State.CreateSnapshotVirtualMachine.State.RemoveSnapshotVirtualMachine.State.RenameSnapshotVirtualMachine.State.RevertToSnapshot |
To manage the virtual machines lifecycle in a Deckhouse Kubernetes Platform cluster. |
vSphere configuration
Installing govc
You’ll need the vSphere CLI — govc — to proceed with the rest of the guide.
After the installation is complete, set the environment variables required to work with vCenter:
export GOVC_URL=example.com
export GOVC_USERNAME=<username>@vsphere.local
export GOVC_PASSWORD=<password>
export GOVC_INSECURE=1
Creating tags and tag categories
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.
Create a tag category using the following commands:
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:
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:
govc tags.attach -c k8s-region test-region /<DatacenterName>
Attach “zone” tags to the Cluster objects:
govc tags.attach -c k8s-zone test-zone-1 /<DatacenterName>/host/<ClusterName1>
govc tags.attach -c k8s-zone test-zone-2 /<DatacenterName>/host/<ClusterName2>
Datastore configuration
For dynamic PersistentVolume provisioning, a Datastore must be available on each ESXi host (shared datastore).
Assign the “region” and “zone” tags to the Datastore objects to automatically create a StorageClass in the Kubernetes cluster:
govc tags.attach -c k8s-region test-region /<DatacenterName>/datastore/<DatastoreName1>
govc tags.attach -c k8s-zone test-zone-1 /<DatacenterName>/datastore/<DatastoreName1>
govc tags.attach -c k8s-region test-region /<DatacenterName>/datastore/<DatastoreName2>
govc tags.attach -c k8s-zone test-zone-2 /<DatacenterName>/datastore/<DatastoreName2>
Creating and assigning a role
We’ve intentionally skipped User creation since there are many ways to authenticate a user in the vSphere.
This all-encompassing Role should be enough for all Deckhouse components. A detailed list of privileges is described in the section “List of required privileges”. If you need a more granular Role, please contact your Deckhouse support.
Create a role with the corresponding permissions:
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:
govc permissions.set -principal <username>@vsphere.local -role deckhouse /
VM image requirements
To create a VM template (Template), it is recommended to use a ready-made cloud image/OVA file provided by the OS vendor:
- Ubuntu
- Debian
- CentOS
- Rocky Linux (section Generic Cloud / OpenStack)
The provider supports working with only one disk in the virtual machine template. Make sure the template contains only one disk.
Preparing the virtual machine image
-
Install the required packages:
If you use
cloud-initversion lower than 21.3 (VMware GuestInfo support is required):sudo apt-get update sudo apt-get install -y open-vm-tools cloud-init cloud-init-vmware-guestinfoIf you use
cloud-initversion 21.3 or higher:sudo apt-get update sudo apt-get install -y open-vm-tools cloud-init -
Verify that the
disable_vmware_customization: falseparameter is set in/etc/cloud/cloud.cfg. -
Make sure the
default_userparameter is specified in/etc/cloud/cloud.cfg. It is required to add an SSH key when the VM starts. -
Add the VMware GuestInfo datasource — create
/etc/cloud/cloud.cfg.d/99-DataSourceVMwareGuestInfo.cfg:datasource: VMware: vmware_cust_file_max_wait: 10 -
Before creating the VM template, reset identifiers and the
cloud-initstate:truncate -s 0 /etc/machine-id rm /var/lib/dbus/machine-id ln -s /etc/machine-id /var/lib/dbus/machine-id -
Clear
cloud-initevent logs:cloud-init clean --logs --seed
After the virtual machine starts, the following services related to the packages installed during cloud-init preparation must be running:
cloud-config.service,cloud-final.service,cloud-init.service.
To ensure that the services are enabled, use the command:
systemctl is-enabled cloud-config.service cloud-init.service cloud-final.service
Example output for enabled services:
enabled
enabled
enabled
DKP creates VM disks of type eagerZeroedThick, but the type of disks of created VMs may be changed without notification according to the VM Storage Policy settings in vSphere.
For more details, see the documentation.
DKP uses the ens192 interface as the default interface for VMs 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.
Infrastructure
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
- 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
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).