Install Packages
A package is off-the-shelf Kubernetes configuration published to an OCI registry, with the decisions an installation needs to make spelled out: which of its alternative bases to install, which optional parts to add, and the answers to a few inputs, such as a namespace or a URL. It plays the role of a Helm chart installed with helm install, or of an installer wizard, but what it produces is plain Kubernetes YAML that ConfigHub stores, rather than a template that is rendered again on every change. A package is a kustomize tree with an installer.yaml manifest that declares its bases, its optional parts as kustomize Components, its inputs, its dependencies on other packages, and the ConfigHub functions that adapt the rendered resources to the answers.
There are two ways to work with packages:
cub package, built intocub, installs a package into a Space and reports what is installed. This is all you need to install published packages, such as ConfigHub's own k8sbot and registrybot.- The installer plugin,
cub installer, does the same steps one at a time, in a working directory you keep, and builds, signs and publishes packages. See Working step by step, and writing packages.
A package's optional parts are kustomize Components, and the installer calls them components. They are not ConfigHub Components: installing a package makes one ConfigHub Component, whatever optional parts are selected.
Installing a package
cub package install pulls a package, asks for what its flags do not answer, renders it, and uploads the result into the Space --space names, creating the Space if it does not exist:
cub package install k8sbot --space k8sbot-base --namespace confighubbot --select argocd
The package is named in one of three ways:
<name>or<name>:<version>, such ask8sbotork8sbot:v0.2.13, for a package ConfigHub publishes, fromghcr.io/confighub/packages/<name>. Without a version, the newest release is installed.oci://<ref>for a package in any other OCI registry, such asoci://ghcr.io/acme/packages/shop:v1.2.0.- A path for a package on your machine, written with a
/(./my-package) or ending in.tgz.
When standard input is a terminal, the install prompts for each choice the flags leave open: the base, the optional components, and the inputs, each with its default. --non-interactive never prompts, and a required answer the flags don't give is then an error. The flags that answer:
--namespaceis the Kubernetes namespace to install into. A first install that does not prompt needs it.--basechooses among the package's bases; without it, the package's default base is installed.--selectadds an optional component, and is repeated for each; the components a selected one requires come with it.--componentstakes a preset instead:minimal,default,all, orselected.--input name=valueanswers one input, and is repeated for each.--set-image name=refoverrides an image, askustomize edit set imagewould, wherenameis the image without its tag or digest, such as--set-image nginx=mirror.example.com/nginx:1.27.3.
The install makes one Unit per resource, named as cub variant upload names them: a workload keeps its bare name (k8sbot), and everything else takes its kind (k8sbot-serviceaccount). References between the resources, such as a RoleBinding's to its Role, become Links, and the install lists the references nothing in the package provides, such as a Secret you are expected to create in the cluster.
The Space becomes the base variant of a Component named after the package, which the install creates if it does not exist: --variant gives the Space another Variant label, and an install into an existing Space keeps the one it has. Nothing is released. Create deployments from the base with cub variant create, and publish Releases of them, as you would for any other component:
cub variant create dev k8sbot/base --target dev/target
cub release publish k8sbot/dev
To install straight into a deployment instead, name its Target with --target.
Secrets are never uploaded. A package can render Secrets, from inputs or from facts it collects on your machine. The install works in a temporary directory, which it removes afterwards unless the package rendered Secrets; then it keeps the directory and names it, so that you can apply the Secrets to the cluster out of band. To choose the directory, pass --work-dir.
Seeing what is installed
Each install keeps an installer record in its Space: a hidden Unit named installer that holds the package, where it was pulled from, the base and components selected, and the answers given. cub package list reads the records, for the whole organization, for one package, or for one Space with --space:
$ cub package list
SPACE PACKAGE VERSION NAMESPACE SOURCE
k8sbot-base k8sbot v0.2.13 confighubbot oci://ghcr.io/confighub/packages/k8sbot:v0.2.13
cub package show prints one record in full: the components the package offers, with those selected marked, each input's answer beside its default, and the functions the render ran:
cub package show --space k8sbot-base
Changing answers and upgrading
Installing again into the same Space re-enters its record: the base, components and answers it recorded still apply, and the flags change only what they name. So the same command changes an answer, and upgrades to a newer version when one is named:
cub package install k8sbot --space k8sbot-base --non-interactive --input metrics=false
cub package install k8sbot:v0.2.14 --space k8sbot-base --non-interactive
--reuse takes the earlier choices as they are without prompting, even at a terminal. When a newer version adds an input that has a default, the default is adopted; a new input without one is prompted for, or with --non-interactive is an error that names it.
The new render is merged into the Units rather than replacing them, as an upgrade from upstream is, so a change you made to the base in ConfigHub after the install is kept unless the new render changes the same field. To keep a value even then, make the change with --protect, as protecting a variant's own values describes. A new resource gets a new Unit. A resource the package no longer renders has its Unit emptied rather than deleted, so it keeps its history and Links and the next Release removes the object from the cluster; the install lists those Units and asks first, unless --yes is given. Every Unit an install writes is labeled UploadSource=<package>, and an install writes and empties only the Units with its own package's label, so Units you add to the Space yourself are left alone.
The change stops at the base. Promote it into each deployment, and release it, when you are ready:
cub variant promote k8sbot/dev
cub release publish k8sbot/dev
Each install writes in a ChangeSet of its own, named upload-<time> after when it ran, which cub changeset list --space k8sbot-base lists. To undo an install, restore the package's Units to before its ChangeSet, including the hidden installer record, so that the record's answers match the Units again:
cub unit update --patch --space k8sbot-base \
--restore Before:ChangeSet:upload-20261204-175317 \
--where "Labels.UploadSource = 'k8sbot'" --include-hidden=InstallerRecord
Packages with dependencies
A package can depend on other packages, such as an application on the database it uses. Each dependency is installed into a Space of its own, as a variant of a Component of its own, and the dependent package's Space records the Components it depends on. --space-pattern names the dependencies' Spaces, as a Go template over .PackageName, .PackageVersion and .Variant; by default each is named after its package.
Working step by step, and writing packages
The installer is also a cub plugin, which adds the cub installer commands:
cub plugin install confighub/installer
cub installer install is the same as cub package install. The plugin also runs the same steps one at a time, in a working directory you keep, which is useful for reviewing what would change before ConfigHub does:
cub installer doc <package>prints what a package offers before you install it: its bases, components, inputs and requirements.listlists the tags of a package's repository, andinspectprints what one version contains without pulling it.cub installer setup --pull <package>pulls the package intopackage/, runs the wizard, and renders the resources intoout/manifests/, with your answers inout/record/. Editout/record/inputs.yamland runsetupagain to change an answer.--output-ociwrites the rendered resources as an OCI artifact instead, for Argo CD or Flux to read without ConfigHub.cub installer plan --space <space>shows what an upload would change in ConfigHub, and writes nothing.cub installer upload --space <space>uploads the render, ascub package installdoes, and prints the command that undoes the upload.
To publish a package of your own, cub installer init scaffolds one, or with --source starts it from a kustomization you already deploy; edit add adds inputs, components and dependencies to its installer.yaml; wizard renders it into a working directory and vet runs its validators on the result; build bundles it; push publishes it to an OCI registry; and sign and verify sign it with cosign and check the signature. The installer's author tutorial builds a package from an empty directory, and its author guide and consumer guide describe every command and field.
Related reading
- Install Helm Charts, for charts rather than packages
- Organize Configuration into Components
- Create and Manage Variants
- Store and Use Application Configuration, for the configuration files a package can carry