Loki #
部署 #
- Helm Chart - https://github.com/grafana/loki/tree/main/production/helm/loki
- 下载地址 https://github.com/grafana/helm-charts/releases - loki
部署模式 #
loki的helm chart的values.yaml中的deploymentMode
配置部署模式。
有 3 种选项:
- SingleBinary:Loki 作为单一二进制文件部署,适用于小型安装,通常没有高可用性,支持每天几十 GB 的数据。
- SimpleScalable(默认值):Loki 作为3个目标部署:读取(loki-read)、写入(loki-write)和后端(loki-backend)。适用于中型安装,比分布式部署更易于管理,支持每天约1TB的数据。
- Distributed:Loki作为独立的微服务部署。最复杂但功能最强,适用于大型安装,通常超过每天1TB的数据。
还有 2 种附加模式,用于在部署模式之间迁移:
- SingleBinary<->SimpleScalable:从SingleBinary迁移到 SimpleScalable(或反向迁移)
- SimpleScalable<->Distributed:从SimpleScalable迁移到 Distributed(或反向迁移)
注意:SimpleScalable 和 Distributed 要求使用对象存储。
SimpleScalable部署 #
定制的values.yaml
:
1imagePullSecrets:
2 - name: regsecret
3
4minio:
5 enabled: false
6
7lokiCanary:
8 enabled: false
9resultsCache:
10 enabled: false
11chunksCache:
12 enabled: false
13
14loki:
15 image:
16 registry: registry.frognew.com
17 repository: library/grafana/loki
18 storage:
19 bucketNames:
20 chunks: loki-chunks
21 ruler: loki-ruler
22 admin: loki-admin
23 type: s3
24 s3:
25 endpoint: http://rook-ceph-rgw-ceph-object-store.rook-ceph.svc.cluster.local:80
26 region: unknown
27 accessKeyId: <accessKeyId>
28 secretAccessKey: <secretAccessKey>
29 s3ForcePathStyle: true
30 insecure: false
31 compactor:
32 delete_request_store: s3
33 compaction_interval: 10m
34 retention_enabled: true
35 retention_delete_delay: 2h
36 retention_delete_worker_count: 150
37 limits_config:
38 max_cache_freshness_per_query: 10m
39 reject_old_samples: true
40 reject_old_samples_max_age: 1w
41 split_queries_by_interval: 15m
42 retention_period: 365d
43 tenants:
44 - name: <tenants-name>
45 password: <tenants-password>
46 analytics:
47 reporting_enabled: false
48
49 schemaConfig:
50 configs:
51 # https://grafana.com/docs/loki/latest/operations/storage/tsdb/
52 - from: 2024-05-14
53 store: tsdb
54 object_store: s3
55 schema: v13
56 index:
57 prefix: loki_index_
58 period: 24h
59 storage_config:
60 hedging:
61 at: 250ms
62 max_per_second: 20
63 up_to: 3
64
65gateway:
66 enabled: false
67
68read:
69 replicas: 3
70write:
71 replicas: 3
72 persistence:
73 size: 50Gi
74 storageClass: local-storage
75backend:
76 replicas: 3
77 persistence:
78 size: 50Gi
79 storageClass: local-storage
80
81test:
82 enabled: false
83
84ingress:
85 enabled: false
86
87monitoring:
88 dashboards:
89 enabled: false
90 rules:
91 enabled: false
92 serviceMonitor:
93 enabled: false
94 selfMonitoring:
95 enabled: false
96 grafanaAgent:
97 installOperator: false
98 lokiCanary:
99 enabled: false
100
101sidecar:
102 rules:
103 enabled: false
更多关于SimpleScalable部署的内容,可参考“Grafana Loki笔记02: 使用Helm安装Loki”
SingleBinary部署 #
values.yaml
:
1imagePullSecrets:
2 - name: regsecret
3
4minio:
5 enabled: false
6
7lokiCanary:
8 enabled: false
9resultsCache:
10 enabled: false
11chunksCache:
12 enabled: false
13
14loki:
15 image:
16 registry: registry.frognew.com
17 repository: library/grafana/loki
18 storage:
19 bucketNames:
20 chunks: loki-chunks
21 ruler: loki-ruler
22 admin: loki-admin
23 type: s3
24 s3:
25 endpoint: http://rook-ceph-rgw-ceph-object-store.rook-ceph.svc.cluster.local:80
26 region: unknown
27 accessKeyId: <accessKeyId>
28 secretAccessKey: <secretAccessKey>
29 s3ForcePathStyle: true
30 insecure: false
31 compactor:
32 delete_request_store: s3
33 compaction_interval: 10m
34 retention_enabled: true
35 retention_delete_delay: 2h
36 retention_delete_worker_count: 150
37 limits_config:
38 max_cache_freshness_per_query: 10m
39 reject_old_samples: true
40 reject_old_samples_max_age: 1w
41 split_queries_by_interval: 15m
42 retention_period: 365d
43 tenants:
44 - name: <tenant-name>
45 password: <tenant-password>
46 analytics:
47 reporting_enabled: false
48 commonConfig:
49 replication_factor: 1
50 schemaConfig:
51 configs:
52 # https://grafana.com/docs/loki/latest/operations/storage/tsdb/
53 - from: 2024-05-14
54 store: tsdb
55 object_store: s3
56 schema: v13
57 index:
58 prefix: loki_index_
59 period: 24h
60 ingester:
61 chunk_encoding: snappy
62 tracing:
63 enabled: true
64 querier:
65 # Default is 4, if you have enough memory and CPU you can increase, reduce if OOMing
66 max_concurrent: 2
67 storage_config:
68 hedging:
69 at: 250ms
70 max_per_second: 20
71 up_to: 3
72
73gateway:
74 enabled: false
75
76deploymentMode: SingleBinary
77singleBinary:
78 replicas: 1
79 resources:
80 limits:
81 cpu: 3
82 memory: 2Gi
83 requests:
84 cpu: 500m
85 memory: 500Mi
86 extraEnv:
87 # Keep a little bit lower than memory limits
88 - name: GOMEMLIMIT
89 value: 1875MiB
90
91# Zero out replica counts of other deployment modes
92backend:
93 replicas: 0
94read:
95 replicas: 0
96write:
97 replicas: 0
98
99ingester:
100 replicas: 0
101querier:
102 replicas: 0
103queryFrontend:
104 replicas: 0
105queryScheduler:
106 replicas: 0
107distributor:
108 replicas: 0
109compactor:
110 replicas: 0
111indexGateway:
112 replicas: 0
113bloomCompactor:
114 replicas: 0
115bloomGateway:
116 replicas: 0
117
118test:
119 enabled: false
120
121ingress:
122 enabled: false
123
124monitoring:
125 dashboards:
126 enabled: false
127 rules:
128 enabled: false
129 serviceMonitor:
130 enabled: false
131 selfMonitoring:
132 enabled: false
133 grafanaAgent:
134 installOperator: false
135 lokiCanary:
136 enabled: false
137
138sidecar:
139 rules:
140 enabled: false