<p>I have a fluentbit deployed as a sidecar. This fluentbit has an output of type Forward that is suppose to send the logs to a FluentD deployed as a DaemonSet.</p>
<p>The implementation works when using the PodIP of FluentD as host, but I get Connection refused when using the Service hostname from Kubernetes.</p>
<p>This is the error when using the Upstream approach:</p>
<pre><code>[error] [net] TCP connection failed: fluentd.logging.svc.cluster.local:24224 (Connection refused)
[error] [net] socket #33 could not connect to fluentd.logging.svc.cluster.local:24224
[debug] [upstream] connection #-1 failed to fluentd.logging.svc.cluster.local:24224
[error] [output:forward:forward.0] no upstream connections available
</code></pre>
<p>This is the error when using the regular Host approach:</p>
<pre><code>[error] [output:forward:forward.0] could not write forward header
</code></pre>
<p>I tried both using the Host parameter in Forward for Fluentbit, and also the Upstream functionality with the same outcome.</p>
<p>No network policies in place. This is the configuration with Upstream. With Host it will have Host and Port instead of Upstream in the OUTPUT section.</p>
<pre><code>[SERVICE]
  Daemon Off
  Flush 5
  Log_Level debug
  Parsers_File parsers.conf
  Parsers_File custom_parsers.conf
  HTTP_Server Off
[INPUT]
  Name tail
  Path /var/app-logs/*
  Parser json
  Tag app-logs.*
  Mem_Buf_Limit 5MB
  Skip_Long_Lines On
[OUTPUT]
  Name forward
  Match app-logs.*
  Host fluentd.logging.svc.cluster.local
  Port 24244
[PARSER]
  Name json
  Format json
  Time_Key time
  Time_Format %Y-%m-%dT%H:%M:%S.%L
</code></pre>
<p>The FluentD deployment has a Service with the 24244 TCP port connected with the container TCP port 24244, where FluentD is listening.</p>
<p>A simple &quot;nc&quot; test also shows that I'm able to connect with the PodIP, but not to the Service hostname.</p>
<p>There's also an additional port in my FluenD daemonset which is for Prometheus metrics, and I can &quot;nc&quot; to that one using the host name.</p>
<p>This is the FluentD service</p>
<pre><code>NAME      TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)               AGE
fluentd   ClusterIP   10.102.255.48   &lt;none&gt;        24231/TCP,24244/TCP   4d6h
</code></pre>
<p>This is the FluentD deployment</p>
<pre><code>Containers:
  fluentd:
    Container ID:   xxxx
    Image:          xxxx
    Image ID:       xxxx
    Ports:          24231/TCP, 24244/TCP
    Host Ports:     0/TCP, 0/TCP
</code></pre>
<p>This is the FluentD forward listener config</p>
<pre><code>&lt;source&gt;
  @type forward
  port 24224
  bind 0.0.0.0
  @label @applogs
  tag applogs.*
&lt;/source&gt;
</code></pre>
<p>Am I missing something obvious here?</p>

codiaf
<p>Ok, stupid stupid mistake, there was a typo when writing the number port so the one configured in FluentBit didn't match the one defined in the Kubernetes Service -.-</p>
