github.com/Racer159/jackal@v0.32.7-0.20240401174413-0bd2339e4f2e/docs/5-jackal-tutorials/4-add-logging.md (about) 1 # Add Logging to a Cluster 2 3 ## Introduction 4 5 In this tutorial, we are going to show how you can use a Jackal component to inject zero-config, centralized logging into your Jackal cluster. 6 7 More specifically, you'll be adding a [Promtail / Loki / Grafana (PLG)](https://github.com/grafana/loki) stack to the [Retro Arcade Tutorial](./3-deploy-a-retro-arcade.md) by installing Jackal's "logging" component. 8 9 ## System Requirements 10 11 - You'll need an internet connection to grab the Jackal Init Package if it's not already on your machine. 12 13 ## Prerequisites 14 15 Prior to this tutorial you'll want to have a working cluster with Jackal initialized. 16 17 - Jackal binary installed on your $PATH: ([Installing Jackal](../1-getting-started/index.md#installing-jackal)) 18 - [Initialize a cluster](./1-initializing-a-k8s-cluster.md). 19 - Perform the [Retro Arcade Tutorial](./3-deploy-a-retro-arcade.md). 20 21 ## Youtube Tutorial 22 [](https://youtu.be/FYkafs1idlQ "Add Logging to an existing Jackal Cluster with Jackal Init") 23 24 ## Installing the Logging Component 25 26 1. Run the `jackal init` command on your cluster. 27 28 ```sh 29 $ jackal init 30 ``` 31 32 2. When prompted to deploy the package select `y` for Yes, then hit the `enter` 33 key. <br/> When prompted to deploy the logging component select `y` for Yes, then hit the `enter` key. 34 35 <iframe src="/docs/tutorials/logging_init_manual.html" height="800px" width="100%"></iframe> 36 37 4. You can automatically accept the logging component, and confirm the package using the `--confirm` and `--components` flags. 38 39 <iframe src="/docs/tutorials/logging_init.html" height="800px" width="100%"></iframe> 40 41 ### Connecting to the Logging Component 42 43 #### Note the Credentials 44 45 1. Review the `jackal init` command output for the following: 46 47 <iframe src="/docs/tutorials/logging_credentials.html" width="100%"></iframe> 48 49 You should see a section for `Logging`. You will need these credentials later on. 50 51 ## Deploy the Retro Arcade Tutorial 52 53 1. If you haven't already in the prerequisites, deploy the [Retro Arcade Tutorial](./3-deploy-a-retro-arcade.md). 54 55 ## Check the logs 56 57 :::note 58 59 Because Doom may be freshly installed it is recommended to refresh the page a few times to generate more log traffic to view in Grafana 60 61 ::: 62 63 64 ### Log into Grafana 65 66 To open Grafana you can use the `jackal connect logging` command. 67 68 You'll be redirected the `/login` page where you have to sign in with the Grafana credentials you saved [in a previous step](#note-the-credentials). 69 70  71 72 Once you've successfully logged in go to: 73 74 1. The "Explore" page (Button on the left that looks like a compass) 75 2. Select `Loki` in the dropdown, and then 76 3. Enter `{app="game"}` into the Log Browser query input field 77 78  79 80 Submit that query and you'll get back a dump of all the game pod logs that Loki has collected. 81 82  83 84 ## Removal 85 86 1. Use the `jackal package list` command to get a list of the installed packages and their components. This will give you the name of the init package and the logging component to remove it. 87 88 <iframe src="/docs/tutorials/logging_list.html" width="100%"></iframe> 89 90 2. Use the `jackal package remove` command to remove the `logging` component from the init package. Don't forget the `--confirm` flag. Otherwise you'll receive an error. 91 92 <iframe src="/docs/tutorials/logging_remove.html" width="100%" height="120px"></iframe> 93 94 95 ## Troubleshooting 96 97 ### Unable to connect to the Kubernetes cluster. 98 99 <iframe src="/docs/tutorials/troubleshoot_unreachable.html" width="100%" height="200px"></iframe> 100 101 :::info Remediation 102 103 If you receive this error, either you don't have a Kubernetes cluster, your cluster is down, or your cluster is unreachable. 104 105 1. Check your kubectl configuration, then try again. For more information about kubectl configuration see [Configure Access to Multiple Clusters](https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/) from the Kubernetes documentation. 106 107 If you need to setup a cluster, you can perform the following. 108 109 1. Deploy a Kubernetes cluster with the [Creating a K8s Cluster with Jackal](./5-creating-a-k8s-cluster-with-jackal.md) tutorial. 110 2. Perform the [Initialize a cluster](./1-initializing-a-k8s-cluster.md) tutorial. 111 112 After that you can try deploying the package again. 113 114 :::