feat: allow specifying kubelet-args when adding a new node to the cluster

Kubelet arguments are useful for specifying settings such as supported sysctl fields.
This commit is contained in:
Jose Diaz-Gonzalez committed 2025-11-16 23:53:02 -05:00
1 parent f38d8cfadb
commit f33d3d852f
2 files changed
+7 -2

No files matched your search

+5 -1
View File
@@ -400,7 +400,7 @@ func CommandInitialize(ingressClass string, serverIP string, taintScheduling boo
}
// CommandClusterAdd adds a server to the k3s cluster
func CommandClusterAdd(role string, remoteHost string, serverIP string, allowUknownHosts bool, taintScheduling bool) error {
func CommandClusterAdd(role string, remoteHost string, serverIP string, allowUknownHosts bool, taintScheduling bool, kubeletArgs map[string]string) error {
if err := isK3sInstalled(); err != nil {
return fmt.Errorf("k3s not installed, cannot add node to cluster: %w", err)
}
@@ -665,6 +665,10 @@ export INSTALL_K3S_VERSION=%s
args = append(args, "--node-taint", "CriticalAddonsOnly=true:NoSchedule")
}
for key, value := range kubeletArgs {
args = append(args, "--kubelet-arg", fmt.Sprintf("%s=%s", key, value))
}
common.LogInfo2Quiet(fmt.Sprintf("Adding %s k3s cluster", nodeName))
joinCmd, err := common.CallSshCommand(common.SshCommandInput{
Command: "/tmp/k3s-installer-executor.sh",