DataDog / helm-charts

Helm charts for Datadog products
Apache License 2.0
343 stars 1.01k forks source link

cluster-agent network policy breaks cluster-name autodiscovery on GKE #1373

Open hanikesn opened 5 months ago

hanikesn commented 5 months ago

Describe what happened:

CLUSTER | DEBUG | (pkg/util/kubernetes/clustername/clustername.go:97 in getClusterName) | Unable to auto discover the cluster name from the gce API: unable to retrieve clustername from GCE: GCE metadata API error: Get "http://169.254.169.254/computeMetadata/v1/instance/attributes/cluster-name": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

The egress to port 80 is blocked here: https://github.com/DataDog/helm-charts/blob/85d3e6902870392c73ad0042ea4ceca7f080c9a8/charts/datadog/templates/cluster-agent-network-policy.yaml#L56-L64

Describe what you expected:

CLUSTER | DEBUG | (pkg/util/kubernetes/clustername/clustername.go:94 in getClusterName) | Trying to auto discover the cluster name from the gce API...
CLUSTER | DEBUG | (pkg/config/setup/config.go:2010 in IsCloudProviderEnabled) | cloud_provider_metadata is set to [gcp] in agent configuration, trying endpoints for GCP Cloud Provider
CLUSTER | DEBUG | (pkg/util/http/transport.go:135 in 1) | URL 'http://169.254.169.254/computeMetadata/v1/instance/attributes/cluster-name' matches no_proxy list item '169.254.169.254': not using any proxy
CLUSTER | INFO | (pkg/util/kubernetes/clustername/clustername.go:104 in getClusterName) | Using cluster name XXX auto discovered from the gce API

Steps to reproduce the issue:

  datadog:
    networkPolicy:
      create: true

Additional environment details (Operating System, Cloud provider, etc): Chart version: 3.59.6 Agent version 7.52.1