Helm chartv21.6.3App 3.7.10Verified publisher

Helm chart for Grafana Loki supporting monolithic, simple scalable, and microservices modes.

About this chart

loki

Helm chart for Grafana Loki supporting monolithic, simple scalable, and microservices modes.

Source Code

Requirements

The Following are installed via subchart

RepositoryName
https://grafana.github.io/helm-chartsrollout_operator(rollout-operator)

Find more information in the Loki Helm Chart documentation.

Installing the Chart

OCI Registry

OCI registries are preferred in Helm as they implement unified storage, distribution, and improved security.

helm install RELEASE-NAME oci://ghcr.io/grafana-community/helm-charts/loki

HTTP Registry

helm repo add grafana-community https://grafana-community.github.io/helm-charts
helm repo update
helm install RELEASE-NAME grafana-community/loki

Uninstalling the Chart

To remove all of the Kubernetes objects associated with the Helm chart release:

helm delete RELEASE-NAME

Gateway proxy

The chart uses NGINX for the Loki gateway by default. Envoy is available as an opt-in, experimental implementation; its gateway.envoyConfig values and the rendered Envoy configuration may change in minor releases:

gateway:
  type: envoy

The generated Envoy configuration keeps the same Loki API routing and deployment-mode targets as the generated NGINX configuration, including an unauthenticated 200 for / and /livez. Unknown paths return 404 instead of being proxied. It accepts HTTP/1.1 and cleartext HTTP/2, listens on IPv4 and IPv6 by default, enables frontend and backend keep-alive, and writes access logs to stdout. Envoy exposes native Prometheus metrics from the existing gateway metrics Service at /stats/prometheus; its administration listener allows only /ready and /stats/prometheus. Kubernetes readiness checks use /ready on the administration listener, while liveness checks use /livez, which is excluded from proxy access logs.

Envoy uses Loki's cleartext HTTP/2 support for regular upstream requests by default. WebSocket tail requests use a dedicated HTTP/1.1 upstream cluster. Disable gateway.envoyConfig.upstreamHTTP2 for older Loki versions or custom upstreams that support only HTTP/1.1.

For HTTPS Loki upstreams, Envoy verifies the certificate chain against the image's system CA bundle and checks the upstream hostname. Set gateway.envoyConfig.upstreamTLS.caCertificateFile to a mounted custom CA bundle when needed. gateway.envoyConfig.upstreamTLS.insecureSkipVerify: true explicitly disables both checks.

Use gateway.envoyConfig to configure listeners, timeouts, logging, TLS, remote JWKS validation, upstream HTTP/2, or the complete Envoy configuration. The existing gateway.nginxConfig.schema and customReadUrl/customWriteUrl/customBackendUrl values are also honored; Envoy accepts scheme, host and port in these URLs and rejects a path component, because its routes forward the original request path unchanged.

Envoy uses its native Basic Auth filter and the existing gateway.basicAuth .htpasswd Secret contract, so no authorization sidecar is added. The native filter only accepts {SHA} htpasswd entries, an unsalted SHA-1 digest that is weaker than the bcrypt hashes NGINX uses by default and can be brute-forced offline by anyone who can read the Secret; the chart derives that format from plaintext password values, while other passwordHash formats remain supported by NGINX only. Generate an Envoy hash with printf %s 'password' | openssl dgst -sha1 -binary | openssl base64 -A, then prefix the result with {SHA}. When loki.tenants is configured and at least one authentication method is enabled, the gateway overwrites any client-supplied X-Scope-OrgID header with the mapped tenant name; with only gateway.basicAuth.username and no tenants, Basic Auth is enforced but the client header passes through unchanged, as with NGINX. A tenant that defines jwtSubClaim or clientCertificateCN accepts Basic Auth only when it also sets password or passwordHash. Only name, password, and passwordHash are shared by both gateway implementations; basicAuthUsername, clientCertificateCN, and jwtSubClaim are Envoy-only. basicAuthUsername defaults to the tenant name and can map a distinct username to one or more Loki tenants:

loki:
  tenants:
    - name: "cluster1|cluster2|cluster3"
      basicAuthUsername: grafana
      passwordHash: "{SHA}eJy+BAeECxwgQcszRS/2Dxm/WMw="

