旧版安装
loki-stack-2.1.2 会安装有状态副本集loki和守护进程集loki-promtail
1 2 3
| helm repo add loki https://grafana.github.io/loki/charts
helm upgrade --install loki loki/loki-stack --version 2.1.2 --set grafana.enabled=true --namespace=kubesphere-loki-system
|
1 2
| helm repo add grafana https://grafana.github.io/helm-charts helm install my-grafana grafana/grafana
|
新版安装
Loki-stack-2.6.5
1 2 3
| helm upgrade --install loki grafana/loki-stack --set grafana.enabled=true
kubectl get secret --namespace <YOUR-NAMESPACE> loki-grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
|
配置
Loki的部署如果是emptyDir: {}
数据不会持久话,重启会丢失,因此尽量配置nfs目录挂载,重启就不会丢失了。
Grafana Loki 存储保留
查看路径: 平台管理--->集群--->配置中心--->密钥--->[filter]kubesphere-loki-system--->loki--->右侧眼睛(不然是加密的)
修改:在查看路径的基础上 更多操作--->编辑密钥--->loki.yaml--->编辑
Loki.yaml配置详解
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| auth_enabled: false chunk_store_config: max_look_back_period: 0s compactor: shared_store: filesystem working_directory: /data/loki/boltdb-shipper-compactor ingester: chunk_block_size: 262144 chunk_idle_period: 3m chunk_retain_period: 1m lifecycler: ring: kvstore: store: inmemory replication_factor: 1 max_transfer_retries: 0 limits_config: enforce_metric_name: false reject_old_samples: true reject_old_samples_max_age: 168h schema_config: configs: - from: "2020-10-24" index: period: 24h prefix: index_ object_store: filesystem schema: v11 store: boltdb-shipper server: http_listen_port: 3100 storage_config: boltdb_shipper: active_index_directory: /data/loki/boltdb-shipper-active cache_location: /data/loki/boltdb-shipper-cache cache_ttl: 24h shared_store: filesystem filesystem: directory: /data/loki/chunks table_manager: retention_deletes_enabled: false retention_period: 0s
|
参考
loki 自定义部署配置
常见错误
启动过报错
1
| level=error ts=2022-08-10T01:49:48.744952015Z caller=table.go:81 msg="failed to cleanup table" name=index_19214
|