PyratLabs / ansible-role-k3s

Ansible role for installing k3s as either a standalone server or HA cluster.
BSD 3-Clause "New" or "Revised" License
640 stars 135 forks source link

Let auto deploying manifest also work in single master #132

Closed stevefan1999-personal closed 3 years ago

stevefan1999-personal commented 3 years ago

Summary

Allow k3s_server_manifests_urls and k3s_server_manifests_templates to also work when there is only one master.

aka readjust the wording: Variable Description Default Value
k3s_server_manifests_urls A list of URLs (w/ url and filename) to deploy on the primary/sole control plane. []
k3s_server_manifests_templates A flat list of templates to deploy on the primary/sole control plane. []

Issue Type

Prefacing Information

I used one master first because of my current job requirement, I completely understood this kind of situation would require the unsafe option open (aka k3s_use_unsupported_config).

Unfortunately, I cannot convince my supervisor to not think this kind of master-worker, old world kind of mindset and instead to embrace the HA frame of mind. You can't really say it is my fault as this is completely avoidable (if I have a better speech skill of course)

And there is a slight benefit of using one master initially: you can extend the node when you have more resources in the future (so jump from 1 to 3). I'm currently facing such situation (the department decided to buy the worst possible hardware, aka Intel and QLC SSDs with a lot of money) so I gotta say I want a break too.

User Story

There is a slight misunderstanding to me on when will the server manifests be installed.

I originally intended this to be a bug, but after some critical thinking I do see there is a reason why the manifests are not installed:

  1. k3s_server_manifests_urls and k3s_server_manifests_templates will be deployed on the primary control plane.
  2. Since there is only one master, there is no need to distinguish primary node at all, because that sole node is implicitly the primary node
  3. Therefore, the server manifests are obviously not installed when you have only one master.

The current workaround, humorously, is to use more than one masters, then we will have the need to set a primary master.

This is a bug and not a bug at the same time: it's philosophically complicated.

xanmanning commented 3 years ago

This is a bug and not a bug at the same time: it's philosophically complicated.

😂

In the strictest terms, a single master node is the primary control node because there cannot possibly be any other nodes 🙄 - the code will automatically delegate this to the single node. Basically the "master" that bootstraps the control plane is the primary - be it part of a 1 node cluster or a 200 node cluster.

cc: @onedr0p

onedr0p commented 3 years ago

It sounds like the bug here is that k3s_primary_control_node is not set at runtime when there's only one master?

xanmanning commented 3 years ago

Hopefully it will be fixed in v2.10.4 which will be available on Galaxy shortly.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.