Recovering Missing tanzu CLI Plugins When Using a Custom Image Repository
search cancel

Recovering Missing tanzu CLI Plugins When Using a Custom Image Repository

book

Article ID: 313088

calendar_today

Updated On:

Products

VMware

Issue/Introduction

The purpose of this knowledge article is to provide a potential fix for the above issue.

Symptoms:

After creating a new cluster or upgrading your TKG cluster, you may notice that the "tanzu cluster" command fails to execute with the below error:
# tanzu cluster
✖  unknown command "cluster" for "tanzu"

Alongside this, you will observe that some plugins are not present when you run "tanzu plugin list":
Standalone Plugins
  NAME                DESCRIPTION                                                        TARGET      DISCOVERY  VERSION  STATUS
  isolated-cluster    isolated-cluster operations                                                    default    v0.28.1  installed
  login               Login to the platform                                                          default    v0.28.1  installed
  pinniped-auth       Pinniped authentication operations (usually not directly invoked)              default    v0.28.1  installed
  management-cluster  Kubernetes management-cluster operations                           kubernetes  default    v0.28.1  installed
  package             Tanzu package management                                           kubernetes  default    v0.28.1  installed
  secret              Tanzu secret management                                            kubernetes  default    v0.28.1  installed
  telemetry           Configure cluster-wide telemetry settings                          kubernetes  default    v0.28.1  installed

*** MISSING ***

Plugins from Context:  mgmt-slot35rp02
  NAME                DESCRIPTION                           TARGET      VERSION  STATUS
  cluster             Kubernetes cluster operations         kubernetes  v0.28.1  installed
  feature             Operate on features and featuregates  kubernetes  v0.28.1  installed
  kubernetes-release  Kubernetes release operations         kubernetes  v0.28.1  installed


Resolution

A likely cause for this issue is if the wrong endpoint to your private repository was provided in the TKG_CUSTOM_IMAGE_REPOSITORY variable during cluster configuration.

In order to verify if you supplied the correct endpoint, you can follow the below steps:
  1. Navigate to "~/.config/tanzu" in your home directory. 
  2. Open "config.yaml" and search for "TKG_CUSTOM_IMAGE_REPOSITORY".
  3. Note down the value.
The "TKG_CUSTOM_IMAGE_REPOSITORY" value should point to the IP address or FQDN of your harbor repository. The value SHOULD NOT point to a specific folder such as "management" or likewise. By defining a value other than the "/yourproject" directory, it will not be possible to pull all images required to install tanzu plugins. 

Below is an example of correct and incorrect "TKG_CUSTOM_IMAGE_REPOSITORY" usage:

INCORRECT: "TKG_CUSTOM_IMAGE_REPOSITORY: harbor.registry.com/yourproject/packages/management"
CORRECT: "TKG_CUSTOM_IMAGE_REPOSITORY: harbor.registry.com/yourproject"

To resolve a wrongly configured value after cluster deployment:
  1. Navigate to "~/.config/tanzu/config.yaml" in your home directory. 
  2. Edit "config.yaml" with the correct "TKG_CUSTOM_IMAGE_REPOSITORY" value. 
  3. Save changes and exit. 
  4. As we are modifying cluster configuration, it is required to run "tanzu management-cluster upgrade" in order to push the changes. 
  5. Once the upgrade has completed, run (in order) "tanzu plugin clean", "tanzu plugin sync" and "tanzu init". 
  6. All plugins should now be available in your environment. To verify, run "tanzu plugin list".
By following the documentation here: https://docs.vmware.com/en/VMware-Tanzu-Kubernetes-Grid/2.2/tkg-deploy-mc-22/mgmt-deploy-config-ref.html - You can also define "TKG_CUSTOM_IMAGE_REPOSITORY" in the cluster configuration file, prior to deployment.