apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    name: grafana-server
  name: grafana
  namespace: test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: grafana-server
  template:
    metadata:
      labels:
        app: grafana-server
    spec:
      containers:
        - env:
            - name: GF_AUTH_BASIC_ENABLED
              value: 'true'
            - name: GF_AUTH_ANONYMOUS_ENABLED
              value: 'false'
            - name: GF_INSTALL_PLUGINS
              value: grafana-piechart-panel
            - name: TZ
              value: Asia/Shanghai
          image: 'grafana/grafana:8.1.1'
          imagePullPolicy: IfNotPresent
          name: grafana
          ports:
            - containerPort: 3000
              protocol: TCP
          resources:
            limits:
              cpu: 250m
              memory: 512Mi
            requests:
              cpu: 100m
              memory: 128Mi
          volumeMounts:
            - mountPath: /var/lib/grafana
              name: grafana-pvc
            - mountPath: /usr/share/grafana/conf/defaults.ini
              name: grafana-config
              subPath: defaults.ini
      securityContext:
        fsGroup: 472
        runAsGroup: 472
        runAsUser: 472
      volumes:
        - name: grafana-pvc
          persistentVolumeClaim:
            claimName: grafana-pvc
        - configMap:
            defaultMode: 420
            name: grafana-config
          name: grafana-config

---
apiVersion: v1
kind: Service
metadata:
  labels:
    name: grafana
  name: grafana
  namespace: test
spec:
  ports:
    - name: grafana
      port: 3000
      protocol: TCP
      targetPort: 3000
  selector:
    app: grafana-server




发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code