温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

prometheus09-k8s部署grafana

发布时间:2020-06-29 11:28:29 来源:网络 阅读:312 作者:小小三郎1 栏目:系统运维

1.部署grafana 

apiVersion: apps/v1 
kind: StatefulSet 
metadata:
  name: grafana
  namespace: kube-system
spec:
  serviceName: "grafana"
  replicas: 1
  selector:
    matchLabels:
      app: grafana
  template:
    metadata:
      labels:
        app: grafana
    spec:
      containers:
      - name: grafana
        image: grafana/grafana
        ports:
          - containerPort: 3000
            protocol: TCP
        resources:
          limits:
            cpu: 100m            
            memory: 256Mi          
          requests:
            cpu: 100m            
            memory: 256Mi
        volumeMounts:
          - name: grafana-data
            mountPath: /var/lib/grafana
            subPath: grafana
      securityContext:
        fsGroup: 472
        runAsUser: 472
  volumeClaimTemplates:
  - metadata:
      name: grafana-data
    spec:
      storageClassName: managed-nfs-storage 
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: "1Gi"

---

apiVersion: v1
kind: Service
metadata:
  name: grafana
  namespace: kube-system
spec:
  type: NodePort
  ports:
  - port : 80
    targetPort: 3000
    nodePort: 30007
  selector:
    app: grafana

2.storageclass提前创建好的

[root@kubemaster01 grafana]# kubectl  get sc
NAME                  PROVISIONER      AGE
managed-nfs-storage   fuseim.pri/ifs   4h25m
[root@kubemaster01 grafana]#

3.访问

[root@kubemaster01 grafana]# kubectl  get svc   -n  kube-system 
NAME                   TYPE        CLUSTER-IP        EXTERNAL-IP   PORT(S)          AGE
grafana                NodePort    169.169.180.248   <none>        80:30007/TCP     6m33s

4.访问 添加数据源 出图

prometheus09-k8s部署grafana

prometheus09-k8s部署grafana

prometheus09-k8s部署grafana

prometheus09-k8s部署grafana

prometheus09-k8s部署grafana

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI