Adopt Pre-Existing Resources
In this tutorial, you will create a test workload prior to initializing Zarf. After that you will then use Zarf to adopt those workloads, so you can manage their future lifecycle with Zarf.
- You’ll need an internet connection to grab the Zarf Init Package if it’s not already on your machine.
-
Prior to this tutorial you’ll want to have a working cluster. But unlike our other tutorials you don’t want Zarf initialized.
-
Zarf binary installed on your $PATH: (Installing Zarf)
We’re going to use the manifests from the Deploying a Retro Arcade tutorial for this example. So if you haven’t yet, clone the Zarf repository, and navigate to the cloned repository’s root directory.
- Create the dos-games namespace
- Use the dos-games example manifests, to deploy the dos-games deployment and service to your Kubernetes cluster.
- Use the
kubectl port-forward
command to confirm you’ve deployed the manifests properly.
- Navigate to
http://localhost:8000
in your browser to view the dos-games application. It will look something like this:
- Use the Initializing a K8s Cluster tutorial, to initialize Zarf in the cluster.
The iframe was pointing to the wrong file, and this likely would be better as an admonition.
Deploy the Package, Adopting the Workloads
Section titled “Deploy the Package, Adopting the Workloads”- Use the
zarf package deploy
command with the--adopt-existing-resources
flag to adopt the existing dos-games resources in thedos-games
namespace.
- You’ll notice the dos-games namespace is no longer excluded from Zarf management as it has the
app.kubernetes.io/managed-by=zarf
label. This means that Zarf will now manage any resources in this namespace.
- You can also now use the
zarf connect
command to connect to the dos-games application. Again it will look something like this.
At this point the dos-game package is managed by Zarf and will behave just like a package initially deployed with Zarf.