Kubernetes CLI Tools for vSphere fails to show all contexts when accessing clusters
search cancel

Kubernetes CLI Tools for vSphere fails to show all contexts when accessing clusters

book

Article ID: 386525

calendar_today

Updated On:

Products

VMware vSphere Kubernetes Service

Issue/Introduction

When logging into any cluster using Kubernetes CLI Tools for vSphere, the user is not able to see all available contexts when using 'kubectl get contexts' command. 

Environment

8.X vSphere Environments

Cause

There is a known issue that prevents namespaces from being presented if the namespace and TKc within it share the same name. 

Resolution

The fix for this issue will be included in an upcoming 8.x vCenter release.

There are currently two workarounds:

Work Around 1: Edit the local config for the CLI tools on your local workstation to include the correct contexts
When logging into a cluster, a config file is created on the workstation where the login originated. This config can be edited to include the necessary contexts. 

    • See the following documentation:
    •  The kube config file is located ~/.kube/config on Linux/macOS or %USERPROFILE%\.kube\config on Windows
    • Within the config file, you should see entries similar to the following:
      contexts:
      - name: my-context
        context:
          cluster: my-cluster
          user: my-user
          namespace: default
    • Add additional contexts that are not currently present and re-attempt login

Work Around 2: Recreate the namespaces or clusters so the names are not duplicated between them