簡體   English   中英

Fluentd 無法連接到 ElasticSearch 集群

[英]Fluentd Failing to connect to ElasticSearch cluster

我有一個本地 kubernetes 集群,我在其中使用預配置的 elasticsearch 映像 (fluent/fluentd-kubernetes-daemonset:elasticsearch) 添加了 Fluentd Daemonset。 本文的第 2 步。 我還有一個在雲中運行的彈性集群。 您可以將一些 env 變量傳遞給 fluentd-elasticsearch 映像進行配置。 它看起來很簡單,但是在運行 fluentd Pod 時,我不斷收到錯誤消息:

"Fluent::ElasticsearchOutput::ConnectionFailure" error="Can not reach Elasticsearch cluster ({:host=>\\"fa0acce34bf64db9bc9e46f98743c185.westeurope.azure.elastic-cloud.com\\", :port=>9243, :scheme=>\\"https\\", :user=>\\"username\\", :password=>\\"obfuscated\\"})!" plugin_id="out_es"

當我嘗試使用# wget https://fa0acce34bf64db9bc9e46f98743c185.westeurope.azure.elastic-cloud.com:9243/從 pod 內訪問彈性集群時,我收到 401 未授權(因為我沒有在此處提交用戶/密碼),但是它至少表明該地址是可達的。

為什么連接失敗? 我已經將 FLUENT_ELASTICSEARCH_SSL_VERSION 設置為“TLSv1_2”,我看到這為其他人解決了一些問題。

守護進程配置:

kind: DaemonSet
metadata:
  name: fluentd
  namespace: kube-logging
  labels:
    app: fluentd
    k8s-app: fluentd-logging
    version: v1
    kubernetes.io/cluster-service: "true"
spec:
  selector:
    matchLabels:
      app: fluentd
  template:
    metadata:
      labels:
        app: fluentd
        k8s-app: fluentd-logging
        version: v1
        kubernetes.io/cluster-service: "true"
    spec:
      serviceAccount: fluentd
      serviceAccountName: fluentd
      tolerations:
        - key: node-role.kubernetes.io/master
          effect: NoSchedule
      containers:
      - name: fluentd
        image: fluent/fluentd-kubernetes-daemonset:elasticsearch
        env:
        - name:  FLUENT_ELASTICSEARCH_HOST
          value: "fa0acce34bf64db9bc9e46f98743c185.westeurope.azure.elastic-cloud.com"
        - name:  FLUENT_ELASTICSEARCH_PORT
          value: "9243"
        - name: FLUENT_ELASTICSEARCH_SCHEME
          value: "https"
        - name: FLUENT_UID
          value: "0"
        - name: FLUENT_ELASTICSEARCH_SSL_VERIFY
          value: "false"
        - name: FLUENT_ELASTICSEARCH_SSL_VERSION
          value: "TLSv1_2"
        - name: FLUENT_ELASTICSEARCH_USER
          value: "<user>"
        - name: FLUENT_ELASTICSEARCH_PASSWORD
          value: "<password>"
        resources:
          limits:
            memory: 100Mi
          requests:
            cpu: 100m
            memory: 100Mi
        volumeMounts:
        - name: varlog
          mountPath: /var/log
        - name: varlibdockercontainers
          mountPath: /var/lib/docker/containers
          readOnly: true
      terminationGracePeriodSeconds: 30
      volumes:
      - name: varlog
        hostPath:
          path: /var/log
      - name: varlibdockercontainers
        hostPath:
          path: /var/lib/docker/containers

對於遇到此問題的任何其他人:

我正在學習使用“圖像:fluent/fluentd-kubernetes-daemonset:elasticsearch”圖像的教程。 當您查看他們的 DockerHub ( https://hub.docker.com/r/fluent/fluentd-kubernetes-daemonset ) 時,您會發現 :elaticsearch 標簽已經使用了一年並且可能已經過時。

我將 DaemonSet 的圖像更改為更新且更穩定的標簽“fluent/fluentd-kubernetes-daemonset:v1-debian-elasticsearch”,現在它可以正常工作了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM