DataDog / helm-charts

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

Datadog Cluster Agent fails to detect cluster name for Anthos / GKE #920

Open CmdrSharp opened 1 year ago

CmdrSharp commented 1 year ago

Describe what happened: When installing Datadog via Helm on Anthos on-premises (GKE), the Datadog Cluster Agent fails to detect the cluster name automatically.

2023-02-19 02:48:32 UTC | CLUSTER | WARN | (app/app.go:277 in start) | Failed to auto-detect a Kubernetes cluster name. We recommend you set it manually via the cluster_name config option

Describe what you expected: Cluster name should have been found. It can be found in multiple places within the cluster.

kind: Cluster

❯ k get cluster -A
NAMESPACE   NAME                AGE
default     my-cluster-name   2d21h

kind: Node

metadata:
  labels:
    kubernetes.googleapis.com/cluster-name: my-cluster-name

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

Client Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.1", GitCommit:"8f94681cd294aa8cfd3407b8191f6c70214973a4", GitTreeState:"clean", BuildDate:"2023-01-18T15:51:24Z", GoVersion:"go1.19.5", Compiler:"gc", Platform:"darwin/amd64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.5-gke.100", GitCommit:"ccb35b8b179fee26fa6f46c59fdb5f8ff569fdfd", GitTreeState:"clean", BuildDate:"2022-12-08T21:50:42Z", GoVersion:"go1.19.4 X:boringcrypto", Compiler:"gc", Platform:"linux/amd64"}
clamoriniere commented 1 year ago

Hi @cm

Thanks for opening this issue.

Unfortunately, the cluster-agent doesn't yet look at the kubernetes.googleapis.com/cluster-name label or this cluster resource.

However the agent have already a configuration option to configure it.

datadog:
  env: 
  - name: DD_KUBERNETES_NODE_LABEL_AS_CLUSTER_NAME
    value: "kubernetes.googleapis.com/cluster-name"

Please let us know if this workaround works for you. 🙇

In parallel, on our side, we will investigate what is the best way to detect the cluster-name in Anthos (labels va Cluster resource vs other).