Home Kubernetes Deploy Tanzu Kubernetes Cluster on vSphere with Tanzu

Deploy Tanzu Kubernetes Cluster on vSphere with Tanzu

by Mohamed Imthiyaz
vSphere Namespace

Assuming we have successfully enabled Supervisor Cluster (Workload Management/WCP). We can deploy a Tanzu Kubernetes Cluster (TKC) by applying a manifest on Supervisor Cluster and that will define how the cluster is setup.

Prerequisites

  • Up and running Supervisor Cluster (SVC)
  • Content Library for TKG VMs
  • VM class added on the vSphere Namespace (In my lab I have added 3 VM Class – best-effort-large, best-effort-medium, best-effort-small). You can also check this from vCenter GUI under DC -> Cluster -> Your namespace -> SummaryvSphere Namespace

You can add/remove permission to this namespace, change storage policies, and manage the VM Classes assigned.

Step 1 to Deploy Tanzu Kubernetes Cluster

Login to the Supervisor Cluster via kubectl vsphere login and change the context to your namespace. Server is the Control Plane Node IP Address, which can be found under vCenter -> Menu -> Workload Management -> Clusters

kubectl-vsphere login --vsphere-username [email protected] --server 192.168.116.129 --insecure-skip-tls-verify

kubectl vsphere login

Step 2

Let’s deploy a basic TKC with 1 ControlPlane and 1 worker, below is the .yaml file. Let’s run this from the context we are already on. I am using v1alpha1 version, if you want to use v1alpha2 version, please see the example yaml on vmware docs.

apiVersion: run.tanzu.vmware.com/v1alpha1      #TKGS API endpoint
kind: TanzuKubernetesCluster                   #required parameter
metadata:
  name: tkc-test-cluster                    #cluster name, user defined
  namespace: imthiyaz-cloud                 #vsphere namespace
spec:
  distribution:
    version: v1.20                             #Resolves to latest TKR 1.20
  topology:
    controlPlane:
      count: 1                                 #number of control plane nodes
      class: best-effort-medium                #vmclass for control plane nodes
      storageClass: vwt-storage-policy         #storageclass for control plane
    workers:
      count: 3                                 #number of worker nodes
      class: best-effort-medium                #vmclass for worker nodes
      storageClass: vwt-storage-policy          #storageclass for worker nodes
  settings:
    network:
      services:
        cidrBlocks: ["10.245.0.0/20"]
      pods:
        cidrBlocks: ["10.97.0.0/23"]

Applying the above yaml which contains the configuration for our cluster.

kubectl apply -f tkc-api-1.yaml
tanzukubernetescluster.run.tanzu.vmware.com/tkc-test-cluster created

Step 3

Status of the cluster can be monitored by kubectl get tkc

kubectl get tkc

As we can see the cluster is still in creating phase, after few minutes the cluster is now up and running

The TKC (Tanzu Kubernetes Cluster) can be seen on the vCenter under the Namespace

Step 4

Cluster has been deployed successfully, you can directly log in and manage this cluster with kubectl vsphere login

kubectl-vsphere login --vsphere-username [email protected] --server 192.168.116.129 --insecure-skip-tls-verify --tanzu-kubernetes-cluster-namespace imthiyaz-cloud --tanzu-kubernetes-cluster-name tkc-test-cluster

This should help you deploy your first TKC cluster on vSphere with Tanzu. Few other Tanzu articles can be found here.

You may also like

Leave a Comment