1 安装

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
var_base=/root/helm
var_app=$var_base/grafana
var_version=6.57.0

mkdir -p $var_app
cd $var_app

helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
helm pull grafana/grafana --version $var_version
tar xf grafana-$var_version.tgz

helm upgrade --install --dry-run --debug \
  --namespace monitoring \
  --create-namespace \
  --set ingress.enabled=true \
  --set ingress.ingressClassName=nginx \
  --set-string ingress.annotations."kubernetes\.io/tls-acme"=true \
  --set-string ingress.annotations."nginx\.ingress\.kubernetes\.io/ssl-redirect"=true \
  --set-string ingress.annotations."cert-manager\.io/cluster-issuer"='letsencrypt-prod' \
  --set ingress.hosts[0]='grafana.example.com' \
  --set ingress.path='/' \
  --set ingress.pathType='Prefix' \
  --set ingress.tls[0].secretName='grafana-example-com-tls' \
  --set ingress.tls[0].hosts[0]='grafana.example.com' \
  --set persistence.enabled=true \
  --set persistence.storageClassName=rook-cephfs \
  --set persistence.size=20Gi \
  --set resources.limits.cpu=1000m \
  --set resources.limits.memory=512Mi \
  --set resources.requests.cpu=500m \
  --set resources.requests.memory=256Mi \
  grafana ./grafana

helm upgrade --install \
  --namespace monitoring \
  --create-namespace \
  --set ingress.enabled=true \
  --set ingress.ingressClassName=nginx \
  --set-string ingress.annotations."kubernetes\.io/tls-acme"=true \
  --set-string ingress.annotations."nginx\.ingress\.kubernetes\.io/ssl-redirect"=true \
  --set-string ingress.annotations."cert-manager\.io/cluster-issuer"='letsencrypt-prod' \
  --set ingress.hosts[0]='grafana.example.com' \
  --set ingress.path='/' \
  --set ingress.pathType='Prefix' \
  --set ingress.tls[0].secretName='grafana-example-com-tls' \
  --set ingress.tls[0].hosts[0]='grafana.example.com' \
  --set persistence.enabled=true \
  --set persistence.storageClassName=rook-cephfs \
  --set persistence.size=20Gi \
  --set resources.limits.cpu=1000m \
  --set resources.limits.memory=512Mi \
  --set resources.requests.cpu=500m \
  --set resources.requests.memory=256Mi \
  grafana ./grafana

#1. Get your 'admin' user password by running:

kubectl get secret --namespace monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo

admin/password
# ingress 测试访问
curl -H 'Host:grafana.example.com' http://192.168.1.211

2 配置

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# kubernetes-nodes(node-exporter)
# 1     Node Exporter Dashboard 22/04/13 ConsulManager自动同步版
# 8919

# kube-state-metrics
# Kubernetes Cluster Overall  Dashboard
# 14518

# kubernetes-nodes-cadvisor(3125)
# Kubernetes Pod Metrics (k8s 1.16)
# 13025

3 dashboard