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 configurable metrics for kubelet cadvisor interface #88841

Closed

Conversation

KielChan
Copy link

@KielChan KielChan commented Mar 5, 2020

What type of PR is this?

/kind feature

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.:


Signed-off-by: ChenQingya <qingya.chen520@gmail.com>
@k8s-ci-robot
Copy link
Contributor

@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.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Mar 5, 2020
@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Mar 5, 2020
@k8s-ci-robot k8s-ci-robot added area/kubelet area/test kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Mar 5, 2020
@fejta-bot
Copy link

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.

@dashpole
Copy link
Contributor

dashpole commented Mar 5, 2020

/assign

@@ -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},
Copy link
Member

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

// Only if feature gates CustomCadvisorMetrics set to be true, it will accept custom configuration like:
// cpu,sched,memory,disk,network,tcp
// +optional
CadvisorMetricsEnabled []string
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest CadvisorMetricsinstead

Copy link
Author

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

@szuecs
Copy link
Member

szuecs commented Mar 5, 2020

@KielChan nice feature, but can you please add some tests?
Additionally alpha features need to be guarded as far as I know and in your changes I don't see that you use

if utilfeature.DefaultFeatureGate.Enabled(features.EnableCustomCadvisorMetrics)

Signed-off-by: ChenQingya <qingya.chen520@gmail.com>
@KielChan
Copy link
Author

KielChan commented Mar 6, 2020

@KielChan nice feature, but can you please add some tests?
Additionally alpha features need to be guarded as far as I know and in your changes I don't see that you use

if utilfeature.DefaultFeatureGate.Enabled(features.EnableCustomCadvisorMetrics)

I didn't use if before in server.go, just used Enabled as a flag to determine whether to acquire custom metrics from configuration. And now, I have fixed it and add some UT for default or custom cadivsor metrics set.

@@ -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}
Copy link
Member

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?

Copy link
Author

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.

@mattjmcnaughton
Copy link
Contributor

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? :)

@dashpole
Copy link
Contributor

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.

@KielChan
Copy link
Author

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.

@k8s-ci-robot
Copy link
Contributor

@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.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 11, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 10, 2020
@KielChan
Copy link
Author

KielChan commented Aug 3, 2020

Due to cadvisor v0.37.0 has released, I will re-write another PR to remove hard code like AllMetricsSet in kubelet.

@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 2, 2020
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

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.

@yuzhiquan
Copy link
Member

@KielChan would you like move on this pr, i think this feature can fix some issue in our cluster?

@yuzhiquan
Copy link
Member

/reopen

@k8s-ci-robot k8s-ci-robot reopened this Apr 8, 2022
@k8s-ci-robot
Copy link
Contributor

@yuzhiquan: Reopened this PR.

In response to this:

/reopen

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.

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Apr 8, 2022
@k8s-ci-robot
Copy link
Contributor

@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 triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: KielChan
To complete the pull request process, please assign derekwaynecarr, smarterclayton after the PR has been reviewed.
You can assign the PR to them by writing /assign @derekwaynecarr @smarterclayton in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ehashman
Copy link
Member

@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

@k8s-ci-robot
Copy link
Contributor

@ehashman: Closed this PR.

In response to this:

@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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubelet area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
Archived in project
Archived in project
Development

Successfully merging this pull request may close these issues.

8 participants