This example demonstrates using a Zarf component to inject zero-config, centralized logging into your Zarf cluster.
More specifically, you'll be adding a Promtail / Loki / Grafana (PLG) stack to the example game cluster by installing Zarf's "logging" component.
Here's what you'll do in this example:
This scenario builds upon the previous one, so:
-
Run through the Zarf game example but stop when you're told to run
zarf init
-
Take a deep breath—because it's good for your body—and read on!
Installing a Zarf component is really easy—you just have to let zarf init
know that you want use it. That's it!
Exactly like when you first created the game example cluster, you move into the directory holding your init package and run:
cd <same dir as zarf-init-<arch>.tar.zst>
zarf init
You can answer the follow-on prompts in almost the exact same way as during your original install except this time answer "yes" when asked whether to install the "logging" component.
Give it some time for the new logging pods to come up and you're ready to go!
Note
Zarf supports non-interactive installs too! See
zarf init --help
for how to make that work.
Go back to your terminal and review the zarf init
command output—the very last thing printed should be a set of credentials Zarf has generated for you.
Pay attention to these because you're going to need them to log into your shiny, new Grafana installation.
The line you want will look something like this:
The ones under "Logging" are what you'll need.
We've only just installed the logging utilities so we (likely) haven't had time to record anything interesting. Since log aggregation & monitoring aren't worth much without something to collect, let's get some data in there.
Deploy the Game example again, then pull up the game in your brower—instructions here, in case you forgot how—and then reload the browser window a few times.
Doing that sends a bunch of HTTP traffic into the cluster & should give you something worth looking at in Grafana.
Now that you've got some logs worth looking at, you're ready to log into your brand new Grafana instance.
Get started by opening Grafana using zarf connect logging
You'll be redirected the /login
page where you have to sign in with the Grafana credentials you saved in a previous step.
Once you've successfully logged in go to:
-
The "Explore" page (Button on the left that looks like a compass)
-
you can select
Loki
in the dropdown, and then -
enter
{app="game"}
into the Log Browser query input field
Submit that query and you'll get back a dump of all the game pod logs that Loki has collected. Neat!
Once you've had your fun it's time to clean up.
In this case, since the Zarf cluster was installed specifically (and only) to serve this example, clean up is really easy—you just tear down the entire cluster:
kind delete cluster
It takes just a couple moments for the entire cluster to disappear—long-running system services and all—leaving your machine squeaky clean.