ノードエクスポーター、プロメテウス、グラファナ間の接続

1. ノードエクスポーターとノードマシン

ノード マシンのデータ情報を収集するために使用されますが、ノード エクスポーターとノード マシンの間の接続はどこにあるのでしょうか?
ノードエクスポーター.yaml

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: node-exporter
  namespace: kube-system
  labels:
    k8s-app: node-exporter
spec:
  selector:
    matchLabels:
      k8s-app: node-exporter
  template:
    metadata:
      labels:
        k8s-app: node-exporter
    spec:
      containers:
      - image: prom/node-exporter
        name: node-exporter
        ports:
        - containerPort: 9100
          protocol: TCP
          name: http
      tolerations:
      - key: "node-role.kubernetes.io/master"
        operator: "Exists"
        effect: "NoSchedule"
---
apiVersion: v1
kind: Service
metadata:
  labels:
    k8s-app: node-exporter
  name: node-exporter
  namespace: kube-system
spec:
  ports:
  - name: http
    port: 9100
    nodePort: 31672
    protocol: TC
  type: NodePort
  selector:
    k8s-app: node-exporter

ノード エクスポーターの種類がわかります。 DaemonSet
DaemonSet は、すべて (または一部) のノードが Pod のコピーを実行することを保証します。ノードがクラスターに参加すると、それらのノードにポッドも追加されます。これらのポッドは、ノードがクラスターから削除されたときにもリサイクルされます。つまり、次の限り

kubectl create -f node-exporter.yaml

node-exporter は、k8s 管理下の各ノードに自動的に参加します。自動関連付けにより、手動で関連付ける必要がなくなります。

2 つ、ノードエクスポーターとプロメテウス

Prometheus は、node-exporte によって収集されたデータを保存するために使用されますが、それらの間の接続はどこにあるのでしょうか?
まず、node-exporter がポート 31672 を開いていることがわかります
ここに画像の説明を挿入
。そのため、prometheus は、node-exporter をリッスンするときにポート 31672 もリッスンします。
次に、prometheus の configmap.yaml ファイルで、node-exporter の IP を構成します。
ここに画像の説明を挿入
ここでの通信へのアクセスには、パブリック ネットワーク IP と内部ネットワーク IP の両方を使用できます。その違いはまだわかっていません。
知らせ:
configmap.yaml ファイルを変更する場合は、単に configmap.yaml を適用するのではなく、次の手順を実行する必要があります。

kubectl delete -f prometheus.svc.yml
kubectl delete -f prometheus.deploy.yml
kubectl delete -f configmap.yaml

prometheus サービスが存在しないことを確認する

kubectl get po -A

プロメテウスサービスを再作成する

kubectl create -f configmap.yaml
kubectl create -f prometheus.deploy.yml
kubectl create -f prometheus.svc.yml
kubectl get po -n kube-system

3. プロメテウスとグラファナ

Grafana は、prometheus によって保存されたデータを表示するために使用されます。それらの間の接続はシンプルかつ簡単です。
Grafana の [データ ソース] ページで、プロメテウスの IP (マスター パブリック ネットワーク IP) + ポートを設定します。prometheus が保存したデータを読み込み、グラフ形式で表示することができます。
ここに画像の説明を挿入
ここに画像の説明を挿入

おすすめ

転載: blog.csdn.net/simpleness_/article/details/130988505