<p>Ask a question.
In the K8S environment, FluentBit outputs to Kafka, can establishes a connection and creates a topic, but generates data report error.</p>
<pre><code>[error] [output:kafka:kafka.0] fluent-bit#producer-1: [thrd:data39:9092/176]: data39:9092/176: Failed to resolve 'data39:9092': Name or service not known (after 197ms in state CONNECT)
</code></pre>
<p>I tried FluentBit1.5 and 1.6 and had the same problem.
I only changed the Kafka broker and topic in the FluentBit configuration file, everything else is the default configuration.
I checked /etc/hosts and there is no problem.</p>
<p>The Kafka profile is set to:
listeners=PLAINTEXT://0.0.0.0:9092
advertised.listeners=PLAINTEXT://x.x.x.x:9092</p>
<p>Also, FluentBit output to ElasticSearch is normal.</p>
<p>Ask everyone to help, thank you very much.</p>

user3804623
<p>Posting this answer as a community wiki as original poster of this question provided a solution to his issue in the comments.</p>
<p>Feel free to edit and improve this answer.</p>
<blockquote>
<p>it works. in fluent-bit-ds.yaml - mountPath: /etc/hosts name: hosts readOnly: true</p>
</blockquote>
<p>The changes most probably were made to the <code>fluent-bit-ds.yaml</code> from this site:</p>
<ul>
<li><em><a href="https://docs.fluentbit.io/manual/installation/kubernetes#fluent-bit-to-elasticsearch" rel="nofollow noreferrer">Docs.fluentbit.io: Manual: Installation: Kubernetes: Fluent-bit</a></em></li>
</ul>
<hr />
<p>Additional resources:</p>
<ul>
<li><em><a href="https://kafka.apache.org/" rel="nofollow noreferrer">Kafka.apache.org</a></em></li>
<li><em><a href="https://fluentbit.io/" rel="nofollow noreferrer">Fluentbit.io</a></em></li>
</ul>