Envoy reads the .htpasswd Secret when it starts and the chart deliberately adds no password-derived checksum to the pod template, because such a checksum would expose the unsalted hash to anyone who can read pods. After changing chart-managed credentials or rotating an existingSecret, restart the gateway Deployment or change gateway.podAnnotations to trigger a rollout.

Tenant entries can additionally set lists of clientCertificateCN and jwtSubClaim aliases. Client-certificate mapping requires Envoy TLS termination with gateway.envoyConfig.tls.enabled and a Secret containing tls.crt, tls.key, and ca.crt. JWT mapping requires gateway.envoyConfig.jwt.enabled. Its defaults validate Kubernetes projected ServiceAccount tokens with issuer https://kubernetes.default.svc.<global.clusterDomain> and the Helm-templated audience {{ include "loki.name" . }}.{{ include "loki.namespace" . }}, and fetch JWKS from https://kubernetes.default.svc.<global.clusterDomain>./openid/v1/jwks, using the namespace kube-root-ca.crt ConfigMap. Envoy fetches and caches the JWKS over HTTP(S), validates the token signature, issuer, expiration, and optional audiences, and only then maps sub; JWT verification keys are not mounted from disk.

Envoy's jwt_authn filter cannot attach credentials to its JWKS requests, so the chart routes them through a loopback listener (gateway.envoyConfig.jwt.remoteJwks.credentialInjectorPort, bound to 127.0.0.1 only) whose credential injector adds Authorization: Bearer from gateway.envoyConfig.jwt.remoteJwks.bearerTokenFile. By default that file is a projected token of the gateway ServiceAccount mounted at /etc/envoy/kubernetes/token; Kubernetes grants every ServiceAccount the system:service-account-issuer-discovery ClusterRole, so the JWKS fetch needs no extra RBAC and keeps working with --anonymous-auth=false and rbac.namespaced: true. Envoy reloads the token when the kubelet rotates it. Failed JWKS requests are retried with a short backoff (gateway.envoyConfig.jwt.remoteJwks.retries) before the listener starts serving; if every retry fails, JWT requests are rejected with 401 until the next fetch succeeds about a second later. Point bearerTokenFile at another mounted file to send a different credential, or set it to null to fetch the JWKS anonymously.

The chart's loki-canary authenticates with Basic Auth by default. A loki-canary build that supports the -bearer-token-file option (see grafana/loki#24533) can authenticate through the JWT path instead. Enable its projected token and map the canary ServiceAccount subject to its tenant:

lokiCanary:
  tenant:
    bearerToken:
      enabled: true

gateway:
  type: envoy
  envoyConfig:
    jwt:
      enabled: true

loki:
  tenants:
    - name: self-monitoring
      jwtSubClaim:
        - system:serviceaccount:<namespace>:<canary-service-account-name>

When the JWKS is fetched anonymously (bearerTokenFile: null), the JWKS endpoint must be readable without credentials. Kubernetes only grants the built-in system:service-account-issuer-discovery ClusterRole to system:serviceaccounts by default, so the chart's default bearer token is the recommended way to reach the Kubernetes JWKS endpoint. The chart does not create cluster-wide RBAC for anonymous access; use an existing binding or an external issuer when disabling the bearer token.

When networkPolicy.enabled and Envoy JWT verification are enabled, the chart allows gateway egress on the JWKS URI's TCP port. Kubernetes NetworkPolicy cannot select the API server Service by name, so the rule permits any destination on that port by default. Set networkPolicy.gatewayJwks.cidrs to restrict destinations when your cluster's API server address is stable; verify CIDR matching with your network plugin because Service address translation can affect policy evaluation. Cilium-specific policies are not supported by this chart.

Clusters configured with a custom Kubernetes ServiceAccount issuer or audience must override gateway.envoyConfig.jwt.issuer, gateway.envoyConfig.jwt.audiences, gateway.envoyConfig.jwt.remoteJwks.uri, and lokiCanary.tenant.bearerToken.audience together.

gateway.configs accepts any number of extra templated configuration files. Envoy can reference them at /etc/envoy/<name> from an overridden gateway.envoyConfig.file.

Changelog

See the changelog.


StatefulSet immutability

