Installation

Run a Metrics database on Kubernetes: pick a deployment mode, declare it as a custom resource, and give each tenant namespace credentials.

This guide assumes the operator is already installed; see Installation. Examples use the telemetry Kubernetes namespace and an S3 bucket named acme-telemetry.

Choose a mode

ModePodsStorageUse it for
StandaloneOne pod that ingests and queriesA volume, or a bucketDevelopment and small clusters
Reader/writer splitOne writer, autoscaled readersA shared bucketHeavy query load on modest ingest
ShardedSeveral writers, a reader group per shardA shared bucketIngest beyond one writer

The split and sharded modes are the same Sharded resource with one writer or several, so a split deployment grows into a sharded one by raising spec.writer.replicas.

Grant S3 access

Skip this for a standalone database on a volume. Otherwise Metrics authenticates to S3 with EKS Pod Identity. The operator creates a ServiceAccount named after the database, metrics, so associate an IAM role with it:

bash
aws eks create-pod-identity-association \
  --cluster-name prod \
  --namespace telemetry \
  --service-account metrics \
  --role-arn arn:aws:iam::123456789012:role/plural-telemetry-metrics
plural-telemetry-metrics policy
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "s3:ListBucket",
      "Resource": "arn:aws:s3:::acme-telemetry"
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:PutObject",
        "s3:DeleteObject"
      ],
      "Resource": "arn:aws:s3:::acme-telemetry/metrics/*"
    }
  ]
}

The role's trust policy must allow pods.eks.amazonaws.com to call sts:AssumeRole and sts:TagSession. No keys go in the spec.

Access

Metrics serves a tenant namespace only once it has credentials. Each NamespaceAuthentication creates its namespace if needed and grants one username read or write. Create the password Secrets first:

bash
kubectl -n telemetry create secret generic metrics-payments-writer \
  --from-literal=password="$(openssl rand -hex 24)"
kubectl -n telemetry create secret generic metrics-payments-reader \
  --from-literal=password="$(openssl rand -hex 24)"

Then grant a writer for the collector and a reader for Grafana:

namespace-auth.yaml
1apiVersion: telemetry.plural.sh/v1alpha12kind: NamespaceAuthentication3metadata:4  name: metrics-payments-writer5  namespace: telemetry6spec:71  dataStoreRef: { kind: Metrics, name: metrics }82  namespace: payments93  username: otel-collector104  permission: write115  secretKeyRef: { name: metrics-payments-writer, key: password }12---13apiVersion: telemetry.plural.sh/v1alpha114kind: NamespaceAuthentication15metadata:16  name: metrics-payments-reader17  namespace: telemetry18spec:19  dataStoreRef: { kind: Metrics, name: metrics }20  namespace: payments21  username: grafana22  permission: read23  secretKeyRef: { name: metrics-payments-reader, key: password }
  1. 1dataStoreRef
    The database this credential is for. One NamespaceAuthentication grants access to exactly one database.
  2. 2namespace
    Tenant namespace. It is created on first use; every route is prefixed with /ns/{namespace}.
  3. 3username
    HTTP basic-auth username. Unique per namespace.
  4. 4permission
    write for ingest routes, read for queries.
  5. 5secretKeyRef
    Secret holding the password, in the same Kubernetes namespace. Rotating it rolls the database's config.

Clients send these as HTTP basic auth.

Connect your tools

Writers serve ingest routes and readers serve queries. In the split and sharded modes, inside the cluster:

ToolURL
Grafana Prometheus data sourcehttp://metrics-reader.telemetry:8080/read/ns/payments
Prometheus / Alloy remote_writehttp://metrics-writer.telemetry:8080/write/ns/payments/api/v1/write
OTel Collector otlphttp
The exporter appends /v1/metrics.
http://metrics-writer.telemetry:8080/write/ns/payments

A standalone database serves both from the one metrics Service. Any writer accepts any sample and forwards it to the shard's owner, so the plain metrics-writer Service is all a client needs. For an OTel Collector and Grafana:

otel-collector.yaml
extensions:
  basicauth/plural:
    client_auth:
      username: otel-collector
      password: ${env:PLURAL_METRICS_PASSWORD}

exporters:
  otlphttp/plural-metrics:
    endpoint: http://metrics-writer.telemetry:8080/write/ns/payments
    auth:
      authenticator: basicauth/plural

service:
  extensions: [basicauth/plural]
  pipelines:
    metrics:
      exporters: [otlphttp/plural-metrics]
grafana-datasource.yaml
apiVersion: 1
datasources:
  - name: Plural Metrics
    type: prometheus
    url: http://metrics-reader.telemetry:8080/read/ns/payments
    basicAuth: true
    basicAuthUser: grafana
    secureJsonData:
      basicAuthPassword: $PLURAL_METRICS_READ_PASSWORD

For Prometheus or Alloy, add a remote_write entry with the writer URL above and the same basic_auth credentials.