Is there a supported/reccomended way to set these limits for control plane components such as kube-apiserver?
Yes, you can use kubeadm init
with patches
command line flag. Look at this github page. The documentation of this thing could be also interested. See also official documentation: Customizing the control plane with patches:
Kubeadm allows you to pass a directory with patch files to InitConfiguration
and JoinConfiguration
on individual nodes. These patches can be used as the last customization step before the control plane component manifests are written to disk.
You can pass this file to kubeadm init
with --config <YOUR CONFIG YAML>
:
apiVersion: kubeadm.k8s.io/v1beta3
kind: InitConfiguration
patches:
directory: /home/user/somedir
Here's example how to set resources on kube-apiserver:
Create kube-apiserver.yaml
file in some directory (e.g. /home/user/patches
) with following contents:
spec:
containers:
- name: kube-apiserver
resources:
requests:
memory: 512Mi
limits:
memory: 1024Mi
Then use --patches flag every time during node upgrade: use kubeadm upgrade node --patches /home/user/patches/
or kubeadm upgrade apply v1.22.4 --patches /home/user/patches/
The other option will be supply extra flags to control-plane components. For this, check this guide: Customizing the control plane with flags in ClusterConfiguration:
The kubeadm ClusterConfiguration
object exposes a way for users to override the default flags passed to control plane components such as the APIServer, ControllerManager, Scheduler and Etcd. The components are defined using the following structures:
apiServer
controllerManager
scheduler
etcd