0%

loki持久化

查看配置

# 查看helm安装Loki默认配置
[root@master ~]# helm inspect values loki/loki > loki.yaml
[root@master ~]# cat loki.yaml
# 部分配置
config:
  storage_config:
    boltdb:
      directory: /data/loki/index
    filesystem:
      directory: /data/loki/chunks
  table_manager:
    retention_deletes_enabled: false
    retention_period: 0

image:
  repository: grafana/loki
  tag: v1.2.0
  pullPolicy: IfNotPresent

## ref: https://kubernetes.io/docs/concepts/storage/persistent-volumes/
## If you set enabled as "True", you need :
## - create a pv which above 10Gi and has same namespace with loki
## - keep storageClassName same with below setting
persistence:
  enabled: false
  accessModes:
  - ReadWriteOnce
  size: 10Gi
  annotations: {}
  # subPath: ""
  # existingClaim:

配置循环删除

配置持久化

persistence:
  enabled: true
  accessModes:
  - ReadWriteOnce
  size: 100Gi
  annotations: {}
  existingClaim: loki-pvc

创建PVC

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: loki-pvc
  namespace: monitoring
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
        storage: 100Gi
  storageClassName: nfs-client
# 卸载重新安装
helm delete --purge loki
helm install loki/loki --name loki --namespace monitoring -f loki.yaml

# 升级命令
helm upgrade loki --values loki.yaml loki/loki