「Kubernetes」- 部署 Grafana 服务

问题描述

该笔记将记录:在 Kubernetes Cluster 中,部署 Grafana 的方法,以及常见问题的解决办法。

解决方案

官方文档目前仅提供通过 YAML 进行部署的方法,而我们主要采用 HELM 进行部署。

通过 HELM 部署

# 生成 values 文件,并进行配置
helm show values grafana/grafana > grafana.helm-values.yaml

vim grafana.helm-values.yaml
...(1)调整 Ingress 配置

# 安装 Grafana 服务
helm --namespace=grafana upgrade --install grafana grafana/grafana -f grafana.helm-values.yaml

# 查看 Grafana 密码
kubectl get secret --namespace grafana loki-grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo

# Add datasource
# Basic Auth: Username:Password
# http://loki-loki-distributed-gateway.loki.svc.cluster.local/

登录 Grafana 系统

http://localhost:3000/
admin
password

参考文献

Deploy Grafana on Kubernetes | Grafana documentation
grafana/helm-charts