---
myst:
html_meta:
"description lang=en": "Learn how to configure autoscaling for Kasm Workspaces on VMware vSphere. This guide covers prerequisites, vSphere user permissions, VM provider setup, autoscaling testing, and optimization to ensure dynamic resource allocation."
"keywords": "Kasm, VMware, vSphere, Pooling, Pool, autoscale, autoscaling, auto, scale, VM"
"property=og:locale": "en_US"
---
```{title} VMWare vSphere Autoscaling
```
# VMware vSphere AutoScale
```{contents} Table of Contents
:depth: 3
:local:
```
This guide will walk you through configuring autoscaling for Kasm Workspaces on VMware vSphere. Autoscaling in Kasm Workspaces automatically provisions and destroys agents based on user demand, ensuring optimized resource utilization and cost efficiency.
```{raw} html
```
## Prerequisites
* Access to VCenter: Ensure you have admin access to your VCenter environment
* Kasm Workspaces Installed: A basic setup of Kasm Workspaces must already exist
* Understand Key Concepts:
* **Zones**: Logical groupings of Kasm services for geographical or organizational segmentation
* **Pools**: Logical groupings of Kasm Docker Agents and Server Pools for load balancing
* Plan Your Configuration:
* Understand your deployment zone requirements
* Have access to your Vcenter server details; target clusters, datastores, networks, etc.
* Create template images for AutoScale to use
## Setup your vSphere environment
### Create an account
We recommend creating a dedicated VCenter user for use with Kasm AutoScale.
- Go to "Administration" -> "Single Sign On" -> "Users and Groups"
- Choose the correct domain (e.g vsphere.local)
- Click "Add"
- Choose a username for your Kasm autoscale account (e.g kasm-autoscale)
- Choose a password for your account
- Click "Add" to create the account
```{figure} /images/autoscaling/providers/vmware/vsphere_create_account.png
:align: center
**Create Kasm AutoScale user in vSphere**
```
### Create a Kasm AutoScale role
- Go to "Administration" -> "Access Control" -> "Roles"
- Click "New"
- Name your autoscale role (e.g "Kasm Autoscale")
- Assign these necessary permissions to your role
* **Datastore**
* Allocate space
* Browse datastore
* **Global**
* Cancel task
* **Network**
* Assign network
* **Resource**
* Assign virtual machine to resource pool
* **Virtual machine**
* Change Configuration
* Change CPU count
* Change Memory
* Set annotation
* Edit Inventory
* Create from existing
* Create new
* Remove
* Unregister
* Guest operations
* Guest operation modifications
* Guest operation program execution
* Guest operation queries
* Interaction
* Power off
* Power on
* Provisioning
* Deploy template
- Click "Create" to create your new role
```{figure} /images/autoscaling/providers/vmware/vsphere_role_permissions.png
:align: center
**Create Kasm AutoScale role in vSphere**
```
### Assign Role to User
- Go to "Administration" -> "Access Control" -> "Global Permissions"
- Click "Add"
- Domain: Choose the right domain (e.g vsphere.local)
- User/Group: Choose the Kasm Autoscale user that you just created
- Role: Choose the Kasm Autoscale role that you just created
- Enable "Propagate to Children"
- Click "OK"
```{figure} /images/autoscaling/providers/vmware/vsphere_assign_role_to_user2.png
:align: center
**Assign AutoScale role to user**
```
### Create a VM template
```{eval-rst}
Create the appropriate VM template based on whether you are implementing Server AutoScaling or Docker AutoScaling on vSphere.
* For Windows AutoScaling, follow the :ref:`Windows Templating Guide`
* For Docker Agent AutoScaling, follow the :ref:`Linux Templating Guide`
```
(vsphere-linux-templating)=
#### Linux Templating
- On your vSphere dashboard, go to your datastore and upload an ISO file of your Linux Image (you can create a new dedicated folder for storing ISO files). In this demo, we'll use the [Ubuntu Server 24.04.2 LTS](https://ubuntu.com/download/server) image. If you prefer a different distribution, ensure it's a [supported operating system](https://kasmweb.com/docs/latest/install/system_requirements.html#operating-system). Alternatively, if you have a pre-configured Linux template like a Cloud Image, feel free to use it instead.
```{figure} /images/autoscaling/providers/vmware/vsphere_upload_linux_iso.png
:align: center
**Upload Linux ISO image to your datastore**
```
- Go back to your Datacenter view, right-click on the datacenter where you want to create a VM and select "New Virtual Machine"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm1.png
:align: center
**Right-Click on your datacenter and create new VM**
```
- **Select a creation type**
* Choose "Create a new virtual machine" and click "Next"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm2.png
:align: center
**Select "Create a new virtual machine"**
```
- **Select a name and folder**
* Virtual machine name: Choose a name for your Virtual Machine (e.g ubuntu-server-kasm-template)
* Choose the location where you want to provision this VM.
* Click "Next"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm3.png
:align: center
**Name your VM"**
```
- **Select a compute resource**
* Select the destination compute resource for creating this VM
* Click "Next"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm4.png
:align: center
**Choose the destination compute resource**
```
- **Select storage**
* Choose the datastore you want to use for this VM (e.g datastore1)
* Click "Next"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm5.png
:align: center
**Choose the datastore for your VM**
```
- **Select compatibility**
* Select the appropriate compatibility for your VM (e.g ESXi 8.0 U2 and later)
* Click "Next"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm6.png
:align: center
**Choose the appropriate compatability for your VM**
```
- **Select a guest OS**
* Guest OS Family: Set to "Linux"
* Guest OS Version: Set to "Ubuntu Linux (64-bit)"
* Click "Next"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm7.png
:align: center
**Choose the Guest OS for your VM**
```
- **Customize hardware**
* CPU: Set to the number of cores you want to allocate to your VM (e.g 4)
* Memory: Set to the amount of memory you want to allocate to your VM (e.g 8 GB)
* New Hard disk: Set to the amount of disk size you want to allocate to your hard disk. This depends on how many workspace images you plan on hosting on your agents. The more images, the more disk space you'll need.
* New CD/DVD Drive: Choose "Datastore ISO File" and then select the Linux ISO file you uploaded.
* Enable "Connect At Power On"
* Click "Next"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm8.png
:align: center
**Customize your VM hardware**
```
- **Read to complete**
* Verify all your settings and click "Finish" to create your VM.
- Power On your VM
- Launch a Web Console to interact with your VM and install Ubuntu on it
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm9.png
:align: center
**Launch a Web Console**
```
- Follow the On-Screen instructions to install Ubuntu Server on your VM
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm10.png
:align: center
**Install Ubuntu Server on your VM**
```
- PRO TIP: Enable "Install OpenSSH Server" while installing Ubuntu so that you can connect to your VM easily with SSH later.
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm11.png
:align: center
**Enable "Install OpenSSH server"**
```
- Once Ubuntu is installed, reboot your VM and while your VM reboots, go back to your VM settings and remove the "CD/DVD drive 1" to remove the installation ISO image from your VM.
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm12.png
:align: center
**Enable "Remove CD/DVD drive from your VM settings"**
```
- You can now SSH into your VM and proceed with the next steps
```bash
ssh @
```
- Install `open-vm-tools` if not already installed
```
sudo apt update
sudo apt -y install open-vm-tools
```
- Reboot your VM
- Configure the root password for your VM. You will need to input your root credentials to Kasm later so that Kasm can run startup scripts when your autoscaled VMs are provisioned.
```bash
sudo passwd root
```
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm13.png
:align: center
**Configure root password for your VM**
```
- Optionally, you can pre-load workspace images on your autoscaled agent VMs so that workspaces launch instantly after provisioning, without waiting for Kasm to pull the necessary Docker images. Read the [Pre-load Workspace Images on Agents guide](../preload_images_on_agents.md) to learn more
- Power-Off your VM
- Once the VM is powered off, right-click on your VM, go to "Template" -> "Convert to Template"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm14.png
:align: center
**Create a template from your VM**
```
(vsphere-windows-templating)=
#### Windows Templating
For an overview of Windows templating and its prerequisites, refer to the [Windows AutoScale Template Creation Guide](../windows_autoscale_templates.md).
- On your vSphere dashboard, go to your datastore and upload an ISO file of your Windows Image (you can create a new dedicated folder for storing ISO files). In this demo, we'll use the [Windows Server 2022](https://www.microsoft.com/en-us/evalcenter/download-windows-server-2022) installation ISO. If you have a pre-configured Windows template that you'd like to use, upload it instead.
```{figure} /images/autoscaling/providers/vmware/vsphere_upload_windows_iso.png
:align: center
**Upload Windows ISO image to your datastore**
```
- Go back to your Datacenter, right-click on the datacenter where you want to create a VM and select "New Virtual Machine"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm1.png
:align: center
**Right-Click on your datacenter and create new VM**
```
- **Select a creation type**
* Choose "Create a new virtual machine" and click "Next"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm2.png
:align: center
**Select "Create a new virtual machine"**
```
- **Select a name and folder**
* Virtual machine name: Choose a name for your Virtual Machine (e.g Win-Server-2022-Template)
* Choose the location where you want to provision this VM.
* Click "Next"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_windows_vm1.png
:align: center
**Name your VM**
```
- **Select a compute resource**
* Select the destination compute resource for creating this VM
* Click "Next"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_windows_vm2.png
:align: center
**Choose the destination compute resource**
```
- **Select storage**
* Choose the datastore you want to use for this VM (e.g datastore1)
* Click "Next"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm5.png
:align: center
**Choose the datastore for your VM**
```
- **Select compatibility**
* Select the appropriate compatibility for your VM (e.g ESXi 8.0 U2 and later)
* Click "Next"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_linux_vm6.png
:align: center
**Choose the appropriate compatability for your VM**
```
- **Select a guest OS**
* Guest OS Family: Set to "Windows"
* Guest OS Version: Set to "Microsoft Windows Server 2022 (64-bit)"
* Click "Next"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_windows_vm3.png
:align: center
**Choose the Guest OS for your VM**
```
- **Customize hardware**
* CPU: Set to the number of cores you want to allocate to your VM (e.g 2)
* Memory: Set to the amount of memory you want to allocate to your VM (e.g 8 GB)
* New Hard disk: Set to the amount of disk size you want to allocate to your hard disk.
* New CD/DVD Drive: Choose "Datastore ISO File" and then select the Windows ISO file you uploaded.
* Enable "Connect At Power On"
* Click "Next"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_windows_vm4.png
:align: center
**Customize your VM hardware**
```
- **Read to complete**
* Verify all your settings and click "Finish" to create your VM.
- Power On your VM
- Launch a Remote Console to interact with your VM and install Windows on it
```{figure} /images/autoscaling/providers/vmware/vsphere_create_windows_vm5.png
:align: center
**Launch a Console**
```
- Follow the On-Screen instructions to install Windows Server on your VM
```{figure} /images/autoscaling/providers/vmware/vsphere_create_windows_vm6.png
:align: center
**Install Windows on your VM**
```
- Select "Desktop Experience" so that your users will be able to use the Desktop environment
```{figure} /images/autoscaling/providers/vmware/vsphere_create_windows_vm7.png
:align: center
**Select Desktop Experience"**
```
- Choose the drive where you want to install Windows.
```{figure} /images/autoscaling/providers/vmware/vsphere_create_windows_vm8.png
:align: center
**Choose the drive to install Windows**
```
- Once Windows is installed, reboot your VM and while your VM reboots, go back to your VM settings and detach the "CD/DVD drive 1" to remove the installation ISO image from your VM.
```{figure} /images/autoscaling/providers/vmware/vsphere_create_windows_vm9.png
:align: center
**Detach CD/DVD drive from your VM settings**
```
- Launch a Remote or Web Console again to access your VM
- Choose an Administrator password for your Windows VM
```{figure} /images/autoscaling/providers/vmware/vsphere_create_windows_vm10.png
:align: center
**Choose an Administrator Password"**
```
- Login to your Windows VM
- Install VMWare tools on your Windows VM from vSphere.
```{figure} /images/autoscaling/providers/vmware/vsphere_create_windows_vm11.png
:align: center
**Install VMWare Tools"**
```
- Reboot your VM
- After rebooting, search for "Remote Desktop Settings" and enable "Remote Desktop"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_windows_vm12.png
:align: center
**Enable Remote Desktop"**
```
- You can now install any software/tools that you would like on your VM (e.g Microsoft Office)
```{figure} /images/autoscaling/providers/vmware/vsphere_create_windows_vm13.png
:align: center
**Install software you'd like on your VM"**
```
- Shutdown your VM
- Once the VM is in powered off state, right-click on it and select "Template" -> "Convert to Template"
```{figure} /images/autoscaling/providers/vmware/vsphere_create_windows_vm14.png
:align: center
**Convert your VM to template"**
```
## Configure VM Provider Details on Kasm
```{eval-rst}
* Follow :ref:`autoscale_docker_config` or :ref:`autoscale_server_config` to create to create a new AutoScale config, or select **Create New** in **VM Provider Configs** if you already have one.
* Set Provider to "VMWare Vsphere"
* Configure the following settings:
```
```{include} /guide/compute/vm_providers/vmware.md
```
* Submit the Provider Config
```{note}
When configuring VMware vSphere with Kasm Workspaces, one important item to keep in mind is datastore storage. When clones are created VMware will attempt to satisfy the clone operation if the datastore runs out of space, any VMs that are running on that datastore will be paused until space is available. Kasm Workspaces recommends that critical management VMs such as the Vcenter server VM and cluster management VMs are on separate datastores that are not used for Kasm autoscaling.
```
## Test your VMWare vSphere Autoscaling setup
If you have configured non-zero Standby/Minimum Available Session values agents should start provisioning immediately. Otherwise, try launching multiple workspaces to increase resource utilization, prompting Kasm to autoscale new agents.
* Provision a Workspace
* Go to Workspaces > Registry
* Make multiple workspaces available
* Go to the Workspaces dashboard and launch sufficient workspace sessions to exceed your resource standby thresholds
* Monitor the provisioning of new agents by going to "Infrastructure" -> "Agents"
* Verify new VM instances in Proxmox
* Check Downscaling
* Terminate sessions to reduce resource usage
* Confirm that Kasm removes agents after the back-off period