feat: add --kubelet-args to scheduler-k3s:initialize
The server node created by `scheduler-k3s:initialize` had no way to receive kubelet arguments, unlike nodes joined through `scheduler-k3s:cluster:add` or configured via `scheduler-k3s:profiles:add`. This meant settings such as `allowed-unsafe-sysctls` were unreachable on a single-node install.
This commit is contained in:
7 files changed
+176
-36
No files matched your search
@@ -174,7 +174,7 @@ func CommandLabelsReport(appName string, format string, processType string, reso
|
||||
}
|
||||
|
||||
// CommandInitialize initializes a k3s cluster on the local server
|
||||
func CommandInitialize(ingressClass string, serverIP string, taintScheduling bool) error {
|
||||
func CommandInitialize(ingressClass string, serverIP string, taintScheduling bool, kubeletArgs []string) error {
|
||||
if ingressClass != "nginx" && ingressClass != "traefik" {
|
||||
return fmt.Errorf("Invalid ingress-class: %s", ingressClass)
|
||||
}
|
||||
@@ -308,40 +308,15 @@ func CommandInitialize(ingressClass string, serverIP string, taintScheduling boo
|
||||
}
|
||||
nodeName = strings.ReplaceAll(strings.ToLower(fmt.Sprintf("ip-%s-%s", nodeName, fmt.Sprintf("%X", b))), ".", "-")
|
||||
|
||||
args := []string{
|
||||
// initialize the cluster
|
||||
"--cluster-init",
|
||||
// disable local-storage
|
||||
"--disable", "local-storage",
|
||||
// disable traefik so it can be installed separately
|
||||
"--disable", "traefik",
|
||||
// expose etcd metrics
|
||||
"--etcd-expose-metrics",
|
||||
// use wireguard for flannel
|
||||
"--flannel-backend=wireguard-native",
|
||||
// bind controller-manager to all interfaces
|
||||
"--kube-controller-manager-arg", "bind-address=0.0.0.0",
|
||||
// bind proxy metrics to all interfaces
|
||||
"--kube-proxy-arg", "metrics-bind-address=0.0.0.0",
|
||||
// bind scheduler to all interfaces
|
||||
"--kube-scheduler-arg", "bind-address=0.0.0.0",
|
||||
// gc terminated pods
|
||||
"--kube-controller-manager-arg", "terminated-pod-gc-threshold=10",
|
||||
// specify the node name
|
||||
"--node-name", nodeName,
|
||||
// allow access for the dokku user
|
||||
"--write-kubeconfig-mode", "0644",
|
||||
// specify a token
|
||||
"--token", token,
|
||||
}
|
||||
if taintScheduling {
|
||||
args = append(args, "--node-taint", "CriticalAddonsOnly=true:NoSchedule")
|
||||
}
|
||||
|
||||
common.CommandPropertySet("scheduler-k3s", "--global", "ingress-class", ingressClass, DefaultProperties, GlobalProperties)
|
||||
if ingressClass == "nginx" {
|
||||
args = append(args, "--disable", "traefik")
|
||||
}
|
||||
|
||||
args := initializeInstallerArgs(InitializeInstallerArgsInput{
|
||||
IngressClass: ingressClass,
|
||||
KubeletArgs: kubeletArgs,
|
||||
NodeName: nodeName,
|
||||
TaintScheduling: taintScheduling,
|
||||
Token: token,
|
||||
})
|
||||
|
||||
common.LogInfo2Quiet("Running k3s installer")
|
||||
installerCmd, err := common.CallExecCommand(common.ExecCommandInput{
|
||||
|
||||
Reference in new issue
Block a user