Open ocervell opened 4 years ago
FWIW, we handle this by querying the GKE metadata service on startup, e.g.
PROJECT_ID=$(curl -sf "http://metadata.google.internal/computeMetadata/v1/project/project-id" -H "Metadata-Flavor: Google")
CLUSTER_NAME=$(curl -sf "http://metadata.google.internal/computeMetadata/v1/instance/attributes/cluster-name" -H "Metadata-Flavor: Google")
(You have to override the container command and then call the sidecar yourself obviously. Also beware that in some cases the metadata service availability may lag pod startup by a few seconds so you'll need to check your outputs.)
I'd like to deploy the SD prometheus sidecar without having to patch (i.e: just one YAML, no subst).
Ideally it would look like this:
Any idea if we could have autodetected defaults for the arguments
--stackdriver.project_id
,--stackdriver.kubernetes.location
and--stackdriver.kubernetes.cluster-name
? They would default to the GKE cluster they are running on.