Skip to content

Creating a K8s Cluster with Zarf

In this tutorial, we will demonstrate how to use Zarf on a fresh Linux machine to deploy a k3s cluster through Zarf’s k3s component.

  • root access on a Linux machine

Before beginning this tutorial you will need the following:

  1. Run the zarf init command as root.
Terminal window
# zarf init
  1. Confirm Package Deployment:
  • When prompted to deploy the package select y for Yes, then hit the enter key.
  1. Confirm k3s Component Deployment:
  • When prompted to deploy the k3s component select y for Yes, then hit the enter key.

After the zarf init command is done running, you should see a k3s cluster running and a few zarf pods in the zarf namespace.

By default, the k3s component will only automatically provide cluster access to the root user. To access the cluster as another user, you can run the following to setup the ~/.kube/config file:

Terminal window
# cp /root/.kube/config /home/otheruser/.kube
# chown otheruser /home/otheruser/.kube/config
# chgrp otheruser /home/otheruser/.kube/config

The zarf destroy command will remove all of the resources, including the k3s cluster, that was created by the initialization command.

Terminal window
zarf destroy --confirm