Deploying Loki on GKE with Cloud Storage for infrastructure you control
This section covers running Loki in microservices mode on Google Kubernetes Engine (GKE), storing chunks and index data in Google Cloud Storage (GCS), and granting access through Workload Identity Federation, following the Loki GCP guide. It is written for a platform team that needs centralized logs and wants the data to stay in its own Google Cloud project, under its own IAM policies and retention rules. Microservices mode splits the write path, read path and backend components into separate workloads that scale independently, which is why Grafana points very large clusters to it. The trade-off is operational weight: more deployments, more ring membership to watch and more Helm values to keep consistent.
Choose this path when you expect sustained daily volume that a single process cannot absorb, when you need separate scaling for ingestion and querying, or when your platform team already runs GKE and wants Loki to follow the same release, identity and monitoring practices. Loki documents three deployment modes. The monolithic mode, a single binary, is documented for up to about 20 GB of logs per day, and it is the simpler starting point for smaller estimates. The simple scalable mode splits read, write and backend targets, but the Loki documentation states it is being deprecated and will be removed with the Loki 4.0 release, so it is a poor base for a new platform. Confirm your expected volume and query load before you choose, because the sizing topic covers how to turn those numbers into replica counts.
How Loki components, GCS and the gateway fit together on GKE
The diagram starts with Grafana Alloy running in the cluster and sending logs to the authenticating gateway, which sits at the trust boundary of the cluster edge. Requests then pass through the distributor to the ingesters, which flush chunks and index data to Google Cloud Storage. Queriers and the query frontend read from the same bucket, and the compactor applies retention. Each GCS access goes through Workload Identity Federation, so no static key is needed. Check that only the gateway is reachable from outside the cluster and that every component's service account has bucket permissions scoped to its role.
Log flow from Alloy through the gateway into Loki components and GCS.
Which Loki storage and deployment options fit this GKE setup
This table compares the storage, index, deployment mode and access choices you face when running Loki on GKE. Read each row against your expected daily log volume, your production requirements and the team that will operate the cluster. The main takeaway is that Google Cloud Storage with TSDB, microservices mode and Workload Identity Federation is the path the supplied guidance points to, with the alternatives needing more justification.
| Decision | Option | Trade-off | When it fits |
|---|---|---|---|
| Object storage | Google Cloud Storage | Recommended production object store in Loki's documentation; access depends on IAM set up for the bucket and the workload. | Production clusters on GKE where logs should stay in your Google Cloud project. |
| Object storage | S3-compatible store (such as MinIO) | Supported, but the docs say it is not typically recommended for production, so you own its durability and operations. | Hybrid or on-premises setups where Google Cloud Storage is not an option, after a documented review. |
| Object storage | Local filesystem | Supported, but not typically recommended for production; no shared durability across nodes. | Proof of concept or a short evaluation, not a production cluster. |
| Index store | TSDB | Recommended index store for Loki 2.8 and newer; older stores are deprecated, so new builds should start here. | Any new GKE deployment. Confirm the version you install supports it before you write the schema config. |
| Index store | DynamoDB, Bigtable or Cassandra | Deprecated index stores; migrating away later adds upgrade work. | Generally not a fit for a new GKE deployment. |
| Deployment mode | Microservices mode | Separate components scale and fail independently, but add more Helm values and more pods to monitor. | Large clusters on GKE that need independent scaling of ingest, query and storage components. |
| Deployment mode | Simple scalable mode | Separate read, write and backend targets, but the docs state it is being deprecated and will be removed with Loki 4.0. | Existing installs with a planned migration. Avoid it for a new build. |
| Deployment mode | Monolithic mode | Single binary, simplest to run, but the docs place it at up to about 20 GB of logs per day. | Small volumes or evaluation. Growth beyond that range points toward microservices. |
| Access to GCS | Workload Identity Federation | Recommended method in the Loki GCP guide; pods receive short-lived access without a key file to store and rotate. | Default choice on GKE. Requires cluster and IAM configuration before the first deploy. |
| Access to GCS | Static service account keys | Key files must be stored, distributed and rotated by your team, and a leaked key grants access until revoked. | Only when Workload Identity Federation cannot be used and you accept the key management burden. |
Setup sequence for Loki on GKE with GCS and Workload Identity
This sequence takes a GKE cluster from empty to a microservices-mode Loki deployment that writes chunks and index to Google Cloud Storage, sits behind an authenticating gateway, enforces retention and accepts tenant-scoped writes. Each step ends with a check you can run before moving on.
Create the GKE cluster and node pools
Your platform team creates a GKE cluster in a project you control, with Workload Identity enabled at the cluster level and separate node pools for Loki's stateful and stateless components where your sizing calls for it. Confirm the cluster's Workload Identity pool is set before you deploy anything, because the bucket and IAM steps depend on it. Check that
kubectl get nodesshows every node Ready and that the node pool machine types match the sizing you agreed for ingesters, queriers and the compactor. Confirm the exact cluster version and node image against current GKE release notes, since the Loki chart and your cluster version must be compatible.Create GCS buckets for chunks and ruler data
Create separate Cloud Storage buckets for log chunks and for ruler data in the same region as the cluster, with uniform bucket-level access enabled and public access prevention turned on. Keeping chunks and ruler data apart makes lifecycle, IAM and deletion decisions easier to audit later. Set the bucket location and storage class according to your data residency and cost review, and record the bucket names for the Helm values. Check with
gcloud storage buckets listthat both buckets exist, are in the intended location and show public access prevention as enforced.Grant the Workload Identity principal object access
Bind the Kubernetes service accounts used by the Loki components to a Google Cloud identity through Workload Identity Federation, the method Grafana's GCP guide recommends, and grant that identity object read and write access on the two buckets only. Avoid project-wide storage roles and do not download long-lived service account keys. Check the binding by running a short-lived test pod under the Loki service account and listing each bucket, then confirm that a listing against an unrelated bucket is denied. Confirm the exact principal format and role names against the current GCP guide before applying them.
Configure Helm values for microservices mode
Write the Loki Helm values for microservices mode, setting the GCS object store for chunks and ruler, the TSDB index store, and the schema configuration that Loki requires for TSDB. Point each component's replica count and resources at the sizing you derived for your daily volume, and set the service account annotations that link to the Workload Identity binding. Render the chart locally with
helm templateand inspect the output to confirm the bucket names, the TSDB schema and the service account annotations appear where you expect. Keep these values in version control so later upgrades can be reviewed as diffs.Deploy the gateway with authentication
Enable multi-tenancy by setting auth_enabled to true, then deploy the gateway in front of the distributors and query frontend. Loki has no built-in authentication layer, so the gateway must authenticate each request and pass the tenant through the X-Scope-OrgID header. Choose the gateway and authentication method your organization already operates, such as nginx with basic auth, OAuth2 Proxy or Pomerium, and confirm that only the gateway service is exposed through your ingress. Check that an unauthenticated request to the push endpoint is rejected and that an authenticated request reaches Loki.
Set retention with the compactor
Retention is disabled by default, so logs are kept indefinitely until you enable it. Set retention_enabled to true in the compactor configuration, then define the retention period globally, per tenant or per stream selector, keeping in mind that each stream rule must be at least 24 hours. Confirm the compactor pod is running with object storage access and that its logs show retention being evaluated. Record the agreed retention periods alongside the tenant list, because these settings decide how long data remains in your buckets.
Verify ingestion, tenant headers and bucket contents
Send a test log line through the gateway with a tenant header, then query it back in Grafana or with LogQL using the same tenant. Repeat the query with a different tenant ID and confirm it returns no lines from the first tenant. List the chunks and index objects in the GCS buckets to confirm that data is being written under the expected prefixes. Finish by checking that queries without the authentication header fail. Save these results as your acceptance record, since they show that ingestion, tenant isolation and storage work together.
How retention and tenant IDs shape the Helm values
Retention in Loki is off until you turn it on. The compactor applies retention, and it is disabled by default, which means logs are kept indefinitely unless retention_enabled is set. For a GKE deployment, that setting belongs in the Helm values on purpose, not left to the chart defaults. Decide the retention period before the first production write, because the setting controls how much Cloud Storage the bucket will hold over time and who is responsible for deleting data when it expires. Confirm the value you chose against your own data classification and legal hold requirements before you enable it.
Loki's retention can be set globally, per tenant, or per stream selector. Each stream rule must cover at least 24 hours, so a short retention for a noisy stream has a floor you cannot go below. Map these rules to your tenant layout early. If one team needs a longer period than the global default, that requirement becomes a per-tenant override, and the compactor applies it at the tenant level. Ask the platform team to list every stream that needs a different period, since each one adds a rule that someone must maintain.
Tenancy in Loki depends on auth_enabled. When it is true, Loki treats every request as belonging to a tenant and reads the tenant identifier from the X-Scope-OrgID header. Your gateway must therefore set or pass this header correctly, because a request without it is rejected, and the tenant ID is also the key for per-tenant limits and retention. Agree on tenant naming and the gateway header mapping with the teams that will query the cluster, and verify with a test push and query for each tenant before you rely on the separation in the GKE setup.
Security controls to plan before the cluster goes live
Loki on GKE holds logs that often contain credentials, personal data and internal hostnames, and the cluster that stores them has several weak defaults to close. The cards below cover the controls to decide before go-live, because the Helm chart and GCP setup do not make these choices for you.
Authenticating gateway in front of Loki
Loki has no built-in authentication layer, so the documentation requires an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium in front of it. Every push and query path must pass through that proxy, and the X-Scope-OrgID header that selects a tenant must be set by the gateway from the verified identity, not trusted from the client. Confirm that the internal service endpoints are not exposed through a load balancer or ingress you did not intend.
Loki authentication docsLeast-privilege GCS and IAM roles
The Loki service account needs read and write access to its chunk and ruler buckets, and nothing wider. Grant object-level roles on the specific buckets rather than project-wide storage roles, and keep the deletion path separate if compactor retention will remove objects. Review who can administer the buckets and the Google service account, because those permissions can read every stored log.
Workload Identity Federation instead of key files
The Loki guide recommends Workload Identity Federation for granting pods access to Cloud Storage. With it, Kubernetes service accounts are bound to IAM identities and no long-lived JSON key is created, stored in a Secret or copied to a node. Confirm that no key file exists in the project, that the binding names the exact namespace and Kubernetes service account, and that key creation is restricted by organization policy.
Encryption at rest for Kubernetes Secrets
Kubernetes stores Secrets unencrypted in etcd by default, so any gateway credentials, bearer tokens or tenant passwords kept as Secrets are readable by anyone with access to etcd backups. Configure encryption at rest for Secrets, or keep sensitive values in an external store reached through the Secrets Store CSI Driver. Restrict list and watch access on Secrets with least-privilege RBAC, because listing Secrets exposes their values to many tools that only needed names.
Secrets good practicesPod Security Standards for the Loki namespace
Loki components run as ordinary workloads, so the namespace they share should enforce a Pod Security Standard level that matches the chart's security context. Pick the enforcement mode deliberately, test the chart against it in a non-production cluster first, and record any exemptions. Alloy, which collects node logs, usually needs host-level access, so confirm which collector pods are exempt and keep those exemptions out of the Loki namespace.
Pod Security StandardsCIS Kubernetes Benchmark as a review reference
Use the CIS Kubernetes Benchmark as the checklist for reviewing the GKE cluster and node configuration before go-live. Map each applicable recommendation to a documented decision, such as who may reach the control plane, how nodes are upgraded and which logging is enabled. Record the benchmark version used and the items you accepted as exceptions, so an internal or external reviewer can trace what was checked.
CIS Kubernetes BenchmarkKeeping the GKE Loki cluster current after go-live
Plan the Kubernetes upgrade cadence before go-live, because the GKE control plane, node pools and Loki pods all depend on a supported Kubernetes minor version. The Kubernetes project releases approximately three times per year on a cycle of about 14 weeks, and it maintains only the three most recent minor releases. Check the current support dates on Kubernetes releases and record the end-of-life date for your cluster's version in your operations calendar. Under the version skew policy, upgrade the control plane one minor version at a time and upgrade nodes afterward, since kubelets may be up to three minor versions older than kube-apiserver. Confirm with Google how GKE's release channels and maintenance windows map to these upstream dates, and test each step in a non-production cluster that uses the same Loki chart values.
Watch Loki's health after every cluster change, not only after Loki upgrades. Track distributor and ingester error rates, query frontend latency, and compactor runs, and confirm that the GCS bucket write and read paths still succeed after node pool replacements. Verify that the Workload Identity Federation binding still maps the Loki Kubernetes service accounts to the bucket IAM roles you granted at setup, because a cluster upgrade or namespace change can silently break that link. Keep the retention settings and the compactor in view during these checks, since a stalled compactor means retention is not being enforced.
Back up the cluster state that GKE does not restore for you. On GKE, Google manages the etcd datastore for the control plane, so your own backup effort should focus on the objects that define your deployment: Helm values, manifests, Secrets references, and the GCS bucket configuration. Kubernetes stores Secrets unencrypted in etcd by default, so confirm that application-layer encryption with a Cloud KMS key is enabled and that backups of those objects are protected the same way. Use a tool such as Velero or your GitOps repository to record desired state, and rehearse a restore into an empty namespace. Loki major version upgrades add schema and configuration steps covered in the Loki upgrade guidance, so treat them as a separate change with their own rollback plan.
Questions teams ask before deploying Loki on GKE
What drives the cost and effort of deploying Loki on GKE?
The largest drivers are the daily log volume, how many teams and tenants share the cluster, how long logs must be kept, and how much of the surrounding platform already exists. Each component adds effort: the GKE cluster and node pools, the GCS buckets, the Workload Identity Federation bindings, the Helm values for microservices mode, the authenticating gateway in front of Loki, and the log shippers. Cost splits into one-time work (design, build, testing and handover) and recurring cloud spend (compute, GCS storage, network egress and the operations time to run it). Ask any provider for a quote that lists each component, the environments covered, and what is included after go-live. Your own GCP billing data will show the recurring cost once you have a volume estimate.
How long does a Loki on GKE deployment take, and what sets the timeline?
The timeline depends on scope rather than on a fixed number of days. The main variables are how many environments need Loki, whether GKE and project structure already exist, how quickly IAM and networking approvals move in your organization, how many log sources must be onboarded, and how much retention and access design must be agreed before build. Teams that have not yet settled tenant IDs, retention periods and the authentication model usually spend the most time on decisions rather than on configuration. A fixed-scope engagement sets out the phases, deliverables and dates in writing before work starts, so ask for that plan to see the timeline for your environment.
What does the work need from our team?
Your team provides access and decisions. Expect to supply a GCP project with billing enabled, people who can approve IAM bindings and bucket creation, a GKE cluster or permission to create one, and a named owner for the gateway's identity provider integration. You also need to set the retention periods and tenant model, since Loki retention is disabled by default and logs are kept indefinitely until retention is turned on. Security and compliance staff should review the bucket access, the gateway authentication and the audit logging design. Ask any partner to list these inputs in the statement of work so the dependencies are visible before the build starts.
Can our internal platform team deploy Loki on GKE without outside help?
Yes, if your team already runs Kubernetes on GKE, manages Helm releases and has GCP IAM experience. Loki's GCP guide deploys microservices mode on GKE with Google Cloud Storage and recommends Workload Identity Federation for access, so the core steps are documented. The harder parts are usually production concerns: sizing the components for your daily volume, locking down the gateway because Loki has no built-in authentication layer, setting retention correctly, and building monitoring for ingestion and storage errors. Map your skills against those areas. If a gap exists, an outside partner can cover only that part, which keeps your team in control of the platform.
Which parts of a Loki deployment are one-time setup and which recur after go-live?
Bucket creation, IAM and Workload Identity Federation bindings, the initial Helm values, gateway configuration and the first retention policy are one-time setup. Recurring work includes the cloud bill for compute, GCS storage and egress, upgrades to new Loki and chart versions, Kubernetes upgrades on GKE, tenant onboarding, log source changes, retention reviews and access reviews. Loki releases move quickly, so plan a recurring upgrade window and test it in a non-production environment first. Ask for the recurring items in any quote as a separate line so you can budget for them after launch.
Does DeployOpen issue audit reports for our Loki deployment?
No. DeployOpen prepares systems, controls and evidence for compliance assessments, such as documented retention settings, access configuration and audit logging design, but it does not issue audit reports, attestations or certifications. Independent auditors and certification bodies perform those assessments. For a Loki deployment this means DeployOpen can help you set up and document the controls your auditor will test, and your auditor decides whether they meet the requirements.
Does Loki need an authentication layer on GKE, and who builds it?
Yes. Loki has no built-in authentication layer, and its documentation says to run an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium in front of it. Multi-tenancy depends on the X-Scope-OrgID header, so the gateway must enforce which identities can set or read each tenant ID. Your team or a partner builds this layer on GKE, usually as a separate deployment with its own identity provider integration. Confirm with your security team which identity provider and session policy apply before selecting the gateway.
How DeployOpen scopes and delivers a Loki on GKE deployment
DeployOpen plans, builds, documents and supports self-hosted Loki inside your own Google Cloud projects and GKE clusters. Each engagement starts from a written scope covering the bucket layout, identity model, gateway authentication and retention rules, so your security and platform teams can review every decision before anything is deployed.
How we scope
- Agree in writing which GCP projects, GKE clusters and GCS buckets the engagement covers before work starts.
- Document the Workload Identity Federation mapping, IAM roles and bucket access model your security team needs to review.
- Define the authenticating proxy, tenant model and retention periods for each tenant or stream selector in scope.
How we build
- Deploy Loki in microservices mode with the Helm chart, using values files kept in your version control system.
- Configure the gateway authentication layer and test that requests without a valid identity or X-Scope-OrgID header are rejected.
- Enable the compactor retention settings and verify that deletion runs as the agreed policy describes.
How we hand over
- Deliver the Helm values, IAM and bucket configuration, and the gateway setup as versioned, documented artifacts.
- Provide a test record covering authentication, tenant isolation, retention behavior and Grafana access checks.
- Walk your platform and compliance teams through the runbook for upgrades, retention changes and access reviews.
How we support
- Offer ongoing support, Loki version upgrades and continuous testing as retainers after the initial handover.
- Review configuration changes against the agreed scope when your Loki version or GKE version moves forward.
- Confirm your GKE, Kubernetes and Loki version support windows with the vendors before scheduling upgrades.

