Loki Helm Chart


Make sure you have Helm installed and deployed to your cluster. Then add Loki’s chart repository to Helm:

$ helm repo add loki https://grafana.github.io/loki/charts

You can update the chart repository by running:

$ helm repo update

Deploy Loki and Promtail to your cluster

Deploy with default config

$ helm upgrade --install loki loki/loki-stack

Deploy in a custom namespace

$ helm upgrade --install loki --namespace=loki-stack loki/loki-stack

Deploy with custom config

$ helm upgrade --install loki loki/loki-stack --set "key1=val1,key2=val2,..."

Deploy Loki only

$ helm upgrade --install loki loki/loki

Deploy Promtail only

We recommend Promtail to ship your logs to Loki as the configuration is very similar to Prometheus. This allows you to ensure that labels for metrics and logs are equivalent by re-using the same scrape_configs and relabeling configuration. When using Grafana having the same labels will allows you to pivot from Metrics to Logs verify easily by simply switching datasource.

To only install Promtail use the following command:

$ helm upgrade --install promtail loki/promtail --set "loki.serviceName=loki"

If you’re not familiar with Prometheus and you don’t want to migrate your current agent configs from the start, you can use our output plugins specified below.

Deploy Loki and Fluent Bit to your cluster

$ helm upgrade --install loki loki/loki-stack \
    --set fluent-bit.enabled=true,promtail.enabled=false

Deploy Fluent Bit only

$ helm upgrade --install fluent-bit loki/fluent-bit \
    --set "loki.serviceName=loki.svc.cluster.local"

Deploy Loki and Filebeat and logstash to your cluster

$ helm upgrade --install loki loki/loki-stack \
    --set filebeat.enabled=true,logstash.enabled=true,promtail.enabled=false \
    --set loki.fullnameOverride=loki,logstash.fullnameOverride=logstash-loki

Deploy Grafana to your cluster

To install Grafana on your cluster with helm, use the following command:

# with Helm 2
$ helm install stable/grafana -n loki-grafana --namespace <YOUR-NAMESPACE>

# with Helm 3
$ helm install loki-grafana stable/grafana -n <YOUR-NAMESPACE>

The chart loki-stack contains a pre-configured Grafana, simply use --set grafana.enabled=true

To get the admin password for the Grafana pod, run the following command:

$ kubectl get secret --namespace <YOUR-NAMESPACE> loki-grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo

To access the Grafana UI, run the following command:

$ kubectl port-forward --namespace <YOUR-NAMESPACE> service/loki-grafana 3000:80

Navigate to http://localhost:3000 and login with admin and the password output above. Then follow the instructions for adding the loki datasource, using the URL http://loki:3100/.

Run Loki behind https ingress

If Loki and Promtail are deployed on different clusters you can add an Ingress in front of Loki. By adding a certificate you create an https endpoint. For extra security enable basic authentication on the Ingress.

In Promtail set the following values to communicate with https and basic auth

  serviceScheme: https
  user: user
  password: pass

Sample helm template for ingress:

apiVersion: extensions/v1beta1
kind: Ingress
    ingress.kubernetes.io/auth-type: "basic"
name: loki
- host: 
    - backend:
        serviceName: loki
        servicePort: 3100
- secretName: 

Run promtail with syslog support

In order to receive and process syslog message into promtail, the following changes will be necessary:

  - job_name: syslog
        job: "syslog"
    - source_labels: ['__syslog_message_hostname']
      target_label: 'host'
  enabled: true
  type: LoadBalancer
  port: 1514

Run promtail with systemd-journal support

In order to receive and process syslog message into promtail, the following changes will be necessary:

# Add additional scrape config
  - job_name: journal
      path: /var/log/journal
      max_age: 12h
        job: systemd-journal
      - source_labels: ['__journal__systemd_unit']
        target_label: 'unit'
      - source_labels: ['__journal__hostname']
        target_label: 'hostname'

# Mount journal directory into promtail pods
  - name: journal
      path: /var/log/journal

  - name: journal
    mountPath: /var/log/journal
    readOnly: true

How to contribute

After adding your new feature to the appropriate chart, you can build and deploy it locally to test:

$ make helm
$ helm upgrade --install loki ./loki-stack-*.tgz

After verifying your changes, you need to bump the chart version following semantic versioning rules. For example, if you update the loki chart, you need to bump the versions as follows:

You can use the make helm-debug to test and print out all chart templates. If you want to install helm (tiller) in your cluster use make helm-install, to install the current build in your Kubernetes cluster run make helm-upgrade.