github.com/Racer159/jackal@v0.32.7-0.20240401174413-0bd2339e4f2e/docs/5-jackal-tutorials/5-creating-a-k8s-cluster-with-jackal.md (about) 1 # Creating a K8s Cluster with Jackal 2 3 In this tutorial, we will demonstrate how to use Jackal on a fresh Linux machine to deploy a [k3s](https://k3s.io/) cluster through Jackal's `k3s` component. 4 5 ## System Requirements 6 7 - `root` access on a Linux machine 8 9 :::info REQUIRES ROOT 10 The 'k3s' component requires root access (not just `sudo`!) when deploying as it will modify your host machine to install the cluster. 11 ::: 12 13 ## Prerequisites 14 15 Before beginning this tutorial you will need the following: 16 17 - The [Jackal](https://github.com/Racer159/jackal) repository cloned: ([`git clone` Instructions](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)) 18 - Jackal binary installed on your $PATH: ([Installing Jackal](../1-getting-started/index.md#installing-jackal)) 19 - An init-package built/downloaded: ([init-package Build Instructions](./0-creating-a-jackal-package.md)) or ([Download Location](https://github.com/Racer159/jackal/releases)) 20 21 ## Creating the Cluster 22 23 1. Run the `jackal init` command as `root`. 24 25 ```sh 26 # jackal init 27 ``` 28 29 2. Confirm Package Deployment: <br/> 30 - When prompted to deploy the package select `y` for Yes, then hit the `enter` key. <br/> 31 32 3. Confirm k3s Component Deployment: <br/> 33 - When prompted to deploy the k3s component select `y` for Yes, then hit the `enter` key. 34 35 <iframe src="/docs/tutorials/k3s_init.html" height="750px" width="100%"></iframe> 36 37 :::tip 38 You can automatically accept the k3s component and confirm the package using the `--components` and `--confirm` flags. 39 40 ```sh 41 $ jackal init --components="k3s" --confirm 42 ``` 43 ::: 44 45 ### Validating the Deployment 46 After the `jackal init` command is done running, you should see a k3s cluster running and a few `jackal` pods in the Kubernetes cluster. 47 48 ```sh 49 # jackal tools monitor 50 ``` 51 :::note 52 You can press `0` if you want to see all namespaces and CTRL-C to exit 53 ::: 54 55 ### Accessing the Cluster as a Normal User 56 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: 57 58 ```sh 59 # cp /root/.kube/config /home/otheruser/.kube 60 # chown otheruser /home/otheruser/.kube/config 61 # chgrp otheruser /home/otheruser/.kube/config 62 ``` 63 64 ## Cleaning Up 65 66 The [`jackal destroy`](../2-the-jackal-cli/100-cli-commands/jackal_destroy.md) command will remove all of the resources, including the k3s cluster, that was created by the initialization command. 67 68 ```sh 69 jackal destroy --confirm 70 ```