One of the last things on my to-do list after creating my Automated vSphere 7 and vSphere with Kubernetes Lab Deployment Script which is still the quickest and most reliable way to have a fully deployed and configured environment to try out vSphere with Kubernetes using Nested ESXi, was to also automate the enablement of Workload Management for a given vSphere Cluster.
There are two new vCenter Server REST APIs to be aware of as it pertains to vSphere with Kubernetes:
- namespaces = Manages the lifecycle and access control to a vSphere Namespace
- namespace-management = Despite the name, this refers to lifecycle and management of a Workload Management Cluster
I also have to mention that Vikas Shitole, who works on vCenter Server, has fantastic blog series covering various parts of the new vSphere with Kubernetes API along with Python examples if you want to dive further. Since Vikas has done a great job covering Python, I figure I will demonstrate how to consume these new vSphere with Kubernetes API using PowerCLI, which many of our customers use to automate.
I have created a new WorkloadManagement.psm1 PowerCLI module which includes following functions:
- Get-WorkloadManagement
- New-WorkloadManagement
- Remove-WorkloadManagement
Below are the two steps required to get started with the Workload Management PowerCLI Module.
Step 1 - Install the WorkloadManagement PowerCLI Module by running the following command:
Install-Module VMware.WorkloadManagement.psm1
Step 2 - A connection to the vCenter REST API endpoint using the Connect-CisServer cmdlet is required for enabling and disabling Workload Management Cluster
Connect-CisServer -Server pacific-vcsa-2.cpbu.corp -User *protected email* -Password VMware1!
A connection to vCenter Server using Connect-VIServer cmdlet is only required if you wish to retrieve information about an existing Workload Management Cluster
Connect-VIServer -Server pacific-vcsa-2.cpbu.corp -User *protected email* -Password VMware1!