To complete the configuration of the vSphere with Tanzu environment, after the Supervisor is configured, deploy a Tanzu Kubernetes cluster on the Supervisor using kubectl via command-line.

Deploy a Namespace for the Tanzu Kubernetes Cluster for Developer Ready Infrastructure for VMware Cloud Foundation

To run applications that require upstream Kubernetes compliance, you must provision a Tanzu Kubernetes Cluster. Tanzu Kubernetes clusters are fully upstream-compliant Kubernetes clusters that run on top of your Supervisor.

To help you to organize and manage your development projects, you can optionally divide the clusters into Kubernetes namespaces. If you do not create additional namespaces, Tanzu Kubernetes Grid creates all Tanzu Kubernetes clusters in the default namespace.

Procedure

  1. Log in to the VI workload domain vCenter Server at https://<vi_workload_vcenter_server_fqdn>/ui with a user assigned the Administrator role.
  2. From the vSphere Client menu, select Workload Management.

  3. On the Workload Management page, click the Namespaces tab and click New Namespace .

  4. In the Create Namespace dialog box, select the VI workload domain cluster, enter name for the namespace, and click Create.

  5. On the new_namespace_name page, click the Storage tab.

  6. Under Storage Policies, click Edit.

  7. In the Select Storage Policies dialog box, select the storage policy that you created earlier and click OK.

Assign the New Tanzu Cluster Namespace Roles to Active Directory Groups for VMware Cloud Foundation

You assign roles for the Namespace to Active Directory groups. You can later assign access to users by adding them to these groups. You assign access to separate Active Directory groups for the edit and view roles in the Namespace.

Procedure

  1. Log in to the VI workload domain vCenter Server at https://<vi_workload_vcenter_server_fqdn>/ui with a user assigned the Administrator role.
  2. From the vSphere Client menu, select Workload Management.

  3. On the Workload management page, under the Namespaces tab and click the new Namespace.

  4. Click the Permissions tab.

  5. Provide edit permissions to your Active Directory group intended for admins for the namespace.

    1. On the new_namespace page, click Add permissions.

    2. In the Add Permissions dialog box, enter the Identity source and User/Group for edit access according to your values in the VMware Cloud Foundation Planning and Preparation Workbook, set the Role to Can edit, and click OK.

  6. Provide read-only permissions to your Active Directory group intended for viewers for the namespace.

    1. On the new_namespace page, click Manage permissions.

    2. Under Permissions click Add.

    3. In the Add Permissions dialog box, enter the Identity source and User/Group for read-only access according to your values in the VMware Cloud Foundation Planning and Preparation Workbook, set the Role to Can view, and click OK.

Add a Virtual Machine Class for the Tanzu Kubernetes Cluster for Developer Ready Infrastructure for VMware Cloud Foundation

To deploy a Tanzu Kubernetes cluster using Tanzu Kubernetes Grid Service within a Supervisor, you must add the virtual machine class or classes that will be used to deploy the cluster.

To help you to organize and manage your development projects, you can optionally divide the clusters into Kubernetes namespaces. If you do not create additional namespaces, Tanzu Kubernetes Grid creates all Tanzu Kubernetes clusters in the default namespace. This example uses a guaranteed-small configuration for both the control plane and worker nodes. You can define these based on any virtual machine class available.

Procedure

  1. Log in to the VI workload domain vCenter Server at https://<vi_workload_vcenter_server_fqdn>/ui with a user assigned the Administrator role.
  2. From the vSphere Client menu, select Workload Management.

  3. On the Workload Management page, click the Namespaces tab and select the vSphere Namespace deployed for your Tanzu Kubernetes cluster.

  4. On the Summary tab, click the Add VM Class link on the VM Service card.

  5. Check the virtual machine class or classes you intend to use for deployment of your Tanzu Kubernetes cluster and click OK.

Provision a Tanzu Kubernetes Cluster for Developer Ready Infrastructure for VMware Cloud Foundation

Provision a Tanzu Kubernetes cluster by using kubectl and a YAML file for input. The command prompt procedure uses example values from the VMware Cloud Foundation Planning and Preparation Workbook.

Prerequisites

  • Install the kubectl.exe and kubectl-vsphere.exe CLI tools, see Download and Install the Kubernetes CLI Tools for vSphere in the vSphere product documentation.
  • For VMware Cloud Foundation 4.5.2 or earlier, verify that the subscribed content library that you created earlier has finished downloading the required content.

For the PowerShell procedure, you must know the path where kubectl.exe and kubectl-vsphere.exe binaries are located. They must both be in the same folder. The path will be defined in the variable $kubectlBinLocation.

Command Prompt Procedure

  1. In a command prompt, log in to the Supervisor by using kubectl.

    kubectl vsphere login --server 192.168.21.2 --vsphere-username Supervisor_Cluster_Admin --insecure-skip-tls-verify
  2. Switch the kubectl context to the sfo-w01-tkc01 namespace.

    kubectl config use-context Tanzu_Kubernetes_Cluster_Name
  3. Create a sfo-w01-tkc01.yaml text file with the following specifications.

    apiVersion: run.tanzu.vmware.com/v1alpha1
    kind: TanzuKubernetesCluster
    metadata:
      name: sfo-w01-tkc01
      namespace: Tanzu_Kubernetes_Namespace
    spec:
      topology:
        controlPlane:
          count: 3
          class: guaranteed-small
          storageClass: vsphere-with-tanzu-storage-policy
        workers:
          count: 3
          class: guaranteed-small
          storageClass: vsphere-with-tanzu-storage-policy
      distribution:
        version: v1.24
      settings:
        network:
          cni:
            name: antrea
          services:
            cidrBlocks: ["198.51.100.0/12"]
          pods:
            cidrBlocks: ["192.0.2.0/16"]
  4. Use kubectl to deploy the Tanzu Kubernetes Cluster from your YAML file input.

    kubectl apply -f ./sfo-w01-tkc01.yaml
  5. After the deployment of the Tanzu Kubernetes Cluster completes, run kubectl to get the Tanzu Kubernetes cluster status.

    You see similar output that indicates that the cluster deployment is successful.

    kubectl describe tanzukubernetescluster sfo-w01-tkc01
    <snip>
      Node Status:
        Tk - Cluster - 01 - Control - Plane - 7 Q 2 Dk:                  ready
        Tk - Cluster - 01 - Control - Plane - Pt 87 M:                   ready
        Tk - Cluster - 01 - Control - Plane - Txjbm:                     ready
        Tk - Cluster - 01 - Workers - Mhmrx - 7 F 8794 D 878 - 2 Wtlk:   ready
        Tk - Cluster - 01 - Workers - Mhmrx - 7 F 8794 D 878 - 5 Qd 49:  ready
        Tk - Cluster - 01 - Workers - Mhmrx - 7 F 8794 D 878 - Bk 7 Db:  ready
      Phase:                                                             running
      Vm Status:
        Tk - Cluster - 01 - Control - Plane - 7 Q 2 Dk:                  ready
        Tk - Cluster - 01 - Control - Plane - Pt 87 M:                   ready
        Tk - Cluster - 01 - Control - Plane - Txjbm:                     ready
        Tk - Cluster - 01 - Workers - Mhmrx - 7 F 8794 D 878 - 2 Wtlk:   ready
        Tk - Cluster - 01 - Workers - Mhmrx - 7 F 8794 D 878 - 5 Qd 49:  ready
        Tk - Cluster - 01 - Workers - Mhmrx - 7 F 8794 D 878 - Bk 7 Db:  ready