-
Notifications
You must be signed in to change notification settings - Fork 39.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 configurable metrics for kubelet cadvisor interface #88841
add configurable metrics for kubelet cadvisor interface #88841
Conversation
Signed-off-by: ChenQingya <qingya.chen520@gmail.com>
@KielChan: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Hi @KielChan. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
/assign |
pkg/features/kube_features.go
Outdated
@@ -659,6 +665,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS | |||
DefaultIngressClass: {Default: true, PreRelease: featuregate.Beta}, | |||
HugePageStorageMediumSize: {Default: false, PreRelease: featuregate.Alpha}, | |||
AnyVolumeDataSource: {Default: false, PreRelease: featuregate.Alpha}, | |||
EnableCustomCadvisorMetrics: {Default: false, PreRelease: featuregate.Alpha}, |
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 would suggest CustomCadvisorMetrics
instead
pkg/kubelet/apis/config/types.go
Outdated
// Only if feature gates CustomCadvisorMetrics set to be true, it will accept custom configuration like: | ||
// cpu,sched,memory,disk,network,tcp | ||
// +optional | ||
CadvisorMetricsEnabled []string |
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 would suggest CadvisorMetrics
instead
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.
fine, I'll fix it
@KielChan nice feature, but can you please add some tests?
|
Signed-off-by: ChenQingya <qingya.chen520@gmail.com>
I didn't use |
@@ -55,3 +56,45 @@ func TestCapacityFromMachineInfoWithHugePagesEnable(t *testing.T) { | |||
func TestCrioSocket(t *testing.T) { | |||
assert.EqualValues(t, CrioSocket, crio.CrioSocket, "CrioSocket in this package must equal the one in github.com/google/cadvisor/container/crio/client.go") | |||
} | |||
|
|||
func TestDefaultCadvisorMetricSet(t *testing.T) { | |||
usingLegacyStatsTable := []bool{false, true} |
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 for creating tests!
What about true,true and false,false?
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.
usingLegacyStats
just depends on kubelet runtime or remote runtime endpoint, and its value affects whether to collect disk stats in cadvisor.
Its combination is just true
or false
, when set custom cadivsor metrics if CustomCadvisorMetrics
feature gate enabled or just like before, i.e. Default cadvisor metric set. So true,ture
or false,false
makes no sense.
I defer to @dashpole here, but given the scope of this change and the fact that it adds new functionality/changes the API, I'm wondering if it would be a good candidate for a Kubernetes Enhancement Proposal (KEP)? Thoughts? :) |
The guidance we have been giving is to run cAdvisor as a daemonset with the metrics you are interested in turned on, and the rest disabled. There is some resource overhead to doing this, but it gives users complete control over all cAdvisor settings. |
Totally agree with you. In my opinion, kubelet cadvisor and cadvisor daemonset are two aspects. Cadvisor daemonset does expose any metric set provided. As for kubelet cadvisor interface work background, it is out of control 'cos only hard code metric set can be exposed. And for user do not care about what metric set exposed, it is just like before. We hope to do everything we can better than do nothing. |
@KielChan: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Due to cadvisor v0.37.0 has released, I will re-write another PR to remove hard code like |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@KielChan would you like move on this pr, i think this feature can fix some issue in our cluster? |
/reopen |
@yuzhiquan: Reopened this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@KielChan: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: KielChan The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@yuzhiquan feel free to open a new PR based on the commits contained here, but I want to leave this PR closed unless it has been rebased and is ready for review. This change, with API updates, will need a KEP. Another option is to go the approach I am testing in #109398. /close |
@ehashman: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What type of PR is this?
What this PR does / why we need it:
Now in kubelet, we can only use
hard-code
metrics.case 1: If user want to use advanced tcp stats (contents like
netstat -s
)in cadvisor v0.36.0, we can set it advtcp enabled.case 2: In complex production env, there are 250 pods on one node, kubelet will hang by syscall if all metrics provided are scanning cgroups file background. And to relieve this pain, we can disable some metrics like network, tcp, udp and so on.
case 3: If user don't care about metrics, this feature are disabled default.
case 4: for #68522 , we can pre-remove some metrics from default configuration now.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: