Skip to content
EgyKode
10 · ObservabilityLab 51 / 59
Guided lablogging

Centralised Logging with Loki and Grafana

Ship every Pod's logs somewhere they survive the Pod, then answer a real question with them.

Time
50 min
Level
Intermediate
Objectives
4 objectives
Cost
Free

Where this fits in the platform

This lab adds

  • Logs you can search after the pod that wrote them is gone

Which lets you

Before you start

You will need

  • kind or minikube
  • Helm 3.14+
  • kubectl

You do not need these already — the lab environment below provides them.

You will be able to

  • Query logs by label instead of grepping a stream
  • Correlate a metric spike with the log lines behind it
  • Explain why Loki indexes labels rather than content

CostFree

on kind or minikube. On a cloud cluster Loki requests a persistent volume, billed per GB-month — see cleanup.

Nothing to pay in the browser. Open the terminal runs this against a simulated cloud — the same API calls and the same commands, with no account and no bill. The figure above applies only if you build it in your own.

How to clean up

The scenario#

A Pod crashed at 3am. It has been replaced, and kubectl logs shows the new one. The evidence went with the old container.

Metrics told you that something broke. Logs are how you find out why — but only if they left the node before the Pod did.

Hands-on environment

Run this lab in a real terminal, free and in your browser. The environment is temporary and yours alone — break it as much as you like.

Open the terminal

Opens in Killercoda, in a new tab — keep this page open for the steps.

Run it on your own machine

Run this lab on your own machine. One command starts the environment, with everything the lab needs already installed:

You will need:

  • docker
  • kubectl
  • kind
git clone https://github.com/EgyKode/EgyKode-lab.git
cd EgyKode-lab
./egykode start k8s
./egykode shell

You need Docker and Git installed. Everything else runs inside the environment. The first start downloads it and takes a few minutes; later starts are seconds.

Not sure what you already have? Run: npm run doctor — it checks and changes nothing.

Anything you tick here is your own record. EgyKode cannot see inside that terminal, so the success criteria stay self-assessed even when the environment checks your work for you.

Install the stack

Step 1 of 6

Clean up#

Run this even if you did not finish.

DestructiveThis removes real resources. Check which environment you are in first.

Terminal
helm uninstall loki -n monitoring
kubectl delete pvc --all -n monitoring   # PVCs survive uninstall
kubectl delete namespace monitoring --ignore-not-found

Cost of this lab: Free on kind or minikube. On a cloud cluster Loki requests a persistent volume, billed per GB-month — see cleanup.

Maintained by others, on Killercoda. Useful for extra repetition on one tool — it does not complete this lab or settle any criterion above.

Success criteria

0 of 4

The concept behind it

Ready to try it without help?Do the challenge

Phase complete · 10 Observability

You can now: Metrics, logs, dashboards and alerts exist — and the alerts are ones a human can act on.

Next phase

Lab 51 of 59 on the project path

11 · Operating itIncident: CrashLoopBackOffA container starts, dies, and restarts forever. The current logs are empty. Find out what the one that died said.35 minAdvanced

Previous: Custom Prometheus Alert Rules & Grafana Dashboards