<p>I have a unique type of Kubernetes cluster that cannot install the <a href="https://docs.datadoghq.com/agent/kubernetes/?tab=helm" rel="nofollow noreferrer">Kubernetes Datadog agent</a>. I would like to collect the logs of individual docker containers in my Kubernetes pods similar to how the <a href="https://docs.datadoghq.com/agent/docker/log/?tab=containerinstallation#one-step-install" rel="nofollow noreferrer">Docker agent</a> works. </p>

<p>I am currently collecting docker logs from Kubernetes and then using a script with the <a href="https://docs.datadoghq.com/logs/log_collection/?tab=http#custom-log-forwarder" rel="nofollow noreferrer">Datadog custom log forwarder</a> to upload them to Datadog.  I was curious if there is a better way to achieve this serverless collection of docker logs from Kubernetes clusters in datadog?  The ideal situation I want is to plug my kubeconfig somewhere and then let Datadog take care of the rest without deploying anything onto my Kubernetes cluster.  </p>

<p>Is there an option for that outside of creating a custom script?</p>

Alex Cohen
<p>A better way would be to use a sidecar container with a logging agent, it won't increase the load on the API server.</p>

<p><a href="https://i.stack.imgur.com/AE8K9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AE8K9.png" alt="enter image description here"></a></p>

<p>Reference: <a href="https://kubernetes.io/docs/concepts/cluster-administration/logging/#sidecar-container-with-a-logging-agent" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/cluster-administration/logging/#sidecar-container-with-a-logging-agent</a></p>

<p>Datadog agent looks like doesn't support /suggest running as a sidecar (<a href="https://github.com/DataDog/datadog-agent/issues/2203#issuecomment-416180642" rel="nofollow noreferrer">https://github.com/DataDog/datadog-agent/issues/2203#issuecomment-416180642</a>)</p>

<p>I suggest looking at using other logging agent and pointing the backend to datadog.</p>

<p>Some options are:</p>

<ul>
<li>fluentd: <a href="https://blog.powerupcloud.com/kubernetes-pod-management-using-fluentd-as-a-sidecar-container-and-prestop-lifecycle-hook-part-iv-428b5f4f7fc7" rel="nofollow noreferrer">https://blog.powerupcloud.com/kubernetes-pod-management-using-fluentd-as-a-sidecar-container-and-prestop-lifecycle-hook-part-iv-428b5f4f7fc7</a></li>
<li>fluentd-bit: <a href="https://github.com/leahnp/fluentbit-sidecar" rel="nofollow noreferrer">https://github.com/leahnp/fluentbit-sidecar</a></li>
<li>filebeat: <a href="https://www.elastic.co/beats/filebeat" rel="nofollow noreferrer">https://www.elastic.co/beats/filebeat</a></li>
</ul>

<p>Datadog supports them</p>

<ul>
<li><a href="https://docs.datadoghq.com/integrations/fluentd/" rel="nofollow noreferrer">https://docs.datadoghq.com/integrations/fluentd/</a></li>
<li><a href="https://docs.datadoghq.com/integrations/filebeat/" rel="nofollow noreferrer">https://docs.datadoghq.com/integrations/filebeat/</a></li>
</ul>
