Centos7 部署Grafana(Kubernetes)

Posted 张志翔 ̮

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7 部署Grafana(Kubernetes)相关的知识,希望对你有一定的参考价值。

        最近项目中通过Kubernetes部署Grafana完成可视化大屏展示,特此记录便于日后查阅。

一、Grafana部署

        1、grafana.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: grafana-dep
  namespace: monitoring
spec:
  replicas: 1
  selector:
    matchLabels:
      app: grafana-dep
  template:
    metadata:
      labels:
        app: grafana-dep
    spec:
      containers:
      - name: grafana
        image: grafana/grafana
        imagePullPolicy: Always
        #command:
        #  - "tail"
        #  - "-f"
        #  - "/dev/null"
        securityContext:
          allowPrivilegeEscalation: false
          runAsUser: 0
        ports:
        - containerPort: 3000
          protocol: TCP
        volumeMounts:
        - mountPath: "/var/lib/grafana"
          name: data
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
          limits:
            cpu: 500m
            memory: 2500Mi
        env:
        - name: GF_DATABASE_TYPE   
          value: "postgres"
        - name: GF_DATABASE_HOST   
          value: "10.0.61.12:8832"
        - name: GF_DATABASE_NAME
          value: "grafana"
        - name: GF_DATABASE_USER
          value: "postgres"
        - name: GF_DATABASE_PASSWORD   
          value: "xxx"
      volumes:
      - name: data
        emptyDir: 
---
apiVersion: v1
kind: Service
metadata:
  name: grafana
  namespace: monitoring
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 3000
    nodePort: 30006
  selector:
    app: grafana-dep

        到此Centos7 部署Grafana(Kubernetes)介绍完成。

以上是关于Centos7 部署Grafana(Kubernetes)的主要内容,如果未能解决你的问题,请参考以下文章

Eg挨蒙—阿里云Centos7部署Lnmp+Zabbix+Grafana监控系统

Centos7 docker部署监控Prometheus+Grafana

centos7下部署 Prometheus+Grafana超炫监控

CentOS7+Prometheus2.5+Grafana5.4监控部署实验问题解决

Grafana + Influxdb Android性能监控部署

kubernetes1.15极速部署prometheus和grafana