...
Customers using TKG 1.3.x could hit the following errors.[Symptom-1]$ tanzu cluster listError: unknown command "cluster" for "tanzu"Run 'tanzu --help' for usage.[Symptom-2]$ kubectl get pods -A --kubeconfig kubeconfig-file-provided-by-TKG-adminError: unknown command "pinniped-auth" for "tanzu"Run 'tanzu --help' for usage
The Tanzu CLI is based on a plugin architecture. When installing the Tanzu CLI, a few plugins including pinniped-auth are installed. For more information on installing Tanzu CLI plugins, refer to the documentation, Install the Tanzu CLI Plugins.The location of the plugins are managed by the go implementation of XDG Base Directory Specification (github repo). In particular, the plugins are installed into $XDG_DATA_HOME/tanzu-cli/. The default value of $XDG_DATA_HOME depends on OS types and is documented here (quoted as the following screenshot).For example, if we do not set $XDG_DATA_HOME when installing Tanzu CLI plugins on a Ubuntu VM, the location of the plugin binaries would be at /home/ubuntu/.local/share. # status after successfully installed tanzu CLI and its plugins $ tanzu plugin list NAME LATEST VERSION DESCRIPTION REPOSITORY VERSION STATUS cluster Kubernetes cluster operations v1.3.1 installed kubernetes-release Kubernetes release operations v1.3.1 installed login Login to the platform v1.3.1 installed management-cluster Kubernetes management cluster operations v1.3.1 installed pinniped-auth Pinniped authentication operations (usually not directly invoked) v1.3.1 installed $ ls -lh ~/.local/share/tanzu-cli total 910656 -rwxr-xr-x 1 wchen staff 120M Jul 1 21:01 tanzu-plugin-cluster -rwxr-xr-x 1 wchen staff 41M Jul 1 21:01 tanzu-plugin-kubernetes-release -rwxr-xr-x 1 wchen staff 83M Jul 1 21:01 tanzu-plugin-login -rwxr-xr-x 1 wchen staff 120M Jul 1 21:01 tanzu-plugin-management-cluster -rwxr-xr-x 1 wchen staff 82M Jul 1 21:01 tanzu-plugin-pinniped-auth drwxr-xr-x 2 wchen staff 64B Jul 1 21:01 test Once an admin user has logged on a jumpbox VM and installed Tanzu CLI and plugins by following the TKG documentation, the Tanzu CLI itself is available at a shared location (e.g., /usr/local/bin/tanzu for Linux), while the plugin binaries are available only to the admin user (e.g., /home/admin-user/.local/share/tanzu-cli/).Errors described in the symptoms section would surface in the following scenarios.[Scenario-1]When another TKG admin user logs on the same jump-box and runs tanzu commands involving plugins. For example: tanzu cluster listtanzu management-cluster gettanzu logintanzu pinniped-auth infotanzu kubernetes-release get The command hits an error mentioned in Symptom-1 because the plugins are not available at /home/another-user/.local/share/tanzu-cli/.[Scenario-2] TKG 1.3.x is installed with Identity Management (Pinniped) enabled.TKG admin generates kubeconfig file to authenticate the user To connect management cluster, refer to Generate a kubeconfig to Allow Authenticated Users to Connect to the Management Cluster.To connect workload cluster, refer to Authenticate Connections to a Workload Cluster Another user logs on the same jump-box and runs kubectl commands using the generated kubeconfig file shared by the TKG admin. kubectl get pods -A --kubeconfig the-generated-kubeconfig The authentication is performed by a command tanzu pinniped-auth login embedded in the generated kubeconfig file. cat the-generated-kubeconfig | yq e '.users[]' - name: tanzu-cli-tkg-mgmt user: exec: apiVersion: client.authentication.k8s.io/v1beta1 args: - pinniped-auth - login - ... flags omitted ... command: tanzu env: [] This user could be a developer who is supposed only to access a workload cluster and has not installed Tanzu CLI and plugins. Hence the kubectl command would hit an error as in Symptom-2 because the plugin pinniped-auth is not available at /home/another-user/.local/share/tanzu-cli/.Note: If a user runs kubectl commands from another jump-box without Tanzu CLI installed, the error would be different and would be, executable tanzu not found.
There are two options to resolve this issue.Option 1: The user who hits the error should install Tanzu CLI plugins into his/her own user path by following Install the Tanzu CLI Plugins.Option 2: The TKG admin could re-install the plugins into a shared path by setting up XDG_DATA_HOME and then export XDG_DATA_HOME for all users on the jumpbox. For example: XDG_DATA_HOME=/usr/local/share/tanzu-plugins tanzu plugin install --local cli all echo "export XDG_DATA_HOME=/usr/local/share/tanzu-plugins" >> /etc/profile To verify if plugins are installed, please run this command:tanzu plugin list