custom --kubelet-extra-args overwrite privateInterface setting
when defining both, a privateInterface and --kubelet-extra-args in installFlags, 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:
- k0sctl would automagically merge the kubelet-extra-args it deducts by itself from predefined parameters like
privateInterfaceand the ones defined by the user from theinstallFlag(or rather even a new separatekubeletExtraArgsflag to make the merging easier?) k0s worker&k0s controllerwould 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)
I think it would be nice to have a dedicated option for user-specified kubelet-extra-args, so that k0sctl can internally merge them.
K0sctl writing two separate extra args is definitely a bug if that happens.