WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud
  • Tanzu
    • Application Modernization
    • Tanzu services
    • Tanzu Community Edition
    • Tanzu Kubernetes Grid
    • vSphere with Tanzu
  • Home Lab
  • Nested Virtualization
  • Apple
You are here: Home / Automation / Automated enablement of vSphere with Tanzu using vSphere Zones in vSphere 8

Automated enablement of vSphere with Tanzu using vSphere Zones in vSphere 8

10.18.2022 by William Lam // Leave a Comment

vSphere Zones is just one of the the many exciting new Tanzu capabilities that is now part of vSphere 8. My buddy Cormac Hogan did a nice write-up on vSphere Zones, which I highly recommend folks check it out get more details.

This blog post will focus on using the new vCenter Server REST API to enable vSphere with Tanzu using the new vSphere Zones feature in vSphere 8.


For those interested in running a lean and minimal setup in their homelab, you can deploy a fully functional vSphere with Tanzu environment with just 32GB of memory and this is still applicable for vSphere 8!

To support vSphere Zones, there is a new Supervisors Service endpoint that is now part of the Namespace Management API for managing vSphere with Tanzu Clusters. For a single vSphere Zone setup, use the Enable on Compute Cluster Supervisors API and for multi-vSphere Zone setup, use the Enable On Zones Supervisors API.

For our basic setup, we will use the single vSphere Zone API and to demonstrate this new API, I have updated my VMware.WorkloadManagement PowerCLI Module with a new function creatively named New-WorkloadManagement4 šŸ˜€

If you have used previous versions of the PowerCLI module to enable vSphere with Tanzu using HAProxy, NSX-T or NSX Advanced Load Balancer (NSX-ALB), then this should feel familiar but with some updated parameters.

Here is an example using the new function to enable vSphere with Tanzu using HAProxy in a vSphere 8 environment with a single vSphere Zone:

$vSphereWithTanzuParams = @{
    VsphereZoneName = "vz-01"
    SupervisorClusterName = "svc-01"
    ClusterName = "Tanzu-Cluster";
    TanzuvCenterServer = "vcsa.tanzu.local";
    TanzuvCenterServerUsername = "*protected email*";
    TanzuvCenterServerPassword = "VMware1!";
    TanzuContentLibrary = "TKG-Content-Library";
    ControlPlaneSize = "TINY";
    MgmtNetwork = "management";
    MgmtNetworkStartIP = "192.168.30.20";
    MgmtNetworkPrefix = "24";
    MgmtNetworkGateway = "192.168.30.1";
    MgmtNetworkDNS = @("192.168.30.69");
    MgmtNetworkDNSDomain = "tanzu.local";
    MgmtNetworkNTP = @("162.159.200.123");
    WorkloadNetwork = "workload";
    WorkloadNetworkStartIP = "10.20.0.10";
    WorkloadNetworkIPCount = 20;
    WorkloadNetworkPrefix = "24";
    WorkloadNetworkGateway = "10.20.0.1";
    WorkloadNetworkDNS = @("10.20.0.1");
    WorkloadNetworkDNSDomain = "tanzu.local";
    WorkloadNetworkNTP = @("162.159.200.123");
    WorkloadNetworkServiceStartIP = "10.96.0.0";
    WorkloadNetworkServiceStartCount = "256";
    StoragePolicyName = "Tanzu-Storage-Policy";
    HAProxyVMvCenterServer = "vcsa.tanzu.local";
    HAProxyVMvCenterUsername = "*protected email*";
    HAProxyVMvCenterPassword = "VMware1!";
    HAProxyVMName = "haproxy.tanzu.local";
    HAProxyIPAddress = "192.168.30.68";
    HAProxyRootPassword = "VMware1!";
    HAProxyPassword = "VMware1!";
    LoadBalancerStartIP = "10.10.0.64";
    LoadBalancerIPCount = 64;
}

New-WorkloadManagement4 @vSphereWithTanzuParams

Below are the new/update parameters for using this new API:

  • VsphereZoneName - Name to use for the vSphere Zone (this assumes you have not manually created and associated your vSphere Cluster with vSphere Zone and the API will handle this for you automatically)
  • SupervisorClusterName - Name to use for the Supervisor Cluster
  • WorkloadNetworkPrefix - While the vSphere UI supports Netmask input, the API expects Network Prefix (this was something I had to find out the hard way while figuring out how to use the API)
  • WorkloadNetworkDNSDomain - DNS Domain for Workload Network
  • WorkloadNetworkNTP - NTP Server for Workload Network
  • WorkloadNetworkServiceStartIP - K8s Service Network input is no longer single entry using CIDR/PREFIX but starting IP + Count
  • WorkloadNetworkServiceStartCount - K8s Service Network input is no longer single entry using CIDR/PREFIX but starting IP + Count

Once the enablement has started, you can use the vSphere UI and the new vSphere with Tanzu enablement progress monitoring.


Depending on your physical resources and the number of Supervisor Control Plane VMs you intend to deploy, it can take up to ~30-40 minutes to complete.


At this point, you are ready to start deploying Tanzu Kubernetes Grid Cluster (TKC) or VMs using the VM Service!

While developing the new function to use the new API to enable vSphere with Tanzu using vSphere Zones, I really wish we had a complete working example payload to model after. There was a lot of trial and error parsing the API documentation and because this single API can support multiple networking options from HAProxy, NSX-T and NSX-ALB, it was not clear what the required input was needed for a given configuration.

For those that might be interested in using the raw REST API or to get a sense of what is needed, I have captured the full JSON payload for enabling vSphere with Tanzu using HAProxy with vSphere Zones below:

{
    "zone": "vz-01",
    "name": "svc-01",
    "control_plane": {
        "network": {
            "network": "dvportgroup-1018",
            "backing": {
                "backing": "NETWORK",
                "network": "dvportgroup-1018"
            },
            "services": {
                "dns": {
                    "servers": [
                        "192.168.30.69"
                    ],
                    "search_domains": [
                        "tanzu.local"
                    ]
                },
                "ntp": {
                    "servers": [
                        "162.159.200.123"
                    ]
                }
            },
            "ip_management": {
                "dhcp_enabled": false,
                "gateway_address": "192.168.30.1/24",
                "ip_assignments": [{
                    "assignee": "NODE",
                    "ranges": [{
                        "address": "192.168.30.20",
                        "count": 5
                    }]
                }]
            }
        },
        "size": "TINY",
        "storage_policy": "a11253f9-2241-488c-b9d3-a17709158384"
    },
    "workloads": {
        "network": {
            "network": "workload-1",
            "network_type": "VSPHERE",
            "vsphere": {
                "dvpg": "dvportgroup-1020"
            },
            "services": {
                "dns": {
                    "servers": [
                        "10.20.0.1"
                    ],
                    "search_domains": [
                        "tanzu.local"
                    ]
                },
                "ntp": {
                    "servers": [
                        "162.159.200.123"
                    ]
                }
            },
            "ip_management": {
                "dhcp_enabled": false,
                "gateway_address": "10.20.0.1/24",
                "ip_assignments": [{
                    "assignee": "NODE",
                    "ranges": [{
                        "address": "10.20.0.10",
                        "count": "20"
                    }]
                }]
            }
        },
        "edge": {
            "id": "tanzu-haproxy-1",
            "load_balancer_address_ranges": [{
                "address": "10.10.0.64",
                "count": "64"
            }],
            "haproxy": {
                "servers": [{
                    "host": "192.168.30.68",
                    "port": "5556"
                }],
                "username": "wcp",
                "password": "VMware1!",
                "certificate_authority_chain": "-----BEGIN CERTIFICATE-----\nMII....\n-----END CERTIFICATE-----\n"
            },
            "provider": "HAPROXY"
        },
        "images": {
            "kubernetes_content_library": "1bfd8950-c846-46cf-bd50-55150a16bab3"
        },
        "storage": {
            "ephemeral_storage_policy": "a11253f9-2241-488c-b9d3-a17709158384",
            "image_storage_policy": "a11253f9-2241-488c-b9d3-a17709158384"
        }
    }
}

 

More from my site

  • Heads Up - Unable to open VIB archive in streaming mode using Export-EsxImageProfile with PowerCLI 13.0
  • Demo of VMware Cloud Consumption Interface (CCI)
  • Beta for VMware Cloud Consumption Interface (CCI) formally Project Cascade
  • Quick Tip - Correctly naming TKR's in Local Content Library for vSphere with Tanzu in vSphere 8
  • Infinite possibilities with new VM Service CloudInit transport for vSphere with Tanzu in vSphere 8

Categories // Automation, Kubernetes, PowerCLI, VMware Tanzu, vSphere 8.0 Tags // PowerCLI, vSphere 8.0, vSphere with Tanzu, vSphere Zones

Thanks for the comment! Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Author

William Lam is a Senior Staff Solution Architect working in the VMware Cloud team within the Cloud Infrastructure Business Group (CIBG) at VMware. He focuses on Cloud Native technologies, Automation, Integration and Operation for the VMware Cloud based Software Defined Datacenters (SDDC)

Connect

  • Email
  • GitHub
  • LinkedIn
  • RSS
  • Twitter
  • Vimeo

Recent

  • Self-Contained & Automated VMware Cloud Foundation (VCF) deployment using new VLC Holodeck Toolkit 03/29/2023
  • ESXi configstorecli enhancement in vSphere 8.0 Update 1 03/28/2023
  • ESXi on Intel NUC 13 Pro (Arena Canyon) 03/27/2023
  • Quick Tip - Enabling ESXi Coredumps to be stored on USB 03/26/2023
  • How to disable the Efficiency Cores (E-cores) on an Intel NUC? 03/24/2023

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2023

 

Loading Comments...