Skip to content
This repository was archived by the owner on Jul 28, 2026. It is now read-only.

Resolve K8s API server IP using DNS - #330

Merged
rfratto merged 3 commits into
masterfrom
fix_apiserver_cert
Jan 14, 2021
Merged

Resolve K8s API server IP using DNS#330
rfratto merged 3 commits into
masterfrom
fix_apiserver_cert

Conversation

@hjet

@hjet hjet commented Jan 14, 2021

Copy link
Copy Markdown
Contributor

PR Description

Agent scrapes the K8s API server using Prometheus K8s service discovery. If using the "endpoints" role (as is currently done in the manifest), the TLS server_name parameter must be set to the K8s API server Service name (kubernetes by default), which resolves to the ClusterIP address contained in the X.509 client cert used for authentication. If omitted, Prom service discovery will use the Endpoints object IP address, which is not referenced in the cert and will cause an error. Tested on DigitalOcean Kubernetes. This may be provider-specific? To investigate on GCP, etc.

Which issue(s) this PR fixes

Notes to the Reviewer

See Slack thread.

PR Checklist

  • CHANGELOG updated
  • Documentation added
  • Tests updated

@CLAassistant

CLAassistant commented Jan 14, 2021

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@hjet hjet changed the title Fix apiserver cert Resolve K8s API server IP using DNS Jan 14, 2021
@hjet
hjet requested a review from rfratto January 14, 2021 00:42

@rfratto rfratto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! I added the server_name field to the Jsonnet which the YAML is generated from. Can you sign the CLA before I merge?

@hjet

hjet commented Jan 14, 2021

Copy link
Copy Markdown
Contributor Author

Ah awesome thanks! Total Jsonnet noob but will make changes there from now on.

One remaining issue is that I think with the current config we're double scraping the API server (both the deployment and daemonset agents have the default/kubernetes scrape job) - can change in another PR, or in this one?

@rfratto

rfratto commented Jan 14, 2021

Copy link
Copy Markdown
Contributor

I'd prefer that to be another PR :)

@rfratto
rfratto merged commit f1df866 into master Jan 14, 2021
@rfratto
rfratto deleted the fix_apiserver_cert branch January 14, 2021 22:02
@mattdurham mattdurham mentioned this pull request Sep 7, 2021
3 tasks
mattdurham pushed a commit that referenced this pull request Nov 11, 2021
* Explicitly specify API server Service name so DNS resolves to IP matching cert.

* Update changelog

* add server_name to jsonnet

Co-authored-by: Robert Fratto <robertfratto@gmail.com>
@github-actions github-actions Bot added the frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. label Apr 21, 2024
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants