Menu

This is documentation for the next version of Loki. For the latest stable release, go to the latest version.

Open source RSS

Install the microservice Helm chart

This Helm Chart deploys Grafana Loki on Kubernetes.

This Helm chart deploys Loki to run Loki in microservice mode within a Kubernetes cluster. The microservices deployment mode runs components of Loki as distinct processes.

The default Helm chart deploys the following components:

  • Compactor component (1 replica): Compacts and processes stored data.
  • Distributor component (3 replicas, maxUnavailable: 2): Distributes incoming requests. Up to 2 replicas can be unavailable during updates.
  • IndexGateway component (2 replicas, maxUnavailable: 1): Handles indexing. Up to 1 replica can be unavailable during updates.
  • Ingester component (3 replicas): Handles ingestion of data.
  • Querier component (3 replicas, maxUnavailable: 2): Processes queries. Up to 2 replicas can be unavailable during updates.
  • QueryFrontend component (2 replicas, maxUnavailable: 1): Manages frontend queries. Up to 1 replica can be unavailable during updates.
  • QueryScheduler component (2 replicas): Schedules queries.

Note

We do not recommend running in Microservice mode with filesystem storage. For the purpose of this guide, we will use MinIO as the object storage to provide a complete example.

Prerequisites

  • Helm 3 or above. See Installing Helm.
  • A running Kubernetes cluster (must have at least 3 nodes).

Deploying the Helm chart for development and testing

  1. Add Grafana’s chart repository to Helm:

    bash
    helm repo add grafana https://grafana.github.io/helm-charts
  2. Update the chart repository:

    bash
    helm repo update
  3. Create the configuration file values.yaml. The example below illustrates how to deploy Loki in test mode using MinIO as storage:

    yaml
    loki:
       schemaConfig:
         configs:
           - from: "2024-04-01"
             store: tsdb
             object_store: s3
             schema: v13
             index:
               prefix: loki_index_
               period: 24h
       ingester:
         chunk_encoding: snappy
       querier:
         # Default is 4, if you have enough memory and CPU you can increase, reduce if OOMing
         max_concurrent: 4
       pattern_ingester:
         enabled: true
       limits_config:
         allow_structured_metadata: true
         volume_enabled: true
         retention_period: 672h
       compactor:
         retention_enabled: true 
         delete_request_store: s3
    
    deploymentMode: Distributed
    
    ingester:
      replicas: 3 # To ensure data durability with replication
    querier:
      replicas: 3 # Improve query performance via parallelism
      maxUnavailable: 2
    queryFrontend:
      replicas: 2
      maxUnavailable: 1
    queryScheduler:
      replicas: 2
    distributor:
      replicas: 3 
      maxUnavailable: 2
    compactor:
      replicas: 1
    indexGateway:
      replicas: 2
      maxUnavailable: 1
    
    bloomPlanner:
      replicas: 0
    bloomBuilder:
      replicas: 0
    bloomGateway:
      replicas: 0
    
    backend:
       replicas: 0
    read:
       replicas: 0
    write:
       replicas: 0
    
    singleBinary:
       replicas: 0
    
     # This exposes the Loki gateway so it can be written to and queried externaly
    gateway:
       service:
         type: LoadBalancer
    
    
    # Enable minio for storage
    minio:
      enabled: true
  4. Install or upgrade the Loki deployment.

    • To install:
      bash
      helm install --values values.yaml loki grafana/loki
    • To upgrade:
      bash
      helm upgrade --values values.yaml loki grafana/loki
  5. Verify that Loki is running:

    bash
    kubectl get pods -n loki

    The output should an output similar to the following:

    bash
      loki-canary-8thrx                      1/1     Running   0          167m
      loki-canary-h965l                      1/1     Running   0          167m
      loki-canary-th8kb                      1/1     Running   0          167m
      loki-chunks-cache-0                    2/2     Running   0          167m
      loki-compactor-0                       1/1     Running   0          167m
      loki-compactor-1                       1/1     Running   0          167m
      loki-distributor-7c9bb8f4dd-bcwc5      1/1     Running   0          167m
      loki-distributor-7c9bb8f4dd-jh9h8      1/1     Running   0          167m
      loki-distributor-7c9bb8f4dd-np5dw      1/1     Running   0          167m
      loki-gateway-77bc447887-qgc56          1/1     Running   0          167m
      loki-index-gateway-0                   1/1     Running   0          167m
      loki-index-gateway-1                   1/1     Running   0          166m
      loki-ingester-zone-a-0                 1/1     Running   0          167m
      loki-ingester-zone-b-0                 1/1     Running   0          167m
      loki-ingester-zone-c-0                 1/1     Running   0          167m
      loki-minio-0                           1/1     Running   0          167m
      loki-querier-bb8695c6d-bv9x2           1/1     Running   0          167m
      loki-querier-bb8695c6d-bz2rw           1/1     Running   0          167m
      loki-querier-bb8695c6d-z9qf8           1/1     Running   0          167m
      loki-query-frontend-6659566b49-528j5   1/1     Running   0          167m
      loki-query-frontend-6659566b49-84jtx   1/1     Running   0          167m
      loki-query-frontend-6659566b49-9wfr7   1/1     Running   0          167m
      loki-query-scheduler-f6dc4b949-fknfk   1/1     Running   0          167m
      loki-query-scheduler-f6dc4b949-h4nwh   1/1     Running   0          167m
      loki-query-scheduler-f6dc4b949-scfwp   1/1     Running   0          167m
      loki-results-cache-0                   2/2     Running   0          167m

Object Storage Configuration

After testing Loki with MinIO, we recommend configuring Loki with an object storage provider. The following examples shows how to configure Loki with different object storage providers:

Caution

When deploying Loki using S3 Storage DO NOT use the default bucket names; chunk, ruler and admin. Choose a unique name for each bucket. For more information see the following security update. This caution does not apply when you are using MinIO. When using MinIO we recommend using the default bucket names.

To configure other storage providers, refer to the Helm Chart Reference.

Deploying the Loki Helm chart to a Production Environment

Note

We are actively working on providing more guides for deploying Loki in production.

We recommend running Loki at scale within a cloud environment like AWS, Azure, or GCP. The below guides will show you how to deploy a minimally viable production environment.

Next Steps