datadog-operator icon indicating copy to clipboard operation
datadog-operator copied to clipboard

Dogstatsd does not have a hostPort

Open jcogilvie opened this issue 2 years ago • 2 comments

Output of the info page (if this is a bug) (Not sure how to obtain this)

Describe what happened: On v1alpha1 CRD, metrics collection does not configure a hostPort (required per the conventional configuration of connecting statsds to hostip:8125) For a counterexample, APM does.

Describe what you expected: When I enable dogstatsd port 8125 should be bound to a host port (or at least have the option) so that the recommended configuration will work

Steps to reproduce the issue: Enable dogstatsd Observe that the port is created as follows:

      ports:
        - name: dogstatsdport
          containerPort: 8125
          protocol: UDP

Conspicuously missing is hostPort: 8125

Additional environment details (Operating System, Cloud provider, etc): EKS 1.22

jcogilvie avatar Dec 16 '22 16:12 jcogilvie

I hit the same problem, finally I was able to solve it with DD support help (as far as I can tell, it's not documented anywhere).

To get the hostPort created, it must defined like this:

apiVersion: datadoghq.com/v1alpha1
kind: DatadogAgent
metadata:
  name: datadog
spec:
  agent:
    config:
      hostPort: 8125
      ...
      env:
        - name: DD_DOGSTATSD_NON_LOCAL_TRAFFIC
          value: 'true'

Also, DD_DOGSTATSD_NON_LOCAL_TRAFFIC env var must be set to true.

I hope this helps.

orhuidobro avatar Jan 09 '23 16:01 orhuidobro

For people coming here from google, if you are using v2alpha1, all you gotta do is:

kind: DatadogAgent
apiVersion: datadoghq.com/v2alpha1
metadata:
  name: datadog
spec:
  features:
    dogstatsd:
      hostPortConfig:
        enabled: true
    // ...

JCMais avatar Jan 30 '24 19:01 JCMais

@JCMais thanks for providing the configuration for v2alpha1! Since v1alpha1 is deprecated I'm closing the issue.

levan-m avatar Aug 19 '24 20:08 levan-m