Customizing control plane configuration with kubeadm

FEATURE STATE: Kubernetes v1.12 [stable]

The kubeadm ClusterConfiguration object exposes the field extraArgs that can override the default flags passed to control plane components such as the APIServer, ControllerManager and Scheduler. The components are defined using the following fields:

  • apiServer
  • controllerManager
  • scheduler

The extraArgs field consist of key: value pairs. To override a flag for a control plane component:

  1. Add the appropriate fields to your configuration.
  2. Add the flags to override to the field.
  3. Run kubeadm init with --config <YOUR CONFIG YAML>.

For more details on each field in the configuration you can navigate to our API reference pages.

Note: You can generate a ClusterConfiguration object with default values by running kubeadm config print init-defaults and saving the output to a file of your choice.

APIServer flags

For details, see the reference documentation for kube-apiserver.

Example usage:

  1. apiVersion: kubeadm.k8s.io/v1beta2
  2. kind: ClusterConfiguration
  3. kubernetesVersion: v1.16.0
  4. apiServer:
  5. extraArgs:
  6. advertise-address: 192.168.0.103
  7. anonymous-auth: "false"
  8. enable-admission-plugins: AlwaysPullImages,DefaultStorageClass
  9. audit-log-path: /home/johndoe/audit.log

ControllerManager flags

For details, see the reference documentation for kube-controller-manager.

Example usage:

  1. apiVersion: kubeadm.k8s.io/v1beta2
  2. kind: ClusterConfiguration
  3. kubernetesVersion: v1.16.0
  4. controllerManager:
  5. extraArgs:
  6. cluster-signing-key-file: /home/johndoe/keys/ca.key
  7. bind-address: 0.0.0.0
  8. deployment-controller-sync-period: "50"

Scheduler flags

For details, see the reference documentation for kube-scheduler.

Example usage:

  1. apiVersion: kubeadm.k8s.io/v1beta2
  2. kind: ClusterConfiguration
  3. kubernetesVersion: v1.16.0
  4. scheduler:
  5. extraArgs:
  6. config: /etc/kubernetes/scheduler-config.yaml
  7. extraVolumes:
  8. - name: schedulerconfig
  9. hostPath: /home/johndoe/schedconfig.yaml
  10. mountPath: /etc/kubernetes/scheduler-config.yaml
  11. readOnly: true
  12. pathType: "File"