0

Very new to k8s. I need to update the startup params passed to api-server, but no idea what's the correct way to do it.

I installed the control plane with kubeadm init.

On the master I can see the params in /etc/kubernetes/manifests/kube-apiserver.yaml. Do I just edit that file and force a reload somehow?

AlanG
  • 53
  • 4

2 Answers2

1

OK, so based on Where is kube-apiserver located this does seem to be the correct method.

Once the yaml config has been updated it automagically triggers a reload of the pod. In my case I introduced an error into the configuration which caused the pod to constantly cycle.

I eventually found the logs in /var/log/pods/kube-system_kube-apiserver* and was able to identify and correct the error.

AlanG
  • 53
  • 4
1

kube-apiserver runs as a static pod on master node and static pod definition files are available at a path defined by parameter called staticPodPath which is present in file /var/lib/kubelet/config.yaml. In my case, it's like this:

staticPodPath: /etc/kubernetes/manifests

You can make changes to pod definition file at that path which is kube-apiserver.yaml and changes will take effect on their own. Static pods like kube-apiserver are controlled by kubelets and these pods are recreated by Kubelet in case of any changes to pod definition file.

Avnish Gupta
  • 103
  • 1
  • 8
  • Just a warning to others: don't have your backup yaml in the manifests directory. I created .bak file then edited my apiserver config. The pod duly restarted but the new config was not picked up. It seems the kubelet scans ALL files in the directory and my .bak file was scanned and overwrote my desired changes. That's 2 hours I'll never get back :( – Andy Brown May 25 '22 at 10:45