Most StatefulSet spec fields are immutable. Storage class, PVC size, access modes, podManagementPolicy, selector, and serviceName are install-time unless the recreate job below covers the change.

Which workloads render StatefulSets

Deployment modeTypical StatefulSet components
Monolithic (singleBinary)singleBinary when singleBinary.kind=StatefulSet (the default)
Simple Scalablewrite, backend (and read only if read.kind=StatefulSet)
Distributedingester, indexGateway, compactor, ruler, plus patternIngester / bloom components when enabled and kind=StatefulSet
CachesresultsCache / chunksCache memcached StatefulSets when those caches are enabled

Values that map to immutable StatefulSet fields

Paths are per component (singleBinary.*, write.*, backend.*, ingester.*, and so on) unless noted.

ValuesRecreate job covers it?
*.persistence.storageClass, *.persistence.claims[].storageClass, zone storageClass overridesNo
*.persistence.size, *.persistence.claims[].size, cache persistence.storageSizeYes, if *.statefulSetRecreateJob.enabled (Loki components only). Also patches PVCs when defaults.statefulSetRecreateJob.patchPVC is true
*.persistence.accessModes, claims[].accessModesNo
*.persistence.selectorNo
*.persistence.volumeAttributesClassName and claims equivalentNo
*.persistence.labels, claims[].labels, claim nameCount/name/size mismatch only
*.persistence.annotations, claims[].annotationsNo
*.podManagementPolicyYes, if the recreate job is enabled
nameOverride, fullnameOverride, *.fullnameOverride, Helm release nameserviceName only
Chart-generated selector labelsNo

*.selectorLabels in values.yaml is not rendered into spec.selector.

Recreate job (experimental)

Set *.statefulSetRecreateJob.enabled=true on a Loki component. On helm upgrade, a pre-upgrade Job deletes the StatefulSet with --cascade=orphan when podManagementPolicy, serviceName, volume-claim count, claim name, or claim size differs, and optionally expands PVCs when defaults.statefulSetRecreateJob.patchPVC is true.

It does not migrate storageClass, accessModes, VCT selectors, VCT labels/annotations, or volumeAttributesClassName. Memcached cache StatefulSets do not have this Job. lookup needs a live cluster; helm template / dry-run will not emit it.

This chart emits apiVersion: v1 and kind: PersistentVolumeClaim on each VCT. Older live objects that lack those fields can fail server-side apply even when values did not change.


Upgrading

From 20.x to 21.0.0

Breaking rollout_operator.webhooks.failurePolicy now defaults to Fail instead of Ignore, matching the rollout-operator chart. Previously, when the rollout-operator was unreachable or a webhook call timed out, the API server skipped its webhooks, so ingesters could be scaled down without preparing for shutdown and remain in the ring.

Who is affected: installations with rollout_operator.enabled: true that do not set rollout_operator.webhooks.failurePolicy explicitly. While the rollout-operator is unreachable, StatefulSet updates in the release namespace (including helm upgrade and HPA/KEDA scaling) and pod evictions (for example kubectl drain) are now rejected instead of allowed.

How to proceed: no action is needed if the rollout-operator runs reliably. To keep the previous behavior, set rollout_operator.webhooks.failurePolicy: Ignore.

The new ingester.zoneAwareReplication.zone[A-C].prepareDownscale, noDownscale and downscaleLeader values are opt-in and do not change the rendered manifests by default.

From 20.0.2 to 20.0.3 (#941)

The memberlist Service, used as the seed list for memberlist.join_members, now only selects components that always run a memberlist listener. query-frontend, query-scheduler, index-gateway, the bloom components and overrides-exporter no longer carry the app.kubernetes.io/part-of: memberlist pod label. They still join the memberlist cluster through the seed nodes when their configuration needs it.

The unused indexGateway.joinMemberlist value has been removed.

If you run custom NetworkPolicies that allow port 7946 only between pods labeled app.kubernetes.io/part-of: memberlist, also allow the components that listen in some setups: query-frontend and query-scheduler with loki.query_scheduler.use_scheduler_ring, index-gateway and the bloom components with loki.index_gateway.mode: ring, and every component with loki.ui.enabled.

From 19.x to 20.0.0

Breaking The MinIO sub

Deploy loki with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has loki on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartloki is pinned at v21.6.3 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply