--- reviewers: - mikedanese - luxas - jbeda title: kubeadm init content_template: templates/concept weight: 20 --- {{% capture overview %}} This command initializes a Kubernetes master node. {{% /capture %}} {{% capture body %}} {{< include "generated/kubeadm_init.md" >}} ### Init workflow {#init-workflow} `kubeadm init` bootstraps a Kubernetes master node by executing the following steps: 1. Runs a series of pre-flight checks to validate the system state before making changes. Some checks only trigger warnings, others are considered errors and will exit kubeadm until the problem is corrected or the user specifies `--skip-preflight-checks`. 1. Generates a self-signed CA (or using an existing one if provided) to set up identities for each component in the cluster. If the user has provided their own CA cert and/or key by dropping it in the cert directory configured via `--cert-dir` (`/etc/kubernetes/pki` by default) this step is skipped as described in the [Using custom certificates](#custom-certificates) document. 1. Writes kubeconfig files in `/etc/kubernetes/` for the kubelet, the controller-manager and the scheduler to use to connect to the API server, each with its own identity, as well as an additional kubeconfig file for administration named `admin.conf`. 1. If kubeadm is invoked with `--feature-gates=DynamicKubeletConfig` enabled, it writes the kubelet init configuration into the `/var/lib/kubelet/config/init/kubelet` file. See [Set Kubelet parameters via a config file](/docs/tasks/administer-cluster/kubelet-config-file/) and [Reconfigure a Node's Kubelet in a Live Cluster](/docs/tasks/administer-cluster/reconfigure-kubelet/) for more information about Dynamic Kubelet Configuration. This functionality is now by default disabled as it is behind a feature gate, but is expected to be a default in future versions. 1. Generates static Pod manifests for the API server, controller manager and scheduler. In case an external etcd is not provided, an additional static Pod manifest are generated for etcd. Static Pod manifests are written to `/etc/kubernetes/manifests`; the kubelet watches this directory for Pods to create on startup. Once control plane Pods are up and running, the `kubeadm init` sequence can continue. 1. If kubeadm is invoked with `--feature-gates=DynamicKubeletConfig` enabled, it completes the kubelet dynamic configuration by creating a ConfigMap and some RBAC rules that enable kubelets to access to it, and updates the node by pointing `Node.spec.configSource` to the newly-created ConfigMap. This functionality is now by default disabled as it is behind a feature gate, but is expected to be a default in future versions. 1. Apply labels and taints to the master node so that no additional workloads will run there. 1. Generates the token that additional nodes can use to register themselves with the master in the future. Optionally, the user can provide a token via `--token`, as described in the [kubeadm token](/docs/reference/setup-tools/kubeadm/kubeadm-token/) docs. 1. Makes all the necessary configurations for allowing node joining with the [Bootstrap Tokens](/docs/admin/bootstrap-tokens/) and [TLS Bootstrap](/docs/admin/kubelet-tls-bootstrapping/) mechanism: - Write a ConfigMap for making available all the information required for joining, and set up related RBAC access rules. - Let Bootstrap Tokens access the CSR signing API. - Configure auto-approval for new CSR requests. See [kubeadm join](/docs/reference/setup-tools/kubeadm/kubeadm-join/) for additional info. 1. Installs the internal DNS server (kube-dns) and the kube-proxy addon components via the API server. If kubeadm is invoked with --feature-gates=CoreDNS=true, then [CoreDNS](https://coredns.io/) will be installed as the default internal DNS server instead of kube-dns. Please note that although the DNS server is deployed, it will not be scheduled until CNI is installed. 1. If `kubeadm init` is invoked with the alpha self-hosting feature enabled, (`--feature-gates=SelfHosting=true`), the static Pod based control plane is transformed into a [self-hosted control plane](#self-hosting). ### Using kubeadm init with a configuration file {#config-file} {{< caution >}} **Caution:** The config file is still considered alpha and may change in future versions. {{< /caution >}} 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 in the `--config` option. ```yaml apiVersion: kubeadm.k8s.io/v1alpha1 kind: MasterConfiguration api: advertiseAddress: controlPlaneEndpoint: bindPort: etcd: endpoints: - - caFile: certFile: keyFile: dataDir: extraArgs: : : image: serverCertSANs: - - peerCertSANs: - - kubeProxy: config: mode: bindAddress: clusterCIDR: networking: dnsDomain: serviceSubnet: podSubnet: kubernetesVersion: cloudProvider: nodeName: authorizationModes: - - token: tokenTTL: