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

[prometheus-node-exporter] prevent node exporter from being scheduled on fargate or virtual nodes #4736

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mariuskimmina
Copy link

@mariuskimmina mariuskimmina commented Jul 24, 2024

What this PR does / why we need it

This PR prevents node-exporter from being scheduled on fargate

Which issue this PR fixes

Special notes for your reviewer

If my understanding is correct, then for people that have already added this nodeAffinity this would not be a breaking change, it would simply be redundant - but this I am not completely sure about.

Checklist

  • DCO signed
  • Chart Version bumped
  • Title of the PR starts with chart name (e.g. [prometheus-couchdb-exporter])

@mariuskimmina mariuskimmina force-pushed the node-exporter-affinity-not-fargate branch 3 times, most recently from 4c38cbd to 092e199 Compare July 24, 2024 17:29
Copy link
Member

@zeritti zeritti left a comment

Choose a reason for hiding this comment

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

Thank you, @mariuskimmina, for your PR. That would be a useful change for users of mixed EKS clusters. Similarly in AKS with virtual nodes (type: virtual-kubelet) which could also be supported in your change.

Now, affinity is a user settable field and may already include nodeAffinity. In your current implementation, the field would eventually get overwritten by the user's nodeAffinity. Both user's configuration and the template's field have to be merged. I'd suggest using a helper template for the purpose.

The other option is inserting the field directly in the values file's affinity. You probably meant to do this. Personally, I'd prefer doing it as described above, though.

@mariuskimmina mariuskimmina force-pushed the node-exporter-affinity-not-fargate branch from 2c75a3b to 3ba3825 Compare July 24, 2024 20:53
@mariuskimmina
Copy link
Author

Hey @zeritti, thanks for taking the time to look at it.

I updated the PR with a template approach now.
So far I've only tested it using helm template prometheus-node-exporter ./prometheus-node-exporter so the default value is working fine, I haven't tested the merging with user defined nodeAffinity yet.

@mariuskimmina mariuskimmina force-pushed the node-exporter-affinity-not-fargate branch from 3ba3825 to 18e1ef3 Compare July 24, 2024 21:11
@mariuskimmina mariuskimmina requested a review from a team as a code owner July 24, 2024 21:11
@mariuskimmina mariuskimmina force-pushed the node-exporter-affinity-not-fargate branch from 18e1ef3 to b59179d Compare July 24, 2024 21:12
@mariuskimmina
Copy link
Author

I found the Azure one you were talking about, my only concern here is that key: type seems so generic. If you want to I am fine with adding this as a default as well.

  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
          - matchExpressions:
            - key: type
              operator: NotIn
              values:
                - virtual-kubelet

@mariuskimmina mariuskimmina force-pushed the node-exporter-affinity-not-fargate branch 3 times, most recently from 267eb4a to 99d1fe2 Compare July 25, 2024 18:41
@mariuskimmina
Copy link
Author

Added the Azure version and tested a few more cases, let me know what you think @zeritti

@mariuskimmina mariuskimmina changed the title [prometheus-node-exporter] prevent node exporter from running on fargate [prometheus-node-exporter] prevent node exporter from being scheduled on fargate or virtual nodes Jul 25, 2024
@mariuskimmina mariuskimmina force-pushed the node-exporter-affinity-not-fargate branch from 99d1fe2 to df8fd48 Compare July 31, 2024 05:56
@mariuskimmina mariuskimmina force-pushed the node-exporter-affinity-not-fargate branch from df8fd48 to e6afc7d Compare July 31, 2024 10:06
zanhsieh
zanhsieh previously approved these changes Jul 31, 2024
Copy link
Member

@monotek monotek left a comment

Choose a reason for hiding this comment

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

i don't see why is this needed if there is already a generic solution available.

@mariuskimmina
Copy link
Author

i don't see why is this needed if ther is already a genric solution available.

It's a common problem for people that run EKS with a mixture of Fargate and EC2 nodes, as seen by the number of opened issues around this in the past. I think this would be a sane default configuration to provide that can safe some people the trouble of having to search for this and then add it themselves.

zanhsieh
zanhsieh previously approved these changes Aug 22, 2024
@mariuskimmina
Copy link
Author

Any more thought on this @monotek @zeritti @zanhsieh ?

I think adding this as default value would save quite a few people the time of having to search for this and add it themselves. I think if you are using a mixture of EC2 nodes and Fargate you'll always want to have this nodeAffinity and if you are not using Fargate it shouldn't have any negative impact either.

@mariuskimmina mariuskimmina force-pushed the node-exporter-affinity-not-fargate branch from d043a15 to d8cc0fb Compare October 24, 2024 06:57
@mariuskimmina
Copy link
Author

Any update @monotek @zeritti @zanhsieh ?
Since the issue #4735 got some support I wanted to bring this topic up again.

Any more thought on this @monotek @zeritti @zanhsieh ?

I think adding this as default value would save quite a few people the time of having to search for this and add it themselves. I think if you are using a mixture of EC2 nodes and Fargate you'll always want to have this nodeAffinity and if you are not using Fargate it shouldn't have any negative impact either.

… on fargate or virtual nodes

Signed-off-by: Marius Kimmina <[email protected]>
@mariuskimmina mariuskimmina force-pushed the node-exporter-affinity-not-fargate branch from d8cc0fb to 85c815e Compare October 24, 2024 07:32
@z0rc
Copy link

z0rc commented Nov 6, 2024

i don't see why is this needed if there is already a generic solution available.

There is no generic solution available. Proposed change collects solution that proved to be working. It's better than encourage everyone to copy-paste some values from comment hidden deep in pile of github issues.

@monotek monotek requested review from monotek and removed request for monotek November 6, 2024 18:05
@monotek
Copy link
Member

monotek commented Nov 6, 2024

I let this decisson to the maintainers of the chart...

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

Successfully merging this pull request may close these issues.

[prometheus-node-exporter] Prevent node exporter from being scheduled on fargate
5 participants