-
Notifications
You must be signed in to change notification settings - Fork 168
add rules and alertmanager sidecar to cortex-helm-chart #150
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 rules and alertmanager sidecar to cortex-helm-chart #150
Conversation
Signed-off-by: eamouhadi <[email protected]>
3a6d686
to
bc385f5
Compare
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.
Missing CHANGELOG.md documentation and please dont bump the version :)
Signed-off-by: eamouhadi <[email protected]>
914cdb1
to
26b71bd
Compare
Hi @amouhadi We just merged #144. Due to the massive refactor you will have to rebase master and make sure that you don't actually add back the old files, since the location changed to a more easily maintainable folder structure So for you should be templates/alertmanager/* and templates/ruler/* Heads-up: We have deleted the role.yaml and the binding since we dropped support for PSP's and the fact that it didn't really do anything else |
Signed-off-by: eamouhadi <[email protected]>
9f303f5
to
8326acd
Compare
Thank you @ShuzZzle, I merged from master and resolved the conflicts. |
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 want to test a few more things, but looks good
Signed-off-by: eamouhadi <[email protected]>
9627888
to
47c6ad3
Compare
hi @ShuzZzle, did you have a chance to test things? |
Signed-off-by: ShuzZzle <[email protected]>
I am super unfimiliar with the concept and I didn't really had time to review it yet. Also it seems to me that some fields in the values.yml (such as "SCProvider") are never actually used? Also how does this work with cortex's multi-tenancy. Everbody would get the same rules/alertmanager configs, right? |
Signed-off-by: eamouhadi <[email protected]>
How it works is that we create rules in configmaps and they automatically get loaded into the ruler by the sidecar container. Same with AlertManager config. For his multi-tenancy question, the configmap defines the tenant that the config ends up in:
|
Ah okay.
Why is that so? Where is the technical difference? |
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.
Can you please recheck the chart? Make sure its actually running properly without adding any custom/extra stuff in your cluster. Maybe share a very minimalistic cortex configuration so people can very easily test it out.
Also the role binding is unfortunately missing
The Ruler allows you to pass static rules to it in a certain location. When it starts up, the Ruler consumes all the rules in that location (and continues polling it over time) and inserts them into its live rule config that it manages in a separate location. AlertManager is simpler--it consumes config from a single location. |
Signed-off-by: eamouhadi <[email protected]>
@gburton1 @amouhadi |
Signed-off-by: eamouhadi <[email protected]>
Added rolebinding.yaml :) |
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.
Can you please share a minimalistic cortex configuration with a configured sidecar? We have a very minimalistic working example in the ci folder of this repo where you can get started.
Signed-off-by: eamouhadi <[email protected]>
Cortex config:
Helm chart override values:
Config map with a rule:
|
Signed-off-by: ShuzZzle <[email protected]>
405cc9f
to
7002158
Compare
… labels Signed-off-by: ShuzZzle <[email protected]>
Signed-off-by: eamouhadi <[email protected]>
Signed-off-by: eamouhadi <[email protected]>
Signed-off-by: eamouhadi <[email protected]>
Signed-off-by: eamouhadi <[email protected]>
Signed-off-by: ShuzZzle <[email protected]>
I have tried to incorporate the Alertmanager sidecar for configuration but the sidecar container is throwing the following error I have deployed the ConfigMap to the same namespace. This is on AWS EKS version 1.19: [2022-01-04 23:23:00] MaxRetryError when calling kubernetes: HTTPConnectionPool(host='localhost', port=80): Max retries exceeded with url: /api/v1/namespaces/cortex/configmaps?labelSelector=app%3Dcortex-alertmanager&watch=True (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7f40ed3040>: Failed to establish a new connection: [Errno 111] Connection refused')) Following is my ConfigMap yaml: apiVersion: v1
|
We have been running the AlertManager and Ruler sidecar configurations in production for a while now. |
Right, but how can I control the kube API url that the sidecar is constructing? Is there a values.yaml entry I should be setting for this in addition to the sidecar section? I am using cortex helm chart version 1.2.0. Following is my values.yaml snippet for Alertmanager sidecar: alertmanager: |
it looks like the issue with the localhost:80 is with a bug in the kiwigrid/k8s-sidecar image tag 1.10.1 (kiwigrid/k8s-sidecar#114) I updated the tag value in my values.yaml to 1.11.1 and that resolved the kube api url issue however: now I am getting a permission denied error when the ConfigMap is downloaded and the sidecar is trying to store it in the data folder: [2022-01-05 02:04:35] Working on ADDED configmap cortex/cortex-alertmanager I've tried changing the following values in the values.yaml but neither seem to resolve the permission denied error: alertmanager: |
This PR uses the same pattern that the official Grafana chart uses to dynamically configure dashboards and datasources and notifier.
I tested adding both rules and alertmanager sidecar on my fork and it successfully discovered the rules and alertmanager config and got added to ruler and alertmanager.
The ConfigMaps can be put in the specified namespace and they are automatically detected and added as files to Ruler and/or AlertManager containers. This will allow easy and extensible configuration that avoids having to store state in the Cortex system itself.
This feature is disabled by default and below is an example of how it can be enabled in values.yaml