Access your cluster and install Kubeapps using Helm

Updated on

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

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.

Here's a quick view of how the TKC deployment looks during creation on vSphere. The TKC Control Plane and Worker nodes are getting created within Cluster Group that we chose, under the pathfinder-tanzu provisioner.

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.
  • 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.

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'

Download kubeconfig YAML File

[IMPORTANT] A new dialog box will open.

  1. Click on 'DOWNLOAD KUBECONFIG FILE', select 'Download kubeconfig for tmc CLI'
  2. Save As 'config.yml'. **Please note that the file NEEDS to be saved as config.yml else the next steps won't work.**

Click OK button.

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

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 = "\\vmwdp.com\dscpublic\UEM-REDIRECT\$env:USERNAME\Downloads\config.yml"
  • Copy using the copy button next to the command 
  • Paste it on the Horizon username field by clicking on it, followed by pressing CTRL+v (Windows) or  Command (⌘) + v (macOS) on your keyboard

List K8s pods

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

kubectl get pods -A
  • Copy using the copy button next to the command 
  • Paste it on the Horizon username field by clicking on it, followed by pressing CTRL+v (Windows) or   + v (macOS) on your keyboard.

Paste API Token

This is where we will use the API token previously copied on Notepad++. 

  • Highlight the token pasted on your Notepad++ window and copy it by using Ctrl + c (Windows) or Command (⌘) + c (macOS)
  • Paste your copied token on your Windows PowerShell window by using Ctrl + v (Windows) or Command (⌘) + v (macOS) and hit 'Enter'. If the token doesn't paste, use your mouse right click to paste the token. 
  • 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.

Bind to default PSP

By default, Pod Security Policies are enabled in this cluster which will prevent any pods from being created. Tanzu Kubernetes clusters include default PodSecurityPolicy (PSP) that you can bind to for privileged and restricted workload deployment.

Run the following command to bind to the default privileged PSP:

kubectl create clusterrolebinding tkgs-admin-privileged-binding --clusterrole=psp:vmware-system-privileged --group=system:authenticated
  • Copy using the copy button next to the command
  • Paste it on the Horizon username field by clicking on it, followed by pressing CTRL+v (Windows) or  Command (⌘) + v (macOS) on your keyboard

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.