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

ServiceMonitor also selects Clickhouse Nodes #1350

Open
derbauer97 opened this issue Feb 20, 2024 · 4 comments
Open

ServiceMonitor also selects Clickhouse Nodes #1350

derbauer97 opened this issue Feb 20, 2024 · 4 comments
Assignees

Comments

@derbauer97
Copy link

derbauer97 commented Feb 20, 2024

Hey,

i noticed when i use the ServiceMonitor in the HelmChart also the clickhouse nodes are selected. So Prometheus tries to scrape them on Port 8888 and Port 9999 which leads to an connection refused.

As far as i understand it is not intentend to scrape the Clickhouse Nodes directly but the clickhouse-operator which provides the metrics. My dashboard is already filled with the correct metrics but i get TargetDown Alerts which i want to fix.

I think it is because the Clickhouse Nodes is:

spec:
  endpoints:
  - port: clickhouse-metrics
  - port: operator-metrics
  selector:
    matchLabels:
      app.kubernetes.io/instance: clickhouse
      app.kubernetes.io/name: altinity-clickhouse-operator

i think the issue is that the Operator and the Clickhouse Services both have the same labels and therefore get picked up by the ServiceMonitor.

@Slach
Copy link
Collaborator

Slach commented Feb 20, 2024

how exactly do you install your kind: ClickHouseInstallation manifest?

did you use values.yaml something like that?

serviceMonitor:
  enabled: true
additionalResources:
 - |
   apiVersion: clickhouse.altinity.com/v1
   kind: ClickHouseInstallation
   metatada:
    ...
   spec:   
    ... 

@derbauer97
Copy link
Author

Yes i pass it via additionalResources.

@Slach
Copy link
Collaborator

Slach commented Feb 20, 2024

In clickhouse-operator deployment, 8888 port used for export metrics related to clickhouse-server and these metrics exported by metrics-exporter container which scrape your clickhouse-server nodes via SQL HTTP queries, and 9999 port contains metrics related to clickhouse-operator itself, which exported by clickhouse-operator container

Why do you ensure your clickhouse-server related pods contains the same labels which present in matchLabels in your ServiceMonitor?

@derbauer97
Copy link
Author

derbauer97 commented Feb 20, 2024

I do not pass any additional Labels i think the labels are passed via helm by default but i am not 100% Sure. So since the ClickhouseInstalltion is part of the Clickhouse-Operator the labels are passed automatically. So i think when i is suggested to pass Clickhouse Installtion via .additionalResources the Clickhouse Metrics Service should have another Selector than only the helm default labels?

https://github.com/Altinity/clickhouse-operator/blob/master/deploy/helm/templates/_helpers.tpl#L49

We could include an existing label like: clickhouse.altinity.com/chop=0.23.2 which is unique for the clickhouse-operator pod or implement an completly new label which not relys on the helm defaults.

@Slach Slach self-assigned this Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants