Closed atoulme closed 4 weeks ago
Looks like kops adds that to instances it creates: https://github.com/kubernetes/kops/blob/d3554048b827db8a085cc55cde8fcf221a16ae03/pkg/model/gcemodel/autoscalinggroup.go#L108
It doesn't currently add cluster-location, so that should be safe. But it also means that if cluster-location is added in the future, this will break again.
I have created a cluster using kops on GCE.
I then ran the OpenTelemetry Collector with the resourcedetectionprocessor with the gcp detector on the cluster. I saw the following error with the latest contrib 0.112.0 release:
This traces back to the resourcedetectionprocessor code that performs this call when the resourcedetection processor detector returns true when calling onGKE.
onGKE has changed recently, it performs this logic:
d.GKEClusterName()
is the equivalent of calling http://169.254.169.254/computeMetadata/v1/instance/attributes/cluster-name with the header Metadata-Flavor":"Google". From inside the container, performing such a request returnsdata-collection.k8s.local
.However, calling http://169.254.169.254/computeMetadata/v1/instance/attributes/cluster-location returns:
My proposal is to change the way onGKE is run to check on cluster location instead of cluster name. It is unclear to me why this kops-registered cluster cluster name is provisioned in the compute metadata service.