Add apiserver extraArgs/extraVolumes in a live cluster

2/19/2021

I have a Kubernetes cluster 1.17, and I want to add some extraArgs and extraVolumes (like in https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/) in the apiserver. Usually, I update the manifest file /etc/kubernetes/manifests/kube-apiserver.yaml to apply my new config, then I update the kubeadm-config ConfigMap to keep this new configuration for the next Kubernetes upgrade (because static pod manifests are re-generated from this ConfigMap when upgrading).

Is it possible to update only the kubeadm-config ConfigMap then apply the configuration with a command like kubeadm init phase control-plane apiserver ? What are the risks ?

-- Antoine
kube-apiserver
kubernetes
kubernetes-apiserver

2 Answers

3/4/2021

That's the way to go to upgrade static pod definitions of control plane components, but instead of init command I guess you meant upgrade.

$ kubeadm upgrade command consults each time current cluster configuration from ConfigMap ($ kubectl -n kube-system get cm kubeadm-config -o yaml) before applying changes.

Talking about risks, you can try to envision them by studying output of kubeadm upgrade diff command, e.g.

kubeadm upgrade diff v1.20.4. More details in this documentation. You could also try to use --dry-run flag from this doc. It won't change any state, it will display the actions that would be performed.

As addition, you could also read about --experimental-patches from this docs

-- PjoterS
Source: StackOverflow

7/12/2021

If you mean change the apiserver config in a live cluster,you can change /etc/kubernetes/manifest/kubeadm-apiserver.conf to apply.

But you must be careful becouse the old static pod will be killed before the new pod ready.

-- zh h
Source: StackOverflow