LoginSignup
1
0

More than 3 years have passed since last update.

KubernetesでMetricbeatを動かしたときにノードの情報が取れてない問題が発生した

Posted at

対象バージョン

kubernetes 1.16.2
Metricbeat 7.5.0

調査

調査した結果、10255のポートがdisabled。
10250のポートを使う必要ある。設定を変える必要があることがわかった

kubernetes 1.11から認証不要な外部連携ポートの10255は、kubeadm実行時にデフォルトでdisabledになるという変更が加わったらしい。
https://bon.sytes.net/post/metricbeat-with-kubernetesv1-11.html

[Metricbeat] - kubernetes metricsets get "connection refused" when querying http://${NODE_NAME}:10250/stats/summary on AWS EKS #13774
https://github.com/elastic/beats/issues/13774

対応

変更前

metricbeat-kubernetes.yamlの該当箇所
  kubernetes.yml: |-
    - module: kubernetes
      metricsets:
        - node
        - system
        - pod
        - container
        - volume
      period: 10s
      host: ${NODE_NAME}
      hosts: ["localhost:10255"]
      # If using Red Hat OpenShift remove the previous hosts entry and 
      # uncomment these settings:
      #hosts: ["https://${HOSTNAME}:10250"]
      #bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token

変更後
・「hosts: ["localhost:10255"]」をコメントにする
・hosts: ["https://${HOSTNAME}:10250"]のコメントは外す
・bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/tokenのコメントを外す
・ssl.verification_mode: noneを追加
・以下のコードを追加

      processors:
        - add_kubernetes_metadata:
            in_cluster: true
metricbeat-kubernetes.yamlの該当箇所
  kubernetes.yml: |-
    - module: kubernetes
      metricsets:
        - node
        - system
        - pod
        - container
        - volume
      period: 10s
      host: ${NODE_NAME}
      #hosts: ["localhost:10255"]
      # If using Red Hat OpenShift remove the previous hosts entry and 
      # uncomment these settings:
      hosts: ["https://${HOSTNAME}:10250"]
      ssl.verification_mode: none
      bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
      processors:
      - add_kubernetes_metadata:
          in_cluster: true
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0