k0sproject / k0sproject/k0sctl
custom --kubelet-extra-args overwrite privateInterface setting
- Dominant language
- Go
- Stars
- 582
- Forks
- 113
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 34
Description
when defining both, a [privateInterface](https://github.com/k0sproject/k0sctl#spechostsprivateinterface-string-optional-default-) and `--kubelet-extra-args` in [installFlags](https://github.com/k0sproject/k0sctl#spechostsinstallflags-sequence-optional), those two clash.
k0sctl writes two separate `--kubelet-extra-args` parameters in `/etc/systemd/system/k0scontroller.service` so it looks like this when e.g. defining an own resolvConf:
`ExecStart=/usr/local/bin/k0s controller --config=/etc/k0s/k0s.yaml --enable-worker=true --kubelet-extra-args=--node-ip=10.10.1.12 --no-taints=true --token-file=/etc/k0s/k0stoken --profile=workarounds --kubelet-extra-args=--resolv-conf=/etc/k0s_resolv.conf`
what happens is that `k0s controller` only picks up the last `--kubelet-extra-args` parameter, hence sth like this is running where the `--node-ip` parameter is missing:
`root 3421769 4.8 0.1 846388 113888 ? Sl 17:12 0:20 /var/lib/k0s/bin/kubelet --bootstrap-kubeconfig=/var/lib/k0s/kubelet-bootstrap.conf --v=1 --cert-dir=/var/lib/k0s/kubelet/pki --node-labels=node.k0sproject.io/role=control-plane --container-runtime-endpoint=unix:///run/k0s/containerd.sock --containerd=/run/k0s/containerd.sock --runtime-cgroups=/system.slice/containerd.service --resolv-conf=/etc/k0s_resolv.conf --config=/var/lib/k0s/kubelet-config.yaml --kubeconfig=/var/lib/k0s/kubelet.conf --root-dir=/var/lib/k0s/kubelet`
(in my case `role: controller+worker`, but i imagine the same would happen with `k0s worker`)
as a workaround you can manually edit the systemd file to merge both parameters like this:
`ExecStart=/usr/local/bin/k0s controller --config=/etc/k0s/k0s.yaml --enable-worker=true --kubelet-extra-args="--node-ip=10.10.1.12 --resolv-conf=/etc/k0s_resolv.conf" --no-taints=true --token-file=/etc/k0s/k0stoken --profile=workarounds`
i see two options here:
1. k0sctl would automagically merge the kubelet-extra-args it deducts by itself from predefined parameters like `privateInterface` and the ones defined by the user from the `installFlag` (or rather even a new separate `kubeletExtraArgs` flag to make the merging easier?)
2. `k0s worker` & `k0s controller` would accept multiple --kubelet-extra-args flags and add them all as a parameter to the kubelet binary (seems like the better option in my simple eyes. in which case this issue probably rather belongs in to the k0s repository but as it occurred to me with k0sctl i thought to post it here first)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.