外部prometheus 监控istio

概念:

  prometheus 安装 其他namespace 下。 istio-system空间下 不启动istio。

  访问kiali 时候 graph 会显示未连接到prometheus 。这是由于 istio-system下没有prometheus 

  prometheus 在monitor-sa 命名空间下。

 

 

 

如何让kiali调用prometheus

 

一、安装prometheus  的时候指定node节点安装

  template:
    metadata:
      labels:
        app: prometheus
        component: server
      annotations:
        prometheus.io/scrape: 'false'
    spec:
      nodeName: k8s-node1
      serviceAccountName: monitor
      containers:
      - name: prometheus
        image: prom/prometheus:v2.2.1
        imagePullPolicy: IfNotPresent

 

二、设置prometheus 为nodeport模式

apiVersion: v1
kind: Service
metadata:
  name: prometheus
  namespace: monitor-sa
  labels:
    app: prometheus
spec:
  type: NodePort
  ports:
    - port: 9090
      targetPort: 9090
      nodePort: 30090
      protocol: TCP
  selector:
    app: prometheus
    component: server

查看prometheus 启动情况

 

三、创建 Endpoints  Service

 

apiVersion: v1
kind: Endpoints
metadata:
  name: prometheus
  namespace: istio-system
subsets:
  - addresses:
    - ip: 192.168.124.62
    ports:
      - port: 30090
---
apiVersion: v1
kind: Service
metadata:
  name: prometheus
  namespace: istio-system
spec:
  ports:
    - port: 9090
      protocol: TCP

 

这个启动空间一定要是istio-system下,这个相当于是转发。

 

配置好后就能在kiali中看见图形了

 

posted @ 2020-12-16 15:16  执酒  阅读(1122)  评论(0编辑  收藏  举报