Tanzu Kubernetes Grid multi-cloud Integration with VCD – Greenfield Installation

With the release of Container Service Extension 3.0.3, service providers can integrate Tanzu Kubernetes Grid multi-cloud (TKGm) with VCD to offer Kubernetes as a Service to their tenants. TKGm integration in addition to existing support for Native K8 and vSphere with Tanzu (TKGS) has truly transformed VCD into a developer-ready cloud. 

With Tanzu Basic (TKGm &TKGS) on VCD, tenants have a choice of deploying K8s in three different ways: 

  • TKGS:  K8 deployment on vSphere 7 which requires vSphere Pod Service 
  • TKGm: Multi-tenant K8 deployments that do not need vSphere Pod Service. 
  • Native K8: Community supported Kubernetes on VCD with CSE 

By offering multi-tenant managed Kubernetes services with Tanzu Basic and VCD, Cloud providers can attract developer workloads starting with test/dev environments to their cloud. Once developers have grown confidence in the K8 solution, application owners can leverage the VCD-powered clouds to quickly deploy test/dev K8s clusters on-premise and accelerate their cloud-native app development and transition to production environments.

If you are new to the K8 solutions with VCD, I would recommend reading the below articles to understand the basics first before jumping into trying the solution.

1: Native Kubernetes in VCD using Container Service Extension

2: vSphere with Tanzu Integration in VCD

3: Container Service Extension Official Documentation

It’s time to jump into the lab and see things in action.

Infrastructure Details

The below table lists the components and their version that I am running in my lab.

Component Version
VCD 10.3 Build 18296069
vCSA 7.0.2 Build 17958471
ESXi 7.0.2 Build 17867351
NSX-T 3.1.2 Build 17975795
CSE 3.0.4
Container UI Plugin for CSE 2.3.0

Note: TKGm is only supported in CSE version 3.0.3, 3.0.4 and CSE 3.1.1 (Beta). If you have upgraded your environment from CSE 3.0.x to CSE 3.1.0, please consider upgrading it to 3.1.1 for TKGm support. I had a word with the CSE team and looks like 3.1.1 is still under development and has a few bugs in the current version, so be careful before you plan to upgrade.

Also, CSE official documentation states that the supported VCD version with CSE 3.0.3 & 3.0.4 is 10.2.2, but in my testing, I found VCD 10.3 is backward compatible and it’s ok to use it. 

Deployment Steps

This blog assumes that you already have VCD deployed and configured fully. 

Step 1: Deploy CSE Server

CSE Server can be deployed on any Linux OS with CSE python module and VCD CLI installed on it. In my lab, I am using a CentOS 8 VM with 1 vCPU, 6 GB RAM, and 100 GB disk space for CSE server installation.

Step 1.1: Install Python & VCD CLI

To run the vcd-cli command from anywhere in the CSE server, add the vcd-cli path to the .bash_profile. 

[root@cse ~]# vim /root/.bash_profile

PATH=$PATH:$HOME/bin:/root/.local/bin

export PATH

[root@cse ~]# source /root/.bash_profile

Verify that vcd-cli has been installed.

[root@cse ~]# vcd version
vcd-cli, VMware vCloud Director Command Line Interface, 24.0.1

Step 1.2: Install Container Service Extension

[root@cse ~]# pip3 install container-service-extension==3.0.4

Note: Pip3 installs the CSE associated dependencies automatically during the installation. In case you run into issues with the installation of any dependent package, uninstall the problematic package and install the correct version.

Verify that CSE has been installed.

[root@cse ~]# cse version
CSE, Container Service Extension for VMware vCloud Director, version 3.0.4

Step 2: Enable CSE Client

Edit the ~/.vcd-cli/profiles.yaml file and add the below lines to enable the CSE client.

Note: If the ~/.vcd-cli/profiles.yaml file is not present on the CSE server, then run the following command to generate the same.

[root@cse ~]# vcd login vcd.manish.lab <Org-Name> <Org-User> -i -w

Verify that the CSE client has been installed.

[root@cse ~]# vcd cse version
CSE, Container Service Extension for VMware vCloud Director, version 3.0.4

Step 3: Create CSE Service Account

To facilitate the CSE Server interaction with VCD, create a user with CSE Service Role. The role has all the rights that CSE needs to function.

To create this role, run the following command:

Step 4: Prepare VCD for CSE Installation

