'kubernetes fluent-bit unable to resolve host

Issue Description

I am getting an error in fluent-bit basically saying it cant resolve host

getaddrinfo(host='<My Elastic Cloud Instance>.aws.elastic-cloud.com:9243', err=4): Domain name not found

I suspect it has something to do with the port getting appended in the dns lookup, but I can't seem to see any settings that join the two together in my configuration's

I have verified that using the a dnsutil pod in the same namespace, I am able to resolve the host correctly

Info that may be helpful

Config Map output-elasticsearch.conf

[OUTPUT]
    Name            es
    Match           *
    Host            ${CLOUD_ELASTICSEARCH_HOST}
    Port            ${CLOUD_ELASTICSEARCH_PORT}
    Cloud_ID        ${CLOUD_ELASTICSEARCH_ID}
    Cloud_Auth      ${CLOUD_ELASTICSEARCH_USER}:${CLOUD_ELASTICSEARCH_PASSWORD}
    Logstash_Format On
    Logstash_Prefix kube1
    Replace_Dots    On
    Retry_Limit     False
    tls             On
    tls.verify      Off

elasticsearch-configmap

data:
  CLOUD_ELASTICSEARCH_HOST: <MyCloudId>.aws.elastic-cloud.com
  CLOUD_ELASTICSEARCH_ID: >-
    elastic-security-deployment:<Bunch of Random Bits>
  CLOUD_ELASTICSEARCH_PORT: '9243'

env portion of my daemonset

          env:
            - name: CLOUD_ELASTICSEARCH_HOST
              valueFrom:
                configMapKeyRef:
                  name: elasticsearch-configmap
                  key: CLOUD_ELASTICSEARCH_HOST
            - name: CLOUD_ELASTICSEARCH_PORT
              valueFrom:
                configMapKeyRef:
                  name: elasticsearch-configmap
                  key: CLOUD_ELASTICSEARCH_PORT
            - name: CLOUD_ELASTICSEARCH_ID
              valueFrom:
                configMapKeyRef:
                  name: elasticsearch-configmap
                  key: CLOUD_ELASTICSEARCH_ID
            - name: CLOUD_ELASTICSEARCH_USER
              valueFrom:
                secretKeyRef:
                  name: elasticsearch-secret
                  key: CLOUD_ELASTICSEARCH_USER
            - name: CLOUD_ELASTICSEARCH_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: elasticsearch-secret
                  key: CLOUD_ELASTICSEARCH_PASSWORD
            - name: FLUENT_ELASTICSEARCH_HOST
              value: elasticsearch
            - name: FLUENT_ELASTICSEARCH_PORT
              value: '9200'


Solution 1:[1]

For Elastic Cloud, try omit Host and Port from your output:

[OUTPUT]
    Name            es
    Match           *
    Cloud_ID        ${CLOUD_ELASTICSEARCH_ID}
    Cloud_Auth      ${CLOUD_ELASTICSEARCH_USER}:${CLOUD_ELASTICSEARCH_PASSWORD}
    Logstash_Format On
    Logstash_Prefix kube1
    Replace_Dots    On
    Retry_Limit     False
    tls             On
    tls.verify      Off

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 gohm'c