-
Notifications
You must be signed in to change notification settings - Fork 407
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 condition to leverage kubernetes provider for controllermanager and scheduler data streams #1324
Conversation
…nd scheduler data streams
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪 |
Tests fail because the added
When |
@@ -9,3 +9,4 @@ period: {{period}} | |||
bearer_token_file: {{bearer_token_file}} | |||
ssl.verification_mode: {{ssl.verification_mode}} | |||
{{/if}} | |||
condition: ${kubernetes.pod.labels.component} == 'kube-controller-manager' |
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.
Maybe it would worth giving the option to users to change it via the UI in case they have different labels than the default ones for these components.
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.
It is a bit over engineered by the users to have that option as rarely anyone would remove the default kube-controller-manager
option but If we have that approach in general I can go with it.
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.
If upstream k8s or a special distro of k8s changes the value of this label then the integration will be incompatible. I feel like it's too fragile to depend to a specific value of a specific label. Since the default value will be there users will not really be bothered by this option, like what happens for bearer_token
and others.
I think that As far as I have seen we usually set this |
I agree that
|
This recalls me to this discussion, it'd be nice if providers would start automatically when used 🙂 If we enable providers by default we have to make them to silently fail in environments where they are not used nor expected to work, something like this is done in some
Yes, this is a bit of a hack, it shouldn't be assumed that the host name of a kubernetes node is its node name, we should take this into account if we refactor Checking for the existence of |
In think that in this case the provider is not initialised properly due to issues with |
…condition_in_scheduler_and_controllermanager
…condition_in_scheduler_and_controllermanager
…condition_in_scheduler_and_controllermanager
…condition_in_scheduler_and_controllermanager
…condition_in_scheduler_and_controllermanager
Pinging @elastic/integrations (Team:Integrations) |
@@ -9,3 +9,4 @@ period: {{period}} | |||
bearer_token_file: {{bearer_token_file}} | |||
ssl.verification_mode: {{ssl.verification_mode}} | |||
{{/if}} | |||
condition: ${kubernetes.pod.labels.component} == '{{controller_manager_label}}' |
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 wonder how we could support deployments that don't set the component
label.
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 also thought about that. Giving the user the possibility to define the key and the value of a label like setting 'component=kube-controller-manager'
.
The problem is that somehow we need to split this variable inside the handlebar file in order to create the correct condition. And this requires to register some helpers and I don't if this is supported
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.
@jsoriano after proposals I went on with a different approach on this. I added controller_manager_label_key
and controller_manager_label_value
as hidden vars in advanced settings (see the last screenshots) and you can set there the label key and value you want. Default stays the component label. It works perfectly for custom labels defined by user
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.
👍
@@ -9,3 +10,5 @@ period: {{period}} | |||
bearer_token_file: {{bearer_token_file}} | |||
ssl.verification_mode: {{ssl.verification_mode}} | |||
{{/if}} | |||
|
|||
condition: ${kubernetes.pod.labels.{{~controller_manager_label_key~}} } == '{{controller_manager_label_value}}' |
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.
Cool, handlebars is processed before the config 👍
…nd scheduler data streams (elastic#1324) * Add condition to leverage kubernetes provider for controllermanager and scheduler data streams * Allow users to change controller manager and scheduler labels
What does this PR do?
This PR adds a condition in controller manager and scheduler data streams so as to leverage kubernetes dynamic provider.
Only agent running on k8s node where
Kube-controller-manager
andKube-scheduler
are also running(control plane) will fetch metrics.Checklist
changelog.yml
file.manifest.yml
file to point to the latest Elastic stack release (e.g.^7.13.0
).How to test this PR locally
elastic-package build
insideintegrations/packages/kubernetes
folderelastic-package stack up --version=7.15.0-SNAPSHOT -v -d
kube-controller-manager
andkube-scheduler
integration. ActivateCollect Kubernetes metrics from Kubernetes Scheduler
andCollect metrics from Kubernetes controller-manager
. Save the integration to the policy and copy the enrolment token of the new policy.FLEET_URL
:"http://fleet-server:8220"
,FLEET_ENROLLMENT_TOKEN
:token from step 5
and set image todocker.elastic.co/beats/elastic-agent:7.15.0-SNAPSHOT
. Apply the manifestskubectl apply -f .
controller-manager
andscheduler
metrics (for examplemetricset=controllermanager
) come only fromagent.name==kind-control-plane
which is the agent running on the node thatcontroller-manager
is running.In a scenario where
controller manager
does not havecomponent=kube-controller-manager
label already set, the user can set a custom label likemy_label=controller
to the running pod and in step 5 can specify in advanced options ofkube-controller-manager
integration the label key and value. After applying the policy the agent running inkind-control-plane
will start fetching metrics from the pod.Screenshots