How to Log in to the Kubernetes Cluster and Access Service Pods in Tanzu for Apache Kafka tile
search cancel

How to Log in to the Kubernetes Cluster and Access Service Pods in Tanzu for Apache Kafka tile

book

Article ID: 451511

calendar_today

Updated On:

Products

VMware Tanzu Application Catalog VMware Tanzu Platform VMware Tanzu Platform - Cloud Foundry VMware Tanzu Platform - Kubernetes

Issue/Introduction

Operators and administrators need to access the Kubernetes cluster that runs Tanzu for Apache Kafka for Tanzu Platform, or list the specific pods associated with a service instance.

Before proceeding, ensure you have the following prerequisites in place:

  • kubectl installed locally (if using a downloaded kubeconfig file).

  • BOSH CLI installed and configured, along with access to the BOSH environment (only required if using the optional BOSH SSH workflow).

  • The Tanzu for Apache Kafka for Tanzu Platform tile installed.

 

Environment

Tanzu Platform for Cloud Foundry

Tanzu for Apache Kafka on Tanzu Platform

Cause

Direct interaction with the underlying Kubernetes environment, master VMs, or service instance pods is often necessary for advanced troubleshooting, cluster exploration, or monitoring the health of deployed Apache Kafka service instances.

 

Resolution

Note: If your foundation uses VMware Tanzu Kubernetes Service (VKS) or another bring-your-own cluster model, the tile's Kubeconfig credential does not apply. You must use the kubeconfig provided by your platform team and can skip to Step 4.

Step 1: Obtain the kubeconfig from the tile (For Embedded Clusters Only)

  1. In Tanzu Operations Manager, open the Tanzu for Apache Kafka for Tanzu Platform tile.

  2. Open the Credentials tab.

  3. Find Kubeconfig and click Link to Credential.

  4. The response will be in JSON format. Locate the kubeconfig within .credential.value.output and save that value to a local file (e.g., kafka-tile-kubeconfig).

  5. Verify access by pointing kubectl to your new file:

kubectl --kubeconfig kafka-tile-kubeconfig get nodes

Step 2: Connect to the Kubernetes master VM with SSH (Optional) Use this workflow only when you need shell access to the cluster VMs (e.g., for deep troubleshooting).

  1. Obtain a list of the VMs by using the BOSH CLI:

  2. Identify your deployment and the master node, then connect to the Kubernetes master instance VM with SSH:
bosh ssh -d <deployment-name> <master-instance/id>

Step 3: Explore the Kubernetes cluster using kubectl on the VM If you logged into the Kubernetes master node via SSH, you can explore the cluster directly using kubectl. Its recommended to create an alias for the kubectl path combined with its kubeconfig to make commands easier:

alias kubectl='/var/vcap/packages/kubernetes/bin/kubectl --kubeconfig /var/vcap/jobs/kubernetes-roles/config/kubeconfig'

Step 4: Obtain the pods for a service instance

To locate and list the pods running for a specific service instance:

      1. Retrieve the service GUID using the Cloud Foundry CLI:

cf service SERVICE-INSTANCE-NAME --guid

      2. The pods are deployed within the Kubernetes cluster in a namespace named <GUID>-ns. To list the pods, run the following command (using either your local kubectl context or the SSH session alias):

kubectl get pods -n <SERVICE-INSTANCE-GUID>-ns