更多精彩内容,欢迎观看:
《云原生网络数据面可观测性最佳实践》——四、ACK Net-Exporter 快速上手——1.Prometheus + Grafana配置(上):https://developer.aliyun.com/article/1221325?spm=a2c6h.13148508.setting.20.15f94f0eRr2vYu
自建Grafana
指标已经成功的被采集到了Prometheus,那么下一步我们需要部署Grafana,实现指标的可视化展示。可以参考下面的yaml部署Grafana的服务端和对外暴露的svc
apiVersion: apps/v1 kind: Deployment metadata: name: grafana-core namespace: prometheus labels: app: grafana component: core spec: replicas: 1 selector: matchLabels: app: grafana template: metadata: labels: app: grafana component: core spec: containers: - image: grafana/grafana:4.2.0 name: grafana-core imagePullPolicy: IfNotPresent # env: resources: # keep request = limit to keep this container in guaranteed class limits: cpu: 500m memory: 500Mi requests: cpu: 100m memory: 100Mi env: # The following env variables set up basic auth twith the default admin user and admin password. - name: GF_AUTH_BASIC_ENABLED value: "true" - name: GF_AUTH_ANONYMOUS_ENABLED value: "false" # - name: GF_AUTH_ANONYMOUS_ORG_ROLE # value: Admin # does not really work, because of template variables in exported dashboards: # - name: GF_DASHBOARDS_JSON_ENABLED # value: "true" readinessProbe: httpGet: path: /login port: 3000 # initialDelaySeconds: 30 # timeoutSeconds: 1 volumeMounts: - name: grafana-persistent-storage mountPath: /var volumes: - name: grafana-persistent-storage emptyDir: {} --- apiVersion: v1 kind: Service metadata: name: grafana namespace: prometheus labels: app: grafana component: core spec: type: LoadBalancer ports: - port: 3000 selector: app: grafana component: core
登录Grafana的对外暴露端口,我们需要设置采集源,设置Grafana的数据源来自Prometheus,地址填写Prometheus的SVC的clusterip和相关的接口。
2) ARMS-Prometheus(强力推荐)
方式一:创建集群时开启
在创建集群的组件配置页面,选中使用Prometheus监控服务。具体操作,请参见创建Kubernetes托管版集群。
方式二:在已有集群中开启
● 登录容器服务管理控制台,在左侧导航栏选择集群。
● 在集群列表页面,单击目标集群名称,然后在左侧导航栏,选择运维管理 > 组件管理 > ack-arms-prometheus组件进行安装。
安装完毕,可以在ARMS-Prometheus的控制台看到此集群的相关实例,它会自动化的配置相关的服务发现和Grafana大盘展示,相比于第三方Prometheus,节省了大量的联调成本