外部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中看見圖形了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM