-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add an option to disable hostname override #1800
Conversation
a4ea5eb
to
d7aa864
Compare
|
||
# By default the hostname for metrics containing the node label will be | ||
# overriden by the value of the label, this can be deactivated (all metrics | ||
# will be attached to the host running KSM) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi quick question, let's say I have two nodes, nodeA
and nodeB
. nodeB
is running kube-state-metrics
, and nodeA
has a datadog-agent running on it that's collecting the metrics provided by kube-state-metrics
. Those metrics' host
tag will be nodeA
if this is true, and nodeB
if this is false, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @2rs2ts,
With the setting to false the hostname will default to the one used by the agent submitting the metric.
For example if you have these prometheus metric exposed on nodeB
and we have a running agent on this node collecting KSM metrics.
kube_pod_container_resource_requests_memory_bytes{container="dnsmasq",namespace="kube-system",node="nodeA",pod="kube-dns-1326421443-hj4hx"} 2.097152e+07
kube_pod_container_resource_requests_memory_bytes{container="kubedns",namespace="kube-system",node="nodeB",pod="kube-dns-1326421443-hj4hx"} 2.097152e+07
by default (hostname_override: true
) first metric will be attached to host nodeA
with the tag node:nodeA
.
If set to false the metric will be attached to host nodeB
and keeping the tag node:nodeA
Ideally this should always stay true
as it's more relevant to have the metric attached to the relevant host, but we've seen issues where the node label exposed by KSM is not unique across multiple clusters (ec2 local-hostname for example) and this is causing the metrics to be attached to a wrong host.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks I understand; I kind of had it backwards and also misunderstood the context. I got part of this explained to me in a support ticket too.
Thanks for the explanation, the example, and of course the fix itself.
What does this PR do?
Add an option to disable hostname override
Motivation
In EC2 environnement EKS is reporting ec2 internal as node label, this might conflicts in some setup with several cluster where the IP could be the same.
Review checklist
no-changelog
label attachedAdditional Notes
Anything else we should know when reviewing?