Install and Manage Packages

This section describes how to install and manage packages and package repositories using the Tanzu CLI.

Note: The tanzu package CLI plugin is intended only for CLI-managed packages. Do not use the commands provided in this topic to install and manage auto-managed packages. Their lifecycle is managed automatically by Tanzu Kubernetes Grid. For more information about auto-managed packages, see Auto-Managed Packages.

Preparing to Install CLI-Managed Packages

Before installing CLI-managed packages from the standard package repository:

  1. Install the Tanzu CLI.
  2. Add the tanzu-standard package repository.

    Note

    Previously, the tanzu-standard package repository was automatically enabled in every cluster, in the tanzu-package-repo-global namespace. In Tanzu Kubernetes Grid 2, you add this repository manually. The repository must be added to the tkg-system namespace.

  3. Review Package Locations and Dependencies.
  4. Install cert-manager for certificate management in workload clusters.

Installation Overview

For instructions on how to install and manage packages using the Tanzu CLI, see the sections below.

  • Package Repositories: See this section if you want to:

    • List all package repositories available for or added to the target cluster
    • Get the details of an available or added package repository
    • Add, update, or delete a package repository
  • Packages: See this section if you want to:

    • List all packages available to or installed in the target cluster
    • Get the details of an available or installed package
    • Install, update, or delete a package

For more information about tanzu package commands, see tanzu package.

Package Namespaces and System Namespaces

You install package repositories and packages to the namespace of your choice. If you do not set the --namespace option, the Tanzu CLI targets the default namespace.

The components of the packaged services run in a system namespace that is separate from where packages themselves are deployed. For example, Contour and Envoy components run in the namespace tanzu-system-ingress and Harbor components run in tanzu-system-registry.

Do not install packages to any tanzu-system- namespace.

Package Repositories

The sections below describe how to list, add, update, and delete package repositories.

List Package Repositories

The tanzu package repository list command lists all package repositories that are available in the target cluster. This list includes package repositories that have been added to the target cluster by running the tanzu package repository add command. To add a package repository to your cluster, see Add a Package Repository below.

  • To list package repositories across all namespaces in the target cluster, run:

    tanzu package repository list -A
    
  • To list package repositories in a specific namespace, run:

    tanzu package repository list -n NAMESPACE
    

    Where NAMESPACE is the target namespace. The --namespace, or -n, option is required if you want to list package repositories in a namespace other than default.

    To list package repositories in the default namespace, you can also run:

    tanzu package repository list
    

Get the Details of a Package Repository

The tanzu package repository get command retrieves the details of a package repository.

To retrieve the details of a package repository, run:

tanzu package repository get REPOSITORY-NAME -n REPOSITORY-NAMESPACE

Where:

  • REPOSITORY-NAME is the name of the package repository in the target cluster.
  • REPOSITORY-NAMESPACE is the namespace of the package repository in the target cluster.

Add a Package Repository

The tanzu package repository add command adds a package repository.

To add a package repository to the target cluster, run:

tanzu package repository add REPOSITORY-NAME --url REPOSITORY-URL -n REPOSITORY-NAMESPACE

Where:

  • REPOSITORY-NAME is a name you choose for the package repository.
  • REPOSITORY-URL is the OCI registry URL of the package repository.
    • See List Package Repositories to obtain this value from the Tanzu CLI, or in Tanzu Mission Control see the Addons > Repositories list in the Cluster pane.
    • If you omit a package repository tag at the end of the URL, the system uses the tag from the latest Tanzu Kubernetes Grid release.
    • This URL cannot be under projects.registry.vmware.com/tce.
  • REPOSITORY-NAMESPACE is the target namespace for the package repository. If this option is not specified, the Tanzu CLI adds the package repository to the default namespace.

For example, to add the standard package repository, which contains CLI-managed packages included in Tanzu Kubernetes Grid, run the command below. The target --namespace for the standard package repository is tkg-system.

tanzu package repository add tanzu-standard --url projects.registry.vmware.com/tkg/packages/standard/repo:v1.6.1 --namespace tkg-system

If the target namespace does not exist in the cluster, you can create it by running the command below:

tanzu package repository add REPOSITORY-NAME --url REPOSITORY-URL -n REPOSITORY-NAMESPACE --create-namespace

The --create-namespace flag creates the namespace if does not exist in the target cluster.

Update a Package Repository

The tanzu package repository update command updates a package repository with a new version published at a URL.

To update a package repository in the target cluster, run:

tanzu package repository update REPOSITORY-NAME --url REPOSITORY-URL -n REPOSITORY-NAMESPACE

Where:

  • REPOSITORY-NAME is the name of the package repository in the cluster.
  • REPOSITORY-URL is the new URL of the package repository. If you do not specify a package repository tag in the URL, the system uses the package repository tag from the latest Tanzu Kubernetes Grid release.
  • REPOSITORY-NAMESPACE is the namespace of the package repository in the cluster.

If the package repository that you are updating does not exist in your target cluster, you can create it by running the following command:

tanzu package repository update REPOSITORY-NAME --url REPOSITORY-URL -n REPOSITORY-NAMESPACE --create

The --create flag creates the package repository if it does not exist in the target cluster.

Delete a Package Repository

The tanzu package repository delete command removes a package repository. To delete a package repository from the target cluster, run:

tanzu package repository delete REPOSITORY-NAME -n REPOSITORY-NAMESPACE

Where:

  • REPOSITORY-NAME is the name of the package repository.
  • REPOSITORY-NAMESPACE is the namespace of the package repository.

Packages

The sections below describe how to list, install, update, and delete packages.

List Available Packages

The tanzu package available list command lists all available packages and package versions.

List available packages:

  • To list available packages across all namespaces in the target cluster, run:

    tanzu package available list -A
    
  • To list available packages in a specific namespace, run:

    tanzu package available list -n NAMESPACE
    

    Where NAMESPACE is the namespace from which you want to retrieve the list of available packages. To list available packages in the default namespace, you can also run:

    tanzu package available list
    

List available package versions:

  • To list available package versions for a package across all namespaces in the target cluster, run:

    tanzu package available list AVAILABLE-PACKAGE-NAME -A
    

    Where AVAILABLE-PACKAGE-NAME is the package name that you retrieved by running the tanzu package available list command.

  • To list available package versions for a package in a specific namespace, run:

    tanzu package available list AVAILABLE-PACKAGE-NAME -n AVAILABLE-PACKAGE-NAMESPACE
    

    Where:

    • AVAILABLE-PACKAGE-NAME is the package name that you retrieved by running the tanzu package available list command.
    • AVAILABLE-PACKAGE-NAMESPACE is the namespace of the available package.

    To list available package versions for a package in the default namespace, you can also run:

    tanzu package available list AVAILABLE-PACKAGE-NAME
    

Get the Details of an Available Package

The tanzu package available get command retrieves the details of an available package.

To retrieve the details of an available package, run:

tanzu package available get AVAILABLE-PACKAGE-NAME -n AVAILABLE-PACKAGE-NAMESPACE

Or:

tanzu package available get AVAILABLE-PACKAGE-NAME/AVAILABLE-PACKAGE-VERSION -n AVAILABLE-PACKAGE-NAMESPACE

Where:

  • AVAILABLE-PACKAGE-NAME is the name of the available package. You can retrieve this name by running the tanzu package available list command.
  • AVAILABLE-PACKAGE-VERSION is the version of the available package. You can retrieve the list of available package versions by running the tanzu package available list AVAILABLE-PACKAGE-NAME command.
  • AVAILABLE-PACKAGE-NAMESPACE is the namespace of the available package.

To generate a default configuration file for a package, use the --generate-default-values-file flag of the tanzu package available get command:

tanzu package available get AVAILABLE-PACKAGE-NAME/AVAILABLE-PACKAGE-VERSION -n AVAILABLE-PACKAGE-NAMESPACE --generate-default-values-file

To retrieve the values schema for an available package, including the default value for each key, use the --values-schema flag of the tanzu package available get command. This retrieves the valuesSchema section from the Package Kubernetes API resource for the available package. You can set the output format, -o, for the values schema to yaml, json, or table.

tanzu package available get AVAILABLE-PACKAGE-NAME/AVAILABLE-PACKAGE-VERSION -n AVAILABLE-PACKAGE-NAMESPACE --values-schema

List Installed Packages

The tanzu package installed list command lists all packages that are currently installed in the target cluster.

To list installed packages across all namespaces in a cluster, run:

tanzu package installed list -A

To list installed packages in a specific namespace, run:

tanzu package installed list -n NAMESPACE

Where NAMESPACE is the namespace from which you want to retrieve the list of installed packages.

Get the Details of an Installed Package

The tanzu package installed get command retrieves the details of an installed package.

To retrieve the details of an installed package, run:

tanzu package installed get INSTALLED-PACKAGE-NAME -n INSTALLED-PACKAGE-NAMESPACE

Where:

  • INSTALLED-PACKAGE-NAME is the name of the installed package.
  • INSTALLED-PACKAGE-NAMESPACE is the namespace in which the package is installed.

If you want to save the current configuration of an installed package to a file, run:

tanzu package installed get INSTALLED-PACKAGE-NAME -n INSTALLED-PACKAGE-NAMESPACE -f FILE-PATH

Where FILE-PATH is the path to the file. For example, values.yaml.

Install a Package

The tanzu package install command installs a CLI-managed package.

To install a CLI-managed package in the target cluster:

  1. If you have not already done so, add the package repository that contains the package. See Add a Package Repository above.

  2. Note the name and the version of the package that you want to install. To see the package name and version, run the tanzu package available list command. See List Available Packages above.

  3. Install the package:

    • If the target namespace exists in the cluster, run:

      tanzu package install PACKAGE-NAME -p AVAILABLE-PACKAGE-NAME -v AVAILABLE-PACKAGE-VERSION -f PACKAGE-CONFIGURATION-FILE -n PACKAGE-NAMESPACE
      
    • If the target namespace does not exist in the cluster, run:

      tanzu package install PACKAGE-NAME -p AVAILABLE-PACKAGE-NAME -v AVAILABLE-PACKAGE-VERSION -f PACKAGE-CONFIGURATION-FILE -n PACKAGE-NAMESPACE --create-namespace
      

    Where:

    • PACKAGE-NAME is a name you choose for the package.
    • AVAILABLE-PACKAGE-NAME is the package name you noted above.
    • AVAILABLE-PACKAGE-VERSION is the package version you noted above.
    • PACKAGE-CONFIGURATION-FILE is the configuration file that you prepared for the package. If this option is not specified, the package is installed with the default configuration.
    • PACKAGE-NAMESPACE is the namespace in which to install the package (PackageInstall), package app (App), and any other Kubernetes resources that describe the package. For example, the my-packages or tanzu-cli-managed-packages namespace. If the -n flag is not specified, the Tanzu CLI uses the default namespace. Do not install the contents of the package, such as pods and services, into this namespace. The namespace for the package contents is set separately, in the package configuration.

    To see the full list of supported flags for this command, use the --help option.

  4. To confirm that the package has been installed, run the tanzu package installed list command. See List Installed Packages above.

Update a Package

The tanzu package installed update command updates the version and configuration of a CLI-managed package.

Before updating the version of a CLI-managed package, you typically update its repository as described in Update a Package Repository.

To update both the version and configuration of a CLI-managed package, run:

tanzu package installed update INSTALLED-PACKAGE-NAME -v TARGET-PACKAGE-VERSION -f PACKAGE-CONFIGURATION-FILE -n INSTALLED-PACKAGE-NAMESPACE

Where:

  • INSTALLED-PACKAGE-NAME is the name that you chose for the package. To see the name of the package, you can run the tanzu package installed list command. For more information, see List Installed Packages.
  • (Optional) TARGET-PACKAGE-VERSION is the version that you want to update the package to. Not required if you are updating the package configuration, not the version.
  • (Optional) PACKAGE-CONFIGURATION-FILE is the path to the .yaml file that contains the updated package configuration. Not required if you are updating the package version, not the configuration. To retrieve the current configuration, see Get the Details of an Installed Package.
  • INSTALLED-PACKAGE-NAMESPACE is the namespace in which the package is installed.

Delete a Package

The tanzu package installed delete command deletes a CLI-managed package.

To delete a CLI-managed package from the target cluster:

  1. In a terminal, run:

    tanzu package installed delete INSTALLED-PACKAGE-NAME -n INSTALLED-PACKAGE-NAMESPACE
    

    Where:

    • INSTALLED-PACKAGE-NAME is the name of the package that you want to delete. To see the name of the package, you can run the tanzu package installed list command. For more information, see List Installed Packages.
    • INSTALLED-PACKAGE-NAMESPACE is the namespace in which the package is installed. If you do not specify a namespace, default namespace is used.
  2. (Optional) If you or another user created a namespace for this package by using the --create-namespace parameter with tanzu package install, ensure the namespace is empty and then delete the namespace.

Applying Overlays to Packages

To customize CLI-managed packages, you can apply ytt overlays.

check-circle-line exclamation-circle-line close-line
Scroll to top icon