-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance our k8s pod detection #881
Comments
Do we really care about the values of
Do you want to detect that flag on the apm agent or on the apm server side? |
I believe so,
This flag can be computed centrally in apm-data and stored in Elasticsearch so it may be queried later by the Hosts UI. |
What do we mean with host? This looks like an internal IP managed by kubernetes that references the kubernetes API rather than the host machine one. Is that ok? |
Ahh I stand corrected, you are right! In which case it makes sense that we emit only |
Today agents support sending k8s data if the user explicitly configures pods to be injected with
KUBERNETES_NAMESPACE, KUBERNETES_POD_NAME, KUBERNETES_POD_UID, KUBERNETES_NODE_NAME
: https://www.elastic.co/guide/en/observability/current/apm-api-metadata.html#apm-api-kubernetes-data and #21 (comment)Whilst discussing if we can improve our
host.name
detection here, I noticed the following environment variable should be exposed to all pods nativelyKUBERNETES_SERVICE_HOST
,KUBERNETES_SERVICE_PORT
@trentm also pointed out
kubectl
itself relies on these to observe its running inside a pod: https://kubernetes.io/docs/reference/kubectl/#in-cluster-authentication-and-namespace-overridesThe suggestion here to start reporting these as agents and to extend the apm intake protocol to actually ingest this information into Elasticsearch.
Lastly we currently set
host.name
tokubernetes.host_name
we detect fromKUBERNETES_NODE_NAME
: https://github.com/elastic/apm-data/blob/main/model/modelprocessor/hostname.go#L39However we don't record the inverse, we are running under k8s but
KUBERNETES_NODE_NAME
was not explicitly configured. I believe we need to record this flag in Elasticsearch so that the Hosts View can filter this data out correctly to fix: https://github.com/elastic/observability-dev/issues/3321.Sending and recording
KUBERNETES_SERVICE_HOST
,KUBERNETES_SERVICE_PORT
would allow us to detect and record that flag.The text was updated successfully, but these errors were encountered: