Carvel Logo

Consuming Packages using the CLI

Adding a PackageRepository to the cluster

We will be using the TCE repository maintained by the contributors to TCE for this tutorial.

Lets add the repository to our cluster using kctrl and a link to the imgpkg bundle.

$ kctrl package repo add -r tce --url                                                                                                                                                     
Target cluster '' (nodes: minikube)

Waiting for package repository to be added

1:43:45PM: packagerepository/tce ( namespace: default: Reconciling
1:43:51PM: packagerepository/tce ( namespace: default: ReconcileSucceeded


We can list available repositories to verify that the repo has been added.

$ kctrl package repo list                                                                                                                                                                                                              
Target cluster '' (nodes: minikube)

Repositories in namespace 'default'

Name  Source                                                 Status  
tce   (imgpkg)  Reconcile succeeded  


Lets take a quick look at the packages added as a part of this repository.

$ kctrl package available list                                                                                                                                                                                                         
Target cluster '' (nodes: minikube)

Available summarized packages in namespace 'default'

Name                                           Display name        cert-manager             contour        external-dns          fluent-bit          gatekeeper             grafana              harbor     knative-serving  local-path-storage          multus-cni          prometheus              velero         whereabouts  


We can get more details about a particular package.

$ kctrl package available get -p                                                                                                                                                               
Target cluster '' (nodes: minikube)

Display name         cert-manager  
Categories           - certificate management  
Short description    Certificate management  
Long description     Provides certificate management provisioning within the cluster  
Provider             VMware  
Maintainers          - name: Nicholas Seemiller  
Support description  Go to for documentation

Version  Released at  
1.3.3    2021-08-06 18:01:21 +0530 IST  
1.4.4    2021-08-23 22:17:51 +0530 IST  
1.5.4    2021-08-23 22:52:51 +0530 IST  
1.6.1    2021-10-29 17:30:00 +0530 IST  


Installing a Package

Lets install one of these packages. kctrl creates the associated resources required by the PackageInstall to create resources on the cluster.

$ kctrl package install -i cert-man -p --version 1.6.1                                                                                  

Target cluster '' (nodes: minikube)

Creating service account 'cert-man-default-sa'

Creating cluster admin role 'cert-man-default-cluster-role'

Creating cluster role binding 'cert-man-default-cluster-rolebinding'

Creating package install resource

Waiting for PackageInstall reconciliation for 'cert-man'

1:56:57PM: packageinstall/cert-man ( namespace: default: Reconciling
1:57:24PM: packageinstall/cert-man ( namespace: default: ReconcileSucceeded


kctrl waits for the PackageInstall to reconcile successfully.

Users can also pass a values.yml file defining values to be consumed by the package using the --values-file flag. Let’s see what values are accepted by the Cert Manager Package and supply custom values to it.

$ kctrl package available get -p --values-schema                                                                                                                                         
Target cluster '' (nodes: minikube)

Values schema for ''

Key        Default       Type    Description  
namespace  cert-manager  string  The namespace in which to deploy cert-manager.  


It is worth noting that both the package name and version have to be supplied to view the values a package accepts as these might change across versions. kctrl accepts this in the package-name/package-version format.

Lets create a values.yml file that supplies a custom value for namespace to the installation.

cat > values.yml << EOF
namespace: cert-man-install

Let’s update the installation to use these values.

kctrl creates a secret with the values defined in the file, updates the package installation to consume it and then waits for it to reconcile to the new desired state.

$ kctrl package installed update -i cert-man --values-file values.yml                                                                                

Target cluster '' (nodes: minikube)

Getting package install for 'cert-man'

Creating secret 'cert-man-default-values'

Updating package install for 'cert-man'

Waiting for PackageInstall reconciliation for 'cert-man'

2:07:48PM: packageinstall/cert-man ( namespace: default: Reconciling
2:08:18PM: packageinstall/cert-man ( namespace: default: Reconciling
2:08:28PM: packageinstall/cert-man ( namespace: default: ReconcileSucceeded


Deleting an installation

kctrl can be used to delete an installation and associated resources created with it. kctrl waits for them to be deleted from the cluster.

$ kctrl package installed delete -i cert-man                                                                           

Delete package install 'cert-man' from namespace 'default'

Continue? [yN]: y

Target cluster '' (nodes: minikube)

Deleting package install 'cert-man' from namespace 'default'

Waiting for deletion of package install 'cert-man' from namespace 'default'

2:12:28PM: packageinstall/cert-man ( namespace: default: Deleting
2:12:52PM: packageinstall/cert-man ( namespace: default: DeletionSucceeded

Deleting 'ServiceAccount': cert-man-default-sa

Deleting 'ClusterRole': cert-man-default-cluster-role

Deleting 'ClusterRoleBinding': cert-man-default-cluster-rolebinding

Deleting 'Secret': cert-man-default-values


Deleting an added repository

kctrl deletes the PackageRepository and waits till it is deleted from the cluster.

$ kctrl package repo delete -r tce                                                                                                                                                                                                     
Target cluster '' (nodes: minikube)

Deleting package repository 'tce' in namespace 'default'

Continue? [yN]: y

Waiting for deletion to be completed...

2:21:58PM: packagerepository/tce ( namespace: default: Deleting
2:22:02PM: packagerepository/tce ( namespace: default: DeletionSucceeded



You can now get up and running with published repositories and manage packages faster using kctrl.

(Help improve our docs: edit this page on GitHub)