一、使用Grafana实现监控指标可视化
1.用helm安装grafana
helm pull bitnami/grafana --untar
修改values.yaml
vi grafana/values.yaml ##定义storageClass
storageClass: "nfs-client" #两个
[root@aminglinux01 grafana]# cat values.yaml | grep storageClass:
storageClass: "nfs-client"
storageClass: "nfs-client"
[root@aminglinux01 grafana]#
安装
cd grafana
helm install grafana .
[root@aminglinux01 grafana]# helm install grafana .
NAME: grafana
LAST DEPLOYED: Tue Aug 6 03:33:06 2024
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: grafana
CHART VERSION: 11.3.13
APP VERSION: 11.1.3
** Please be patient while the chart is being deployed **
1. Get the application URL by running these commands:
echo "Browse to http://127.0.0.1:8080"
kubectl port-forward svc/grafana 8080:3000 &
2. Get the admin credentials:
echo "User: admin"
echo "Password: $(kubectl get secret grafana-admin --namespace default -o jsonpath="{.data.GF_SECURITY_ADMIN_PASSWORD}" | base64 -d)"
# Note: Do not include grafana.validateValues.database here. See https://github.com/bitnami/charts/issues/20629
WARNING: There are "resources" sections in the chart not set. Using "resourcesPreset" is not recommended for production. For production installations, please set the following values according to your workload needs:
- grafana.resources
+info https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
⚠ SECURITY WARNING: Original containers have been substituted. This Helm chart was designed, tested, and validated on multiple platforms using a specific set of Bitnami and Tanzu Application Catalog containers. Substituting other containers is likely to cause degraded security and performance, broken chart features, and missing environment variables.
Substituted images detected:
- registry.cn-hangzhou.aliyuncs.com/*/grafana:11.1.3-debian-12-r0
- registry.cn-hangzhou.aliyuncs.com/*/os-shell:12-debian-12-r27
显示:
1. Get the application URL by running these commands:
echo "Browse to http://127.0.0.1:8080"
kubectl port-forward svc/grafana 8080:3000 &2. Get the admin credentials:
echo "User: admin"
echo "Password: $(kubectl get secret grafana-admin --namespace default -o jsonpath="{.data.GF_SECURITY_ADMIN_PASSWORD}" | base64 -d)"
做端口映射
[root@aminglinux01 grafana]# kubectl get pod -owide| grep grafana
grafana-57bb68b4b5-4rwhj 1/1 Running 0 11m 10.18.206.201 aminglinux02 <none> <none>
[root@aminglinux01 grafana]# kubectl get svc | grep grafana
grafana ClusterIP 10.15.242.254 <none&g