Skip to main content

Deploying Local Zarf Packages

Introduction

In this tutorial, we are going to deploy the WordPress package onto your cluster using the package we created in the earlier create a package tutorial and the cluster we initialized in the initialize a k8s cluster tutorial. We will be leveraging that past work to go the extra step of deploying an application we packaged onto our cluster with the zarf package deploy command.

System Requirements

  • You'll need a machine that has access to a built-package and an initialized cluster.

Prerequisites

Prior to this tutorial you'll want to have a built package and a working cluster with Zarf initialized.

Deploying the WordPress package

  1. Use the zarf package deploy command to deploy the package you built in a the previous tutorial (see prerequisites).
note

If you do not provide the path to the package as an argument to the zarf package deploy command, Zarf will prompt you asking for you to choose which package you want to deploy. You can use the tab key, to be prompted for available packages in the current working directory.

By hitting 'tab', you can use the arrow keys to select which package you want to deploy. Since we are deploying the WordPress package in this tutorial, we will select that package and hit 'enter'.

  1. You will be presented with a chance to review the SBOMs for the package along with its definition followed by a series of prompts for each variable we setup in the previous tutorial. To confirm package deployment press y then enter and input a value for each variable when prompted followed by enter for them as well.
tip

To accept a default value for a given variable, simply press the enter key. You can also set variables from the CLI with the --set flag, an environment variable, or a config file.

  1. Because we included the connect services in the previous tutorial we can quickly test our package in a browser with zarf connect wordpress-blog.

Zarf Connect WordPress

  1. We can also explore the resources deployed by our package by running the zarf tools monitor command to start K9s. Once you are done, hit ctrl/control c to exit.

Zarf Tools Monitor

tip

Deploying packages isn't the only way to interact with them in the air gap. If you would like to quickly inspect a package and it's SBOMs you can use zarf package inspect to view them, and if you would like to push resources inside of a Zarf package (i.e. the images in this Wordpress package) to services in the air gap without running a deployment, you can do so with zarf package mirror-resources.

Removal

  1. Use the zarf package list command to get a list of the installed packages. This will give you the name of the WordPress package to remove it.
  1. Use the zarf package remove command to remove the wordpress package. Don't forget the --confirm flag. Otherwise you'll receive an error.
  1. You can also use the zarf package remove command with the zarf package file, to remove the package. Again, don't forget the --confirm flag.

The wordpress package has now been removed from your cluster.

Troubleshooting

Unable to connect to the Kubernetes cluster

Remediation

If you receive this error, either you don't have a Kubernetes cluster, your cluster is down, or your cluster is unreachable.

  1. Check your kubectl configuration, then try again. For more information about kubectl configuration see Configure Access to Multiple Clusters from the Kubernetes documentation.

If you need to setup a cluster, you can perform the following.

  1. Deploy a Kubernetes cluster with the Creating a K8s Cluster with Zarf tutorial.
  2. Perform the Initialize a cluster tutorial.

After that you can try deploying the package again.

Secrets "zarf-state" not found

Remediation

If you receive this error when zarf is attempting to deploy a package, this means you have not initialized the kubernetes cluster. This is one of the prerequisites for this tutorial. Perform the Initialize a cluster tutorial, then try again.