- Promtail 用来将容器日志发送到 Loki 服务上的日志收集工具
- Prometheus 日志聚合系统
- Grafana 仪表盘
helm repo add grafana https://grafana.github.io/helm-charts
1. 添加Helm仓库
首先,添加Loki 的 Chart 仓库,以便能够使用他们的Helm Chart。
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
2. 部署Loki 和Grafana
helm install loki-stack-logging grafana/loki-stack
这里loki-stack-logging
是你给这个release起的名字,你可以根据需要修改它。
3. 检查部署状态
部署完成后,通过以下命令检查Pods的状态,确保所有的组件都已正确部署:
kubectl get pods -l "release=loki-stack-logging"
4. 访问Grafana
部署完成后,你可以通过以下步骤访问Grafana:
- 首先,获取Grafana的admin密码:
kubectl get secret --namespace default my-kube-prometheus-stack-grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
- 然后,通过端口转发访问Grafana的Web界面:
kubectl port-forward svc/my-kube-prometheus-stack-grafana 3000:80
- 在浏览器中访问
http://localhost:3000
,使用上面获取的密码登录Grafana。