Promtail + Loki + Grafana

The key component in this stack is Loki. Loki has a set of components which are internally referred to as modules. Each component spawns a gRPC server for internal traffic and an HTTP/1 server for external API requests.

There are two ways to deploy Loki, monolithic mode and microservices mode.

Monolithic mode (single process mode)

Monolithic mode (single process mode) is ideally suited for local development, small workloads, and for evaluation purposes.


  • Make sure KALM installed to your cluster.
  • Make sure you have kubectl and configure to your cluster.
  • Make sure your cluster has at least 500m cpu and 800Mi memory (each node has at least 100m cpu and 100Mi) to install PLG.

Install PLG on KALM

Run the following command to install monolithic mode plg. In the future, this step will be able to be done through web interface.

kubectl apply -f - <<EOF
apiVersion: v1
kind: Namespace
name: my-first-log-app
istio-injection: enabled
kalm-enabled: "true"
kind: LogSystem
name: plg
namespace: my-first-log-app
stack: plg-monolithic
retentionDays: 7
diskSize: 1Gi
storageClass: standard
image: grafana/loki:1.6.0
image: grafana/grafana:6.7.0
image: grafana/promtail:1.6.0

View & Query logs

kubectl -n my-first-log-app port-forward $(kubectl get pods -n my-first-log-app -l app=plg-grafana -o jsonpath="{.items[]}") 3000:3000

Open http://localhost:3000 in browser, and go to explore page. You can use label to filter logs you want. The query language here is called LogQL.

Let's view grafana log for demo by visiting this link.


Don't worry about the permission. As long as you don't give it a route, it will be only accessible locally with port-forward. External access with permissions is under development.



After test, you can run the following command to clean up the test logging system. If you are using cloud platform, you need also delete generated Disks to avoid unexpected charge.

kubectl delete -n my-first-log-app plg

Microservices mode


Working in progress.

Last updated on by david