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

Function of adding taints for node pool #1102

Closed
BigBrather opened this issue Dec 28, 2023 · 9 comments
Closed

Function of adding taints for node pool #1102

BigBrather opened this issue Dec 28, 2023 · 9 comments

Comments

@BigBrather
Copy link

BigBrather commented Dec 28, 2023

/kind feature

Describe the solution you'd like

I want to be able to set taints for my node pools so that it is possible to more correctly distribute the load on the K8s Cluster.

So you can do something like this:

taints:
  - key: service
    value: "true"
    effect: NoExecute

Anything else you would like to add:

If I understand correctly. Is there no such possibility now?

Environment:

  • cluster-api-provider-hetzner version: v1.0.0-beta.27
  • Kubernetes version: (use kubectl version): v1.28.4
  • OS (e.g. from /etc/os-release):
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
@kranurag7
Copy link
Contributor

Hey @BigBrather thanks for the issue.
As of now, propagating taints and annotations is not supported. Only propagation of labels is supported.
Please check kubernetes-sigs/cluster-api#7409

@BigBrather
Copy link
Author

Hi @kranurag7, thanks for the reply.

But it's not entirely clear how this works for me.

I didn’t find an example of this implementation that would help me do this in my *.yaml file for the K8s cluster.

Which creatures should this be assigned to in order for it to be displayed for my node pool?

@kranurag7
Copy link
Contributor

Hey @BigBrather
For now, you'll not be able to propagate annotations and taints to nodes.

If you're interested in propagating labels, then you can use the templates provided in this repo. The templates are inside the templates/cluster-templates directory.
The best way would be using this make target make create-workload-cluster-hcloud after setting the environment variables.
You can also use kustomize build templates/cluster-templates/hcloud --load-restrictor LoadRestrictionsNone and pipe it to your editor and check the manifests and set the values according to your requirement.

Also, read this convention on what labels are allowed to be propagated to the node.
https://cluster-api.sigs.k8s.io/developer/architecture/controllers/metadata-propagation#machine

From Cluster API docs:

Label should meet one of the following criterias to propagate to Node:
Has node-role.kubernetes.io as prefix.
Belongs to node-restriction.kubernetes.io domain.
Belongs to node.cluster.x-k8s.io domain.

The labels you want to propagate should follow the above criteria.

For example, if you want to propagate your node pool information to the nodes something like node-role.kubernetes.io/nodepool=test-md-0
For propagating this label above to the nodes, you'll have to add this label inside MachineDeployment object. You will have to add it under .spec.template.metadata.labels

@BigBrather
Copy link
Author

Thank you very much @kranurag7! This helped me solve the problem with setting labels for my node pools, also thanks for the links to the documentation.

@BigBrather
Copy link
Author

@kranurag7 I hope to see support for taints and annotations in the future. This would be useful not only for me.

@kranurag7
Copy link
Contributor

kranurag7 commented Dec 28, 2023

@BigBrather, I'm glad that you were able to get the labels on the nodes.
Taints and annotations are something that will be supported in upstream cluster-API repo first.
Whenever it will be supported, we will update our templates.

In general, this repo is an infra-provider implementation for Hetzner, and controllers in this repo deal with provisioning of resources in HetznerCloud and managing their state.
Propagation of annotations and taints will be handled by cluster API controllers.

@janiskemper
Copy link
Contributor

I think this is solved:
@BigBrather you can go to the upstream Cluster API project to stress your point!

@BigBrather
Copy link
Author

@kranurag7 Yes, I understand you. Thanks for the info!

@BigBrather
Copy link
Author

@janiskemper Yes, the issue can be considered resolved.

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

3 participants