S3配置
- 创建 loki-s3 存储桶
- 创建一个IAM用户组 loki-s3 并授予指定S3桶的权限
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "LokiStorage",
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject"
],
"Resource": [
"arn:aws:s3:::loki-s3",
"arn:aws:s3:::loki-s3/*"
]
}
]
}
- 创建一个IAM用户 loki-s3 加入 loki-s3 用户组,并创建访问密钥。
分组件部署loki日志系统
loki部署
- 注意官方文档给的示例并不能直接运行,可能文档没有更新,先使用示例values文件部署,查看报错信息。
- 提示需要配置schemaConfig,在artifacthub.io/packages/he…
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
chunksCache:
allocatedMemory: 2048
loki:
auth_enabled: false
storage:
bucketNames:
chunks: loki-s3
ruler: loki-s3
admin: loki-s3
type: s3
s3:
endpoint: s3.ap-northeast-1.amazonaws.com
region: ap-northeast-1
secretAccessKey: xxxxxxxxx
accessKeyId: xxxxxxxxx
s3ForcePathStyle: true
insecure: false
storage_config:
tsdb_shipper:
index_gateway_client:
server_address: '{{ include "loki.indexGatewayAddress" . }}'
schemaConfig:
configs:
- from: 2024-04-01
store: tsdb
object_store: s3
schema: v13
index:
prefix: index_
period: 24h
write:
replicas: 2
read:
replicas: 2
backend:
replicas: 2
helm upgrade --install -f values.yaml loki grafana/loki --namespace loki --create-namespace
helm uninstall loki -n loki
promtail 部署(用helm部署)
config:
clients:
- url: http://loki-gateway.loki/loki/api/v1/push
tenant_id: 1
helm upgrade --values promtail-values.yaml --install promtail grafana/promtail --namespace loki
helm uninstall promtail -n loki