Before enabling CSE on VCD, ensure that you have configured the following items in VCD:

  • A dedicated organization and organization VDC for CSE.
  • A routed Org VDC network connected to an external network (with internet connectivity).
  • Org VDC has sufficient storage to create vApps and publish them as templates.
  • Good network connectivity between the CSE Server and VCD to avoid intermittent failures in K8 templates upload/download operations.

Note: Ensure that the org network has a Static IP Pool or DHCP configured. This is very important as the CSE server deploys Kubernetes templates on this network and installs Kubernetes binaries from the internet. VCD should be able to assign an IP address to the VM during this process.

Step 5: Enable CSE + TKGm on VCD

Step 5.1: Generate CSE configuration file

The CSE server is controlled by a YAML file. You can generate a sample yaml file by running the following command:

This command generates a config.yaml file which needs to be filled in with parameters specific to your environment. You have to keep a couple of things in mind when filling this file:

  • Installation of TKGm in VCD is controlled via setting a feature flag enable_tkg_m to true.
  • The parameter remote_template_cookbook_url should point to http://raw.githubusercontent.com/vmware/container-service-extension-templates/master/template.yaml
  • If your VCD is sitting at 10.3, make it backward compatible to CSE 3.0.4 by setting the api_version to 35.0. By default VCD 10.3 offers API version 36.0. 

A sample filled-out config.yaml file from my environment is shown below:

The config file has 5 mandatory sections ( amqp/mqtt], vcd, vcs, service, and, broker). To know about the parameters related to each section, please check the CSE official documentation.

Note: Parameters default_template_name & default_template_revision can be left blank during CSE server installation by providing -t flag to cse install command. On the other hand, to fetch the information about the available templates in the TKGm repo, you can run the below command:

Step 5.2: Enable CSE in VCD

Run the below command to initiate CSE installation in VCD. 

Since the -t flag is supplied with the installation command, the installation should finish within 5-10 minutes. 

Validate the CSE Installation by running the command: cse check

Step 5.4: Install TKGm K8 Template

Run the cse template install command to install the TKGm template in VCD. 

The above command will install the template in the CSE org catalog and will be shared with the tenants.

Step 5.5: Start CSE Server

To run the CSE server manually in the shell background, run the below command:

Controlling CSE Server with systemctl

Create a script file as shown below

[root@cse ~]# chmod +x cse.sh

Create cse.service file so that the systemd can control it.

Enable and start the CSE service. 

[root@cse ~]# systemctl enable cse && systemctl start cse

Step 6: Tenant Onboarding

Step 6.1: Publish CSE Rights Bundle to the Tenants

A new right bundle gets created in the VCD when TKGm is integrated with VCD. Publish this right bundle to the tenants who want to deploy TKG based K8 clusters. 

Step 6.2: Enabling Tenant OrgVDC for TKG

Provider needs to use vcd-cli to instruct CSE to enable TKG runtime on specific tenant OrgVDC(s).

Note: TKG related options won’t show up in vcd-cli by default. You have to explicitly enable it by setting the following environment variable:

export CSE_TKG_M_ENABLED=True

To activate the K8 runtime for the tenants, login to VCD as a system admin user. 

[root@cse ~]# vcd login vcd.manish.lab system admin -p VMware1! -i -w
admin logged in, org: ‘system’, vdc: ”

Verify the current K8s Runtime for OVDC

Activate the TKGm K8s Runtime environment on the tenant ovdc

Verify that TKGm K8s Runtime is enabled on the OVDC

Step 7: Install Container UI Plugin

By default VCD 10.3 ships with Container UI plugin version 3.0.0. TKGm related options won’t show up in this version of the plugin. You need to disable this plugin and install v2.3.0 of the plugin which can be downloaded from here

Once the plugin has been installed, publish the plugin to the tenants.

Step 8: Deploy TKGm cluster as a Tenant

Login to the tenant portal and navigate to More > Kubernetes Container Clusters and click on new and verify that you are getting an option for deploying TKGm based K8 cluster.

Once you have provisioned the TKGm based K8 cluster, you can download the cluster kubeconfig file and upload it to a machine where you have kubectl installed. 

You can also view the status of the K8 cluster by running the below command:

Information about the deployed K8 cluster can be viewed by running the below command:

You are now ready to interact with the K8 cluster using the kubectl utility.

  • List all pods

  • List namespaces

I hope you enjoyed reading this post. Feel free to share this on social media if it is worth sharing.

Leave a Reply