This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 558
Configure kube-dns to expose metrics #2566
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,8 @@ spec: | |
metadata: | ||
annotations: | ||
scheduler.alpha.kubernetes.io/critical-pod: "" | ||
prometheus.io/scrape: "true" | ||
prometheus.io/port: "10055" | ||
labels: | ||
k8s-app: kube-dns | ||
kubernetes.io/cluster-service: "true" | ||
|
@@ -78,6 +80,9 @@ spec: | |
- "--dns-port=10053" | ||
- "--v=2" | ||
- "--config-dir=/kube-dns-config" | ||
env: | ||
- name: PROMETHEUS_PORT | ||
value: "10055" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this port fixed? Can you please point me at the docs for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not fixed, we could define any port not already used but that's what they use in kubernetes example: |
||
image: <kubernetesKubeDNSSpec> | ||
livenessProbe: | ||
failureThreshold: 5 | ||
|
@@ -96,6 +101,9 @@ spec: | |
- containerPort: 10053 | ||
name: dns-tcp-local | ||
protocol: TCP | ||
- containerPort: 10055 | ||
name: metrics | ||
protocol: TCP | ||
readinessProbe: | ||
httpGet: | ||
path: "/readiness" | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should these annotations be on the service rather than the deployment?
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.
Each pods has its own set of stats so Prometheus should scrape each pods, not the service.
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 believe the recommended approach is to annotate the service (though I cannot find a black and white statement from the team about it now). The pods of the service will still get scraped if using a
role
ofendpoints
in thekubernetes_sd_configs
.The exposed metrics will be the same either way, but there are a bunch of extra labels available this way.
Also, do note that this annotation is not really standardized, even if it is common in examples. We do not use it at all, and rather use
ServiceMonitor
s from the prometheus-operator. But perhaps it is a reasonable default to ship anyway? Is it set on other kube* things with metrics in acs-engine?