Access your cluster and install Kubeapps using Helm

Updated on

In this section, we will access our kubernetes cluster and install Kubeapps using Helm

18-a. View TKC on vSphere

Kubernetes is now built into vSphere with Tanzu which allows developers to continue using the same industry-standard tools and interfaces they've been using to create modern applications. vSphere Admins also benefit because they can help manage the Kubernetes infrastructure using the same tools and skills they have developed around vSphere. To help bridge these two worlds, we've introduced a new vSphere construct called Namespaces, allowing vSphere Admins to create a logical set of resources, permissions and policies that enable an application-centric approach.

18-b. Access Namespace under Workload Management

Launch the 'vCenter Server - Tanzu' shortcut from the desktop. You will be automatically logged in. If for some reason you don't, then the login credentials are also available in the Demo Credentials document on desktop.

Navigate to Menu > Workload Management.

Select the 'pathfinder-tanzu' namespace from under Namespaces. The Summary tab would show up by default.

In the Summary tab you see the various configuration sections for the vSphere Namespace, including Status, Permissions, Storage, Capacity and Usage, vSphere Pods and Tanzu Kubernetes Status. From this screen an admin can manage any of these settings.

19. Access your Cluster

Now let's navigate back to your TMC Tab on the browser. Once your cluster status is 'Ready' and the health status is 'Healthy', click on 'Actions' at the top right corner and choose 'Access this cluster'.

20. Download kubeconfig YAML File

A new dialog box will open. Click on 'DOWNLOAD KUBECONFIG FILE' and Save As 'config.yml'

NOTE: It is important to save the file as config.yml in order for the next set of steps to work.

21. Setting environment variables

Launch Windows PowerShell from the Desktop by double clicking on the shortcut. Set the KUBECONFIG environment variable to point to our config.yml file saved in the previous step by copying the below command and pasting it in PowerShell.

$env:KUBECONFIG = "\\vmwtd.com\tdpublic\UEM-REDIRECT\$env:USERNAME\Downloads\config.yml"

22. List K8s pods

Once the environment variable is set successfully, enter the command to list all pods.

kubectl get pods -A

23. Access API Token

You will get a message asking for the API Token which will be available  from TMC. Click on your username -> My Account (under User Settings)  to launch the 'My Account' page.

24. Generate API Token

On this page, navigate to 'API Tokens' tab and click on 'GENERATE TOKEN' to generate a new token. Give it a name (for e.g. <your-username>-tanzu) and select the 'All Roles' checkbox. Click on 'GENERATE'.

25. Copy API Token

Your token will be generated. Next, copy the token by clicking on the COPY button or highlighting it and using Ctrl + C (Windows) or Command (⌘) + C (macOS). Alternatively use your mouse right click button to Copy.

In the next step you will paste your API Token into the PowerShell CLI window.

We also recommend that you save the API Token in a text file on your VMware Tanzu Horizon Desktop.

Do not exit this screen until you verify that you've saved your API Token. 

26. Paste API Token

Paste your copied token on your Windows PowerShell window by using Ctrl + V (Windows) or Command (⌘) + V (macOS) and hit 'Enter'.

You may be asked to set the login-context name, set a name for it (for e.g. <your-username>-tanzu) and hit 'Enter'.

You will get a 'context successfully created' message along with a list of all pods running on your cluster.

27. Navigate Back to Tanzu Mission Control Console

To close the API Token popup screen click on the 'CONTINUE' or 'X' button to exit this screen. 

To navigate back to the TMC Console screen, click on the App Launcher at the top right of the screen and from the drop down click on "VMware Tanzu Mission Control". 

NOTE: This step is not required, but to show you how to get back to the Tanzu Mission Control Console in case you would like to explore it further or for debugging your cluster. 

Now let's go back to the PowerShell CLI window. 

28. Assign permissions to the K8s cluster

To be able to run workloads on this cluster, we have to add a step to run the following kubectl command:

kubectl create clusterrolebinding tkgs-admin-privileged-binding --clusterrole=psp:vmware-system-privileged --group=system:authenticated

29. Install Kubeapps using Helm

At this point, we are ready to deploy some applications on our cluster using Kubeapps, a web-based UI for deploying and managing applications in Kubernetes clusters. We will use Helm to install the latest version of Kubeapps on our cluster.

helm repo add bitnami https://charts.bitnami.com/bitnami
kubectl create namespace kubeapps
helm install kubeapps --namespace kubeapps bitnami/kubeapps --set useHelm3=true --set frontend.service.type=LoadBalancer

Helm is a  tool to help you define, install, and upgrade applications running on  Kubernetes. At its most basic, Helm is a templating engine that creates  Kubernetes manifests. What makes Helm more than that is it can upgrade  and scale applications as well.