I will try to address both of your questions.
1. Add --cloud-provider=external kubelet startup flag on all nodes
Where is this .NodeRegistration.KubeletExtraArgs and how do I change
it for all nodes in the cluster?
KubeletExtraArgs
are any arguments and parameters supported by kubelet. They are documented here. You need to use the kubelet
command with a proper flags in order to modify it. Also, notice that the flag you are about to use is going to be removed in k8s v1.23:
--cloud-provider string
The provider for cloud services. Set to
empty string for running with no cloud provider. If set, the cloud
provider determines the name of the node (consult cloud provider
documentation to determine if and how the hostname is used).
(DEPRECATED: will be removed in 1.23, in favor of removing cloud
provider code from Kubelet.)
EDIT:
To better address your question regarding: .NodeRegistration.KubeletExtraArgs
These are also elements of the kubeadm init configuration file:
It's possible to configure kubeadm init
with a configuration file
instead of command line flags, and some more advanced features may
only be available as configuration file options. This file is passed
using the --config
flag and it must contain a ClusterConfiguration
structure and optionally more structures separated by ---\n
Mixing
--config
with others flags may not be allowed in some cases.
You can also find more details regarding the NodeRegistrationOptions as well as more information on the fields and usage of the configuration.
Also, note that:
KubeletExtraArgs
passes through extra arguments to the kubelet. The
arguments here are passed to the kubelet command line via the
environment file
kubeadm writes at runtime for the kubelet to source. This overrides
the generic base-level configuration in the kubelet-config-1.X
ConfigMap
Flags have higher priority when parsing. These values are local and
specific to the node kubeadm is executing on.
EDIT2:
kubeadm init
is supposed to be used only once when creating a cluster whenever you use it with flags or a config file. You cannot change the configs by executing it again with different values. Here you will find info regarding kubeadm and it's usage. Once the cluster is setup kubeadm should be dropped and changes be made directly to the static pod manifests.
2. Change the --service-cidr due to network requirements
This is more complicated. You could try to do this similarly like here or here but that approach is prone to mistakes and rather not recommended.
The more feasible and safer way would be to simply recreate the cluster with kubeadm reset
and kubeadm init --service-cidr
. The option to automatically change the CIDRs was not even expected from the Kubernetes perspective. So in short, the kubeadm reset is the way to go here.
The error log has your answer:
failed to run Kubelet: misconfiguration: kubelet cgroup driver: "systemd" is different from docker cgroup driver: "cgroupfs""
See Kubernetes documentation on how to configure acgroup driver
Best Answer
Short answer: No, it is not possible.
Yes, that will be the solution to this situation. If you find your own solution, feel free to write it as an answer.
As a workaround, you can try to create a separate control plane (as in Kubernetes the hard way) and then
kubeadm join
. However, you must also be aware that this type of configuration will be complicated to perform. Look also at this blog page.See also similar topics:
Look also this page about Self-registration of Nodes.
EDIT: I have found another possible workaround.
EDIT2: This tutorial should help you too.