loki:负责存储日志和查询搜索日志

    promtail: 负责将pods日志转入loki
    docker日志路径:/var/lib/docker/containers
    pods 日志路径:/var/log/pods

    grafana:负责界面展示

    为了方便安装使用helm安装

    1. helm repo add loki https://grafana.github.io/loki/charts && helm repo update
    2. helm pull loki/loki-stack
    3. tar xf loki-stack-2.1.2.tgz
    4. helm install loki loki-stack/
    1. apiVersion: apps/v1
    2. kind: Deployment
    3. metadata:
    4. name: grafana
    5. labels:
    6. app: grafana
    7. spec:
    8. replicas: 1
    9. selector:
    10. matchLabels:
    11. app: grafana
    12. template:
    13. metadata:
    14. labels:
    15. app: grafana
    16. spec:
    17. containers:
    18. - name: grafana
    19. image: grafana/grafana:latest
    20. volumeMounts:
    21. - name: timezone
    22. mountPath: /etc/localtime
    23. volumes:
    24. - name: timezone
    25. hostPath:
    26. path: /usr/share/zoneinfo/Asia/Shanghai
    27. ---
    28. apiVersion: v1
    29. kind: Service
    30. metadata:
    31. name: grafana-svc
    32. #namespace: test
    33. spec:
    34. ports:
    35. - port: 3000
    36. targetPort: 3000
    37. nodePort: 3303
    38. type: NodePort
    39. selector:
    40. app: grafana

    登录granfan
    image.png
    image.png