Create a Package
The following diagram shows the order of operations for the zarf package create
command and the hook locations for actions.
Lifecycle Diagram
There are two types of Zarf Packages, the ZarfInitConfig
and the ZarfPackageConfig
, which are distinguished by the kind:
field and specified in the zarf.yaml
file.
Throughout the rest of the documentation, we will refer to the ZarfInitConfig
as an init config
package or init
package, and to the ZarfPackageConfig
as simply a “package”.
The init package is used to initialize a cluster, making it ready for deployment of other Zarf Packages. It must be executed once on each cluster that you want to deploy another package onto, even if multiple clusters share the same host. For additional information on the init package, we provide detailed documentation on the Zarf ‘init’ package page.
If there is no running cluster, the init package can be used to create one. It has a deployable K3s cluster component that can be optionally deployed on your machine. Usually, an init package is the first Zarf Package to be deployed on a cluster as other packages often depend on the services installed or configured by the init package. If you want to install a K8s cluster with Zarf, but you don’t want to use K3s as your cluster, you will need to create or find another Zarf Package that will stand up your cluster before you run the zarf init command.
During the initialization process, Zarf will seed your cluster with a container registry to store images that other packages may require. Additionally, the init package has the option to deploy other features to your cluster, such as a Git server to manage your repositories or a PLG logging stack that allows you to monitor the applications running on your cluster.
To initialize your cluster, you need to run the command zarf init
. This command will search for a file with the specific naming convention: zarf-init-{ARCHITECTURE}-{VERSION}.tar.zst
. The architecture must match that of the cluster you are deploying to. If you are deploying to a cluster with a different architecture, you will need to specify the name of the architecture you are deploying on with the -a
flag. For example, if you are on an arm64 machine but are deploying on an amd64 machine, you will run zarf init -a amd64
.
Init packages can also be run with zarf package deploy zarf-init-{ARCHITECTURE}-{VERSION}.tar.zst
.
You do not need to create init configs by yourself unless you want to customize how your cluster is installed/configured. For example, if you want to use the init process to install a specifically configured K3s cluster onto your host machine, you can create a specific package to do that before running the init package.
ZarfPackageConfig
refers to any package that is not an init package and is used to define specific capabilities that you want to deploy onto your initialized cluster.
To deploy a Zarf Package, you can use the command zarf package deploy
. This will prompt you to select from all of the files in your current directory that match the name zarf-package-*.tar.zst
. Alternatively, if you already know which package you want to deploy, you can simply use the command zarf package deploy {PACKAGE_NAME}
.
During the deployment process, Zarf will leverage the infrastructure created during the ‘init’ process (such as the Docker registry and Git server) to push all the necessary images and repositories required for the package to operate.
You can also specify zarf.yaml
package configuration templates at package create time by including ###_ZARF_PKG_TMPL_*###
as the value for any string-type data in your package definition. These values are discovered during zarf package create
and will always be prompted for if not using --confirm
or --set
. An example of this is below: