Getting Started VMware Tanzu Community Edition (Part 2)

Ach.Chusnul Chikam
6 min readJan 31, 2022

--

This is part 2 of Getting Started VMware Tanzu Community Edition

Deploy a Management Cluster to vSphere

Initialize the Tanzu Community Edition installer interface to deploy a management cluster. The installer interface launches in a browser and takes you through the steps to configure the management. The input values are saved in: ~/.config/tanzu/tkg/clusterconfigs/cluster-config.yaml.

1. On the machine on which you downloaded and installed the Tanzu CLI, run the tanzu management-cluster create command with the --ui option:

tanzu management-cluster create --ui

2. Choose VMware vSphere from the provider tiles.

Tanzu Community Edition Installer

3. Fill out the IaaS Provider section.

4. Fill out the Management Cluster Settings.

5. If you choose NSX as your Control Plane Endpoint Provider in the above step, fill out the VMware NSX Advanced Load Balancer section.

6. If you would like additional metadata to be tagged in your soon-to-be-created vSphere infrastructure, fill out the Metadata section.

7. Fill out the Resources section.

8. Fill out the Kubernetes Network section and Management section.

9. Fill out the OS Image section.

10. Skip the TMC Registration section then choose review configuration button.

11. Click Deploy Management Cluster

Waiting for Deploying Tanzu Community Edition on vSphere

Some management cluster was created on vSphere

Verify tanzu management cluster created successfully

Validate tanzu management cluster. Capture the management cluster’s kubeconfig and set your kubectl context to the management cluster with the following command:

tanzu management-cluster get
tanzu management-cluster kubeconfig get mgmt-tanzu-lab --admin
kubectl config use-context mgmt-tanzu-lab-admin@mgmt-tanzu-lab

Make sure you can access the management cluster’s API server

kubectl get nodes
kubectl get pods --all-namespaces

Deploy a Workloads Cluster

After you have deployed a management cluster to vSphere you can use the Tanzu CLI to deploy workload clusters. In Tanzu Community Edition, your application workloads run on workload clusters. Tanzu Community Edition automatically deploys workload clusters to the platform on which you deployed the management cluster.

https://tanzucommunityedition.io/docs/latest/architecture/

After management cluster was created, next you will create a workload cluster. To deploy a workload cluster, you create a configuration file. You then run the tanzu cluster create command, specifying the configuration file in the --file option. This example names the workload cluster configuration file isworkload1.yaml.

#### copy the configuration file from management cluster to create new file that be used for workload cluster
cp ~/.config/tanzu/tkg/clusterconfigs/<MGMT-CONFIG-FILE> ~/.config/tanzu/tkg/clusterconfigs/workload1.yaml

Reference: vsphere_workload_cluster_template

In the new workload cluster file workload1.yaml edit the CLUSTER_NAME and VSPHERE_CONTROL_PLANE_ENDPOINT parameters. Next, create a workload cluster with the following command:

#### deploy tanzu workload cluster
tanzu cluster create workload1-tanzu-lab --file ~/.config/tanzu/tkg/clusterconfigs/workload1.yaml

To scale a workload cluster, use the tanzu cluster scale command. You can change the number of control plane nodes by specifying the --controlplane-machine-count option. You change the number of worker nodes by specifying the --worker-machine-count option.

#### scale workload cluster
tanzu cluster scale workload1-tanzu-lab --controlplane-machine-count 1 --worker-machine-count 2 --namespace default

Capture the workload cluster’s kubeconfig and set your kubectl context accordingly.

tanzu cluster kubeconfig get workload1-tanzu-lab --admin
kubectl config use-context workload1-tanzu-lab-admin@workload1-tanzu-lab

Verify you can see workload nodes and pods in the workload cluster.

kubectl get nodes
kubectl get pods --all-namespaces

Find the difference between a management cluster and a workload cluster. Management cluster nodes are created in vSphere with the prefix name mgmt while workload cluster nodes are created in vSphere with the prefix name workload1. It depends on your file configuration.

Validate a workload cluster successfully running with the command:

tanzu cluster list
tanzu cluster get workload1-tanzu-lab

Work with Packages

This section walks you through installing the cert-manager package in your cluster as an example of package installation. Cert-manager is a Kubernetes certificate manager. It helps with issuing certificates from a variety of sources. It simplifies the process of obtaining, renewing, and using certificates. Following instructions below:

  1. Make sure your kubectl context is set to either the workload cluster or standalone cluster.
kubectl config use-context workload1-tanzu-lab-admin@workload1-tanzu-lab

2. Install the Tanzu Community Edition package repository into the tanzu-package-repo-global namespace.

tanzu package repository add tce-repo --url projects.registry.vmware.com/tce/main:0.9.1 --namespace tanzu-package-repo-global

3. Verify the package repository has been reconciled then list the available packages.

tanzu package repository list --namespace tanzu-package-repo-global
tanzu package available list

4. List the available versions for the cert-manager package and Install the package to the cluster. Don't forget to verify cert-manager is installed in the cluster.

tanzu package available list cert-manager.community.tanzu.vmware.com
tanzu package install cert-manager --package-name cert-manager.community.tanzu.vmware.com --version 1.5.3
tanzu package installed list

Installing a Local Dashboard (Octant)

Octant is a tool for developers to understand how applications run on a Kubernetes cluster. It aims to be part of the developer’s toolkit for gaining insight and approaching complexity found in Kubernetes. Octant offers a combination of introspective tooling, cluster navigation, and object management along with a plugin system to further extend its capabilities.

  1. Download the .deb or .rpm from the releases page.
  2. Install with rpm commandrpm -i
  3. Run octant
#### download and install octant
wget https://github.com/vmware-tanzu/octant/releases/download/v0.25.0/octant_0.25.0_Linux-64bit.rpm
sudo rpm -i octant_0.25.0_Linux-64bit.rpm
octant
Octant Dashboard Overview
Octant Cluster Overview
Octant Workload1 Nodes

4. Test deploy pod apps using octant. Use a deployment templatenginx-deployment.yaml

On the top bar of Octant, click Apply YAML and enter the content of nginx-deployment.yaml or browse a YAML file then choose APPLY

Verify pods successfully created and running

Octant’s Deployment Overview

Next, set up vSphere CNS and create persistent volumes with storage classes was provided in part 3

See other content

References :

#VMware #Tanzu # Community #Orchestration #Kubernetes #PaaS

--

--

Ach.Chusnul Chikam

Cloud Consultant | RHCSA | CKA | AWS SAA | OpenStack Certified | OpenShift Certified | Google Cloud ACE | LinkedIn: https://www.linkedin.com/in/achchusnulchikam