Skip to content
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

Merged
merged 1 commit into from
Jun 26, 2018

Conversation

mfpierre
Copy link
Contributor

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

  • PR has a meaningful title or PR has the no-changelog label attached
  • Feature or bugfix has tests
  • Git history is clean
  • If PR impacts documentation, docs team has been notified or an issue has been opened on the documentation repo

Additional Notes

Anything else we should know when reviewing?

@mfpierre mfpierre force-pushed the mfpierre/ksm-disable-label-hostname branch from a4ea5eb to d7aa864 Compare June 25, 2018 23:21
@masci masci added this to the Future milestone Jun 26, 2018
@masci masci merged commit 9285aad into master Jun 26, 2018
@masci masci deleted the mfpierre/ksm-disable-label-hostname branch June 26, 2018 06:37
@masci masci modified the milestones: Future, Next Jun 26, 2018

# 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)
Copy link

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?

Copy link
Contributor Author

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.

Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants