运维开发网

Grafana 之 介绍及安装

运维开发网 https://www.qedev.com 2021-04-07 14:29 出处:51CTO 作者:wx592bc92b285c7
一、Grafana介绍可视化面板,功能齐全的度量仪表盘和图形编辑器,支持Graphite、zabbix、InfluxDB、Prometheus、OpenTSDB、Elasticsearch等作为数据源,比Prometheus自带的图表展示功能强大太多,更加灵活,有丰富的插件,功能更加强大。二、Grafana安装使用最新版本的镜像https://github.com/grafana/grafana通

一、Grafana介绍

可视化面板,功能齐全的度量仪表盘和图形编辑器,支持 Graphite、zabbix、InfluxDB、Prometheus、OpenTSDB、Elasticsearch 等作为数据源,比 Prometheus 自带的图表展示功能强大太多,更加灵活,有丰富的插件,功能更加强大。

二、Grafana安装

  • 使用最新版本的镜像 https://github.com/grafana/grafana
  • 通过环境变量设置管理员账户密码
  • GFSECURITYADMIN_USER
  • GFSECURITYADMIN_PASSWORD
  • 通过设置securityContext的方式让grafana进程使用root启动 #用于解决init container权限
  • 数据挂载到本地
  • 配置ingress暴露访问入口
apiVersion: apps/v1
kind: Deployment
metadata:
  name: grafana
  namespace: monitor
spec:
  selector:
    matchLabels:
      app: grafana
  template:
    metadata:
      labels:
        app: grafana
    spec:
      volumes:
      - name: storage
        hostPath:
          path: /data/grafana/        #存放grafana数据盘
      nodeSelector:
        app: prometheus
      securityContext:         #解决容器读取文件夹权限
        runAsUser: 0
      containers:
      - name: grafana
        image: grafana/grafana:7.1.1
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 3000
          name: grafana
        env:
        - name: GF_SECURITY_ADMIN_USER
          value: admin     #帐号
        - name: GF_SECURITY_ADMIN_PASSWORD
          value: admin     #密码
        readinessProbe:
          failureThreshold: 10
          httpGet:
            path: /api/health
            port: 3000
            scheme: HTTP
          initialDelaySeconds: 60
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 30
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /api/health
            port: 3000
            scheme: HTTP
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        resources:
          limits:
            cpu: 150m
            memory: 512Mi
          requests:
            cpu: 150m
            memory: 512Mi
        volumeMounts:
        - mountPath: /var/lib/grafana
          name: storage
---
apiVersion: v1
kind: Service
metadata:
  name: grafana
  namespace: monitor
spec:
  type: ClusterIP
  ports:
    - port: 3000
  selector:
    app: grafana

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: grafana
  namespace: monitor
spec:
  rules:
  - host: grafana.cedarhd.com
    http:
      paths:
      - path: /
        backend:
          serviceName: grafana
          servicePort: 3000

Grafana  之  介绍及安装

Grafana  之  介绍及安装

Grafana  之  介绍及安装

0

精彩评论

暂无评论...
验证码 换一张
取 消