解决 Grafana Tempo 报错 failed to flush block to backend storage S3 写入拒绝修复
排查 Grafana Tempo Ingester 内存暴涨,日志频繁报错 failed to flush block to backend storage: AccessDenied 或 S3 endpoint error,分析 S3 凭据与存储桶权限。
问题现象
Grafana Tempo 的 Ingester Pod 内存不断攀升直至触发 OOM,错误日志记录无法刷盘:
level=error ts=2026-11-16T14:30:10Z caller=block.go:342 msg="failed to flush block to backend storage" err="AccessDenied: Access Denied"
触发根因
- Tempo Ingester 在内存中构建完微块(Block)后,尝试定期向配置的 S3 / GCS 存储桶上传 Parquet 块文件时遭遇权限拒绝(403 Access Denied);
- 提供的 IAM 角色或 AccessKey 缺少
s3:PutObject、s3:GetObject或s3:ListBucket特权; - 刷盘失败导致微块持续滞留在 Ingester 内存中引发严重内存泄露。
解决步骤
确保 IAM 策略授予完整的 S3 读写及列表权限
配置策略载荷:
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:ListBucket",
"s3:DeleteObject"
],
"Resource": [
"arn:aws:s3:::my-tempo-traces",
"arn:aws:s3:::my-tempo-traces/*"
]
}
核对 tempo.yaml 中的对象存储连接声明
确保 endpoint 与 bucket 匹配:
storage:
trace:
backend: s3
s3:
bucket: my-tempo-traces
endpoint: s3.us-east-1.amazonaws.com
insecure: false
验证确认
重启 Ingester 实例:
堆积的块秒级批量成功上传至 S3,Ingester 内存迅速释放回归基准线。


