kubernetes部署grafana6.4

  sre

ns

apiVersion: v1
kind: Namespace
metadata:
  name: monitor

pvc

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: grafana-pvc
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: "30Gi"
  volumeName: 
  storageClassName: nfs

Deployment

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
 labels:
  name: grafana-server
 name: grafana
 namespace: monitor
spec:
  replicas: 1
  template:
   metadata:
    labels:
      app: grafana-server
   spec:
    #serviceAccountName: prometheus
    containers:
    - name: grafana
      image: grafana/grafana:latest
      ports:
        - containerPort: 3000
          protocol: TCP
      volumeMounts:
      - mountPath: "/var/lib/grafana"
        readOnly: false
        name: grafana-pvc
      #env:
      #- name: GF_INSTALL_PLUGINS
      # value: "grafana-kubernetes-app"
    imagePullSecrets:
    - name: authllzg
    volumes:
    - name: grafana-pvc
      persistentVolumeClaim:
           claimName: grafana-pvc 

nodeport

kind: Service
apiVersion: v1
metadata:
  name: grafana-ingress-service
  namespace: monitor
spec:
  selector:
    app: grafana-server
  type: NodePort
  ports:
    - protocol: TCP
      port: 3000
      nodePort: 30033
      name: grafana

系统默认用户名和密码为admin/admin,第一次登陆系统会要求修改密码

LEAVE A COMMENT

Captcha Code