Tanzu Kubernetes Grid is a managed service offered by VMware Cloud on AWS. Activate Tanzu Kubernetes Grid in one or more SDDC clusters to configure Tanzu support in the SDDC vCenter Server.In my previous post (Getting Started with Tanzu Service on VMware Cloud on AWS),in this i walked you through how to enable Tanzu Service on VMware Cloud on AWS.
In this post i will deploy Tanzu Kubernetes Cluster by GUI (from Tanzu Mission Control) and as well as CLI but this CLI is updated API V2 version, so lets get started.
Deploy Tanzu Kubernetes Cluster using Tanzu Mission Control
Go to Tanzu Mission Control and validate that VMC supervisor cluster is registered and healthy by going to Tanzu Mission Control, Click on Administration, to go “management cluster” and check the status
Now on Tanzu Mission Control, click on “Clusters” and then click on “CREATE CLUSTER”
Select your VMC Tanzu Management Cluster and click on “CONTINUE TO CREATE CLUSTER”
on the next screen choose “Provisioner” (namespace name”). you add a provisioner by creating a vSphere namespace in the Supervisor Cluster, which you can do in VMC vCenter.
Next is select Kubernetes Version, latest supported version is preselected for you, Pod CIDR, and Service CIDR. You can also optionally select the default storage class for the cluster and allowed storage classes.The list of storage classes that you can choose from is taken from your vSphere namespace.
Select the type of cluster you want to create. the primary difference between the two is that the highly available cluster is deployed with multiple control plane nodes.
You can optionally select a different instance type for the cluster’s control plane node and its storage class as well as you can optionally additional storage volumes for your control plane.
To configure additional volumes, click Add Volume and then specify the name, mount path, and capacity for the volume. To add another, click Add Volume again.
Next is you can define the default node pool and create additional node pools for your cluster. specify the number of worker nodes to provision also select the instance type for workload clusters and select the storage class
When you ready to provision the new cluster, click Create Cluster and wait for few minutes
you can also view vCenter activities about creation of Tanzu Kubernetes cluster.
Once the cluster is fully created and TMC agent reported back, you should see below status on TMC console, which shows that cluster has been successfully created.
This complates Tanzu Kubernetes Cluster deployment using GUI.
Deploy Tanzu Kubernetes Grid Service using v1alpha2 API yaml
The Tanzu Kubernetes Grid Service v1alpha2 API provides a robust set of enhancements for provisioning Tanzu Kubernetes clusters. there is an YAML specification which i am using for provisioning a Tanzu Kubernetes Cluster Using the Tanzu Kubernetes Grid Service v1alpha2 API
apiVersion: run.tanzu.vmware.com/v1alpha2 kind: TanzuKubernetesCluster metadata: name: tkgsv2 namespace: wwmca spec: topology: controlPlane: replicas: 1 vmClass: guaranteed-medium storageClass: vmc-workload-storage-policy-cluster-1 volumes: - name: etcd mountPath: /var/lib/etcd capacity: storage: 4Gi tkr: reference: name: v1.21.2---vmware.1-tkg.1.ee25d55 nodePools: - name: worker-nodepool-a1 replicas: 2 vmClass: best-effort-large storageClass: vmc-workload-storage-policy-cluster-1 tkr: reference: name: v1.21.2---vmware.1-tkg.1.ee25d55 settings: storage: defaultClass: vmc-workload-storage-policy-cluster-1 network: cni: name: antrea services: cidrBlocks: ["220.127.116.11/16"] pods: cidrBlocks: ["18.104.22.168/16"] serviceDomain: managedcluster.local trust: additionalTrustedCAs: - name: CompanyInternalCA-1 data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tDQpNSUlG
Two key parameters which i am using for cluster provistioning
- #tkr.reference.name is the TKR NAME #to be used by control plane nodes; supported format is “v1.21.2—vmware.1-tkg.1.ee25d55”
- #trust configures additional certificates for the cluster #if omitted no additional certificate is configured
You can run below command to check the status of cluster provustioning:
#kubectl get tkc
Scale a Tanzu Kubernetes cluster
Publish the service Internally/Externally
Before we can make our service available over the Internet, it should be accessible from within the VMware Cloud on AWS instance. Platform operators can publish applications through a Kubernetes Service of type LoadBalancer. This ability is made possible through the NSX-T Container Plugin (NCP) functionality built into Tanzu Kubernetes Grid. lets deploy a basic container and exposed it as type “LoadBalancer”
#kubectl run nginx1 --image=nginx #kubectl expose pod nginx1 --type=LoadBalancer --port=80
Now you can access the application internally by accessing internal
Access application from Internet
To make it publicly available, we must assign a public IP address, and configure a Destination NAT, let do it request an Public IP on VMC console and create a NAT rule on Internet Tab to access the application from internet.
Now access the application from Internet and you should be able to successfully access it using provided public ip.
Exposing a Kubernetes service to the Internet takes a couple of more steps to complete than exposing it to your internal networks, but the VMware Cloud Console makes those steps simple enough. After exposing the Kubernetes service using an NSX-T Load Balancer, you can request a new Public IP Address and then configure a NAT rule to send that traffic to the virtual IP address of the load balancer.