-
-
Notifications
You must be signed in to change notification settings - Fork 362
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
[Feature] Add the ability to set custom k3s agent
args
#862
[Feature] Add the ability to set custom k3s agent
args
#862
Conversation
57949da
to
5ad108e
Compare
Very good and useful feature, I hope it will be accepted! |
@sambonbonne @clementguillot This seems nice! Merci les amis. @kube-hetzner/core For context: You:I am using k3s Let's say I give this arg to k3s agent: --kubelet-arg kube-reserved=cpu=100m,memory=200Mi,ephemeral-storage=1Gi And also have this kubelet_arg : "cloud-provider=external", "volume-plugin-dir=/var/lib/kubelet/volumeplugins" in the config.yaml file. What will happen, what is the final kubelet-arg considered by k3s? ChatGPT:In k3s, you can specify kubelet arguments in two ways:
In your case, you are providing kubelet arguments through both methods. The way k3s processes these arguments is that it will combine both sets of arguments into a final set that gets passed to the kubelet. If there are conflicting arguments (i.e., the same argument specified in both the command line and the config file), the value from the command line takes precedence. This is typical behavior in many systems where command-line arguments override configuration file settings. So, in your case:
These arguments will be merged and passed to the kubelet. Remember, if there is a conflict between command line and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will leave it another day to give the chance for the team to comment if they want, but looks good to me.
Tanks for the merge 🚀 |
@sambonbonne a bit late to the game, I also wanted something similar, however need it slightly different, namely using double quotes instead of single quotes - "curl ... | ... INSTALL_K3S_EXEC='agent ${var.k3s_exec_agent_args}' sh -"
+ "curl ... | ... INSTALL_K3S_EXEC=\"agent ${var.k3s_exec_agent_args}\" sh -" It would also be great to change it for As this was just merged, I guess no one really uses this yet, so it could still be changed without effecting others. Benefits:
What do you think? |
@schlichtanders I used single quotes because terraform-hcloud-kube-hetzner/locals.tf Line 52 in 357ff14
I'm not really a maintainer of this repository (so don't take my words as an official answer) but I see two disadvantages by changing the single quotes to double quotes:
Maybe a better solution would be to have a specific variable for arbitrary code? |
@schlichtanders Normally " within " will not work, it needs to be different kinds encompassing each other, but there is an alternative which is to use <<EOT ... EOT. If done well, I do not think this will break anything, PR welcome, and FYI GPT-4 is quite good at this stuff lol (if you need a non-human hand). And as @sambonbonne mentioned, if you do submit a PR, please make sure to harmozine |
Hello,
Like we can set the
k3s_exec_server_args
variable for thek3s server
command, I propose to add ak3s_exec_agent_args
variable for thek3s agent
command.I tested it on fixed and autoscaler nodepools, with some
kubelet-arg
(to reserver resources for system and kube) and it works as expected.Let me know if I can improve this PR!