Skip to content

Grafana/Loki - Write to S3 Bucket unsuccessful - failed to flush chunks: store put chunk: WebIdentityErr: failed to retrieve credentials caused by: SerializationError #10657

Open

Description

Hello,

I'm attempting to provision the Grafana/Loki Helm Chart upon an EKS Cluster.

Once deployed all pods are successfully running other than the three loki-write pods -

loki-write-0                                        0/1     Running   0             98m
loki-write-1                                        0/1     Running   0             98m
loki-write-2                                        0/1     Running   0             98m

When viewing the logs, the most notable error received is the one below

failed to flush chunks: store put chunk: WebIdentityErr: failed to retrieve credentials caused by: SerializationError

I've seen multiple previously created issues raised regarding the writing of Loki logs to S3 buckets and I've deployed multiple iterations of the Helm Chart values in an attempt in getting this working - to no avail.

Is there anyone who can help identify the source of my issue? See further information below -

Helm Chart Values -

values:
  serviceAccount:
    create: true
    name: loki-sa
    annotations:
      eks.amazonaws.com/role-arn: "arn:aws:iam::********:role/**********"
  loki:
    auth_enabled: false
    storage:
      type: s3
      s3:
        endpoint: https://eu-west-2.s3.amazonaws.com
        region: eu-west-2a
        s3ForcePathStyle: false
        insecure: false
      bucketNames:
        chunks: loki-logs/chunks
        ruler: loki-logs/ruler
        admin: loki-logs/admin
  schema_config:
    configs:
      - from: 2023-04-13
        store: boltdb-shipper
        object_store: s3
        schema: v12
        index:
          prefix: index_
          period: 24h
  storage_config:
    boltdb_shipper:
      shared_store: s3
      cache_ttl: 1h
    aws:
      region: eu-west-2
      bucketnames: loki-logs

IAM Role Policy

  {
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:GetObject",
                "s3:DeleteObject"
            ],
            "Resource": "arn:aws:s3:::loki-logs"
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": "s3:ListObject",
            "Resource": "arn:aws:s3:::loki-logs"
        }
    ]
}

IAM Role Trust Relationship to EKS Cluster

  {
      "Version": "2012-10-17",
      "Statement": [
          {
              "Effect": "Allow",
              "Principal": {
                  "Service": "s3.amazonaws.com"
              },
              "Action": "sts:AssumeRole"
          },
          {
              "Effect": "Allow",
              "Principal": {
                  "Federated": "arn:aws:iam::************:oidc-provider/oidc.eks.eu-west-2.amazonaws.com/id/******************************************"
              },
              "Action": "sts:AssumeRoleWithWebIdentity",
              "Condition": {
                  "StringEquals": {
                      "oidc.eks.eu-west-2.amazonaws.com/id/******************************************:aud": "sts.amazonaws.com",
                      "oidc.eks.eu-west-2.amazonaws.com/id/******************************************:sub": "system:serviceaccount:loki:loki-sa"
                  }
              }
          }
      ]
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions