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

Conversation

mariuskimmina
Copy link
Contributor

@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
Contributor 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
Contributor 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
Contributor 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 requested a review from zeritti July 31, 2024 05:57
@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
Contributor 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.

@mariuskimmina mariuskimmina force-pushed the node-exporter-affinity-not-fargate branch 2 times, most recently from ccef119 to e130137 Compare August 16, 2024 17:34
zanhsieh
zanhsieh previously approved these changes Aug 22, 2024
@mariuskimmina
Copy link
Contributor 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
Contributor 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.

@mariuskimmina mariuskimmina force-pushed the node-exporter-affinity-not-fargate branch from d8cc0fb to 85c815e Compare October 24, 2024 07:32
zanhsieh
zanhsieh previously approved these changes Oct 30, 2024
@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...

@BobDu
Copy link
Contributor

BobDu commented Nov 27, 2024

Given the extensive use of EKS and AKS, offering more out-of-the-box default configurations would be a better option.

At least theoretically, it wouldn't cause any inconvenience to users who do not use these two services, right?

@monotek monotek requested review from monotek and removed request for monotek November 27, 2024 17:43
@monotek monotek dismissed their stale review November 27, 2024 17:44

let maintainers decide

@monotek monotek removed their request for review November 27, 2024 17:44
… on fargate or virtual nodes

Signed-off-by: Marius Kimmina <[email protected]>
@mariuskimmina
Copy link
Contributor Author

Any update on this @zeritti @zanhsieh ?

Just rebased and bumped the chart version again.
So far it seems as time goes on only more people are in favor of this.

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.

Since there is no indication of the default hard node affinity in the values file, please, enter a comment at the affinity field saying that the default node affinity excludes Fargate nodes and virtual kubelets from scheduling unless overriden by hard node affinity set in the field.

charts/prometheus-node-exporter/Chart.yaml Outdated Show resolved Hide resolved
@mariuskimmina
Copy link
Contributor Author

mariuskimmina commented Dec 14, 2024

Thanks again for reviewing @zeritti
I added the requested comment to the affinity field and bumped the minor version instead

Signed-off-by: zeritti <[email protected]>
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.

LGTM

@monotek monotek merged commit 9d47719 into prometheus-community:main Dec 14, 2024
4 checks passed
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
6 participants