This topic describes how to install and manage packages and package repositories using the Tanzu CLI.
NoteThe
tanzu packageCLI 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.
Before installing CLI-managed packages from the standard package repository:
tanzu-standard package repository. If you are targeting a plan-based cluster (legacy), skip this step. For plan-based clusters, the tanzu-standard package repository is automatically enabled in every cluster, in the tanzu-package-repo-global namespace.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:
Packages: See this section if you want to:
For more information about tanzu package commands, see tanzu package.
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.
The sections below describe how to list, add, update, and delete 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
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.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.
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.
NoteIf you are targeting a plan-based cluster (legacy), skip this step. For plan-based clusters, the
tanzu-standardpackage repository is automatically enabled in every cluster, in thetanzu-package-repo-globalnamespace.
tanzu package repository add tanzu-standard --url projects.registry.vmware.com/tkg/packages/standard/repo:v2.1.1 --namespace tkg-system
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.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.The sections below describe how to list, install, update, and delete 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
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 retrieve the default configuration of an available package, use the --default-values-file-output flag of the tanzu package available get command:
tanzu package available get AVAILABLE-PACKAGE-NAME/AVAILABLE-PACKAGE-VERSION -n AVAILABLE-PACKAGE-NAMESPACE --default-values-file-output FILE-PATH
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
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.
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 --values-file-output FILE-PATH
Where FILE-PATH is the path to the file. For example, values.yaml.
The tanzu package install command installs a CLI-managed package.
To install a CLI-managed package in the target cluster:
If you have not already done so, add the package repository that contains the package. See Add a Package Repository above.
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.
Install the package:
tanzu package install PACKAGE-NAME -p AVAILABLE-PACKAGE-NAME -v AVAILABLE-PACKAGE-VERSION --values-file PACKAGE-CONFIGURATION-FILE -n TARGET-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.TARGET-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.
-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.kubectl create namespace my-packages.To see the full list of supported flags for this command, use the --help option.
To confirm that the package has been installed, run the tanzu package installed list command. See List Installed Packages above.
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 --values-file 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.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.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.NoteFor workload clusters upgraded from TKG v2.1.0 to v2.1.1, updating
cert-manager,external-dns, andgrafanaconfigurations may require upgrading the package version, as described in the Known Issues listing Configuration update requires upgrade for some packages.
The tanzu package installed delete command deletes a CLI-managed package.
To delete a CLI-managed package from the target cluster, 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.To customize CLI-managed packages, you can apply ytt overlays.