-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
feat: explicit gce interface ipv4 address metadata #8978
feat: explicit gce interface ipv4 address metadata #8978
Conversation
e74dd5c
to
b3ce7e4
Compare
Signed-off-by: Joey Freeland <joey@free.land>
b3ce7e4
to
77e25cf
Compare
The GCE networkInterfaces JSON includes a |
🤦 . updated. |
Thanks for your PR. For legal reasons, we require that all commits are signed with a DCO before we can merge them. See this blog post for considerations around this. This means that the last line of your commit message should read like:
If you are using GitHub through the web interface, it's quickest to close this PR and open a new one with the appropriate line. If you are using Git on the command line, it is probably quickest to amend and force push. You can do that with
As always, be careful when force-pushing. |
1ea51e0
to
74574f0
Compare
Signed-off-by: Joey Freeland <joey@free.land>
74574f0
to
8017dd7
Compare
Sorry. Updated. |
I like this change. Does the api guarantees we would only get ipv4? |
We are using the
|
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.
I will let a few more hours for @SuperQ to review, otherwise I will merge this tomorrow.
Many thanks.
Description updated for completeness. |
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.
LGTM, nice
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.
Thanks! One last nit.
(I missed it in my last review, sorry) |
Co-authored-by: Julien Pivotto <roidelapluie@gmail.com> Signed-off-by: Joey Freeland <joey@free.land>
ffefdd1
to
5d0a128
Compare
Thanks! |
…bels as in Prometheus 2.29 See prometheus/prometheus#8978
…bels as in Prometheus 2.29 See prometheus/prometheus#8978
Always add GCE interface IPv4 address metadata for all interfaces. In cases where you have multiple interfaces, this can then be used, for instance, to rewrite the address label to target metrics on a separate interface.
This utilizes the Google Compute API's instances metadata, https://cloud.google.com/compute/docs/reference/rest/v1/instances, using the
networkInterfaces[].networkIP
field which according to the documentation will return an IPv4 address.In GCP a TCP load balancer (and probably others) can only forward traffic to
nic0
. A snippet from https://cloud.google.com/load-balancing/docs/network/setting-up-network-backend-service#configuring_the_load_balancer:In some cases this may mean that you need to move functions that historically ran on
nic0
to another interface. For instance, some network software vendors typically run their management interface, where one scrapes metrics and manages the machine onnic0
, however in GCP this requires moving the management interface tonic1
or some other interface. Take for instance https://github.com/memes/terraform-google-f5-bigip/blob/main/modules/metadata/files/multiNicMgmtSwap.sh.Testing this requires that you set up 2 instances in GCE:
<node_prefix>-N
that has 2 interfaces and is exposing metrics on the relevant IP and port, e.g.node_exporter --web.listen-address="<management_ip>:9090"
nic0
, should be in some network that is not your default networknic1
, should be in some 'management' subnetmanagement
subnet where you can download, build, and run prometheus from this branch, that (ideally) is running with a service account that has access to the GCP metadata service.I used the following prometheus.conf and this worked as intended.
Related to #7406.