You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- It should _not_ favor any particular network provider. Configuring the cluster network is out-of-scope
@@ -76,6 +76,23 @@ in a majority of cases, and the most intuitive location; other constant paths an
76
76
-`front-proxy-ca.crt`, `front-proxy-ca.key` for the front proxy certificate authority
77
77
-`front-proxy-client.crt`, `front-proxy-client.key` for the front proxy client
78
78
79
+
## The kubeadm configuration file format
80
+
81
+
Most kubeadm commands support a `--config` flag which allows passing a configuration file from
82
+
disk. The configuration file format follows the common Kubernetes API `apiVersion` / `kind` scheme,
83
+
but is considered a component configuration format. Several Kubernetes components, such as the kubelet,
84
+
also support file-based configuration.
85
+
86
+
Different kubeadm subcommands require a different `kind` of configuration file.
87
+
For example, `InitConfiguration` for `kubeadm init`, `JoinConfiguration` for `kubeadm join`, `UpgradeConfiguration` for `kubeadm upgrade` and `ResetConfiguration`
88
+
for `kubeadm reset`.
89
+
90
+
The command `kubeadm config migrate` can be used to migrate an older format configuration
91
+
file to a newer (current) configuration format. The kubeadm tool only supports migrating from
92
+
deprecated configuration formats to the current format.
93
+
94
+
See the [kubeadm configuration reference](/docs/reference/config-api/kubeadm-config.v1beta4/) page for more details.
95
+
79
96
## kubeadm init workflow internal design
80
97
81
98
The `kubeadm init` consists of a sequence of atomic work tasks to perform,
@@ -110,7 +127,7 @@ The user can skip specific preflight checks or all of them with the `--ignore-pr
110
127
-[Error] if `/etc/kubernetes/manifest` folder already exists and it is not empty
111
128
-[Error] if swap is on
112
129
-[Error] if `ip`, `iptables`, `mount`, `nsenter` commands are not present in the command path
113
-
-[Warning] if `ebtables`, `ethtool`, `socat`, `tc`, `touch`, `crictl` commands are not present in the command path
130
+
-[Warning] if `ethtool`, `tc`, `touch` commands are not present in the command path
114
131
-[Warning] if extra arg flags for API server, controller manager, scheduler contains some invalid options
115
132
-[Warning] if connection to https://API.AdvertiseAddress:API.BindPort goes through proxy
116
133
-[Warning] if connection to services subnet goes through proxy (only first address checked)
@@ -188,7 +205,7 @@ Please note that:
188
205
Kubeadm generates kubeconfig files with identities for control plane components:
189
206
190
207
- A kubeconfig file for the kubelet to use during TLS bootstrap -
191
-
/etc/kubernetes/bootstrap-kubelet.conf. Inside this file, there is a bootstrap-token or embedded
208
+
`/etc/kubernetes/bootstrap-kubelet.conf`. Inside this file, there is a bootstrap-token or embedded
192
209
client certificates for authenticating this node with the cluster.
193
210
194
211
This client certificate should:
@@ -223,7 +240,15 @@ The `super-admin.conf` file must be stored in a safe location and should not be
223
240
See [RBAC user facing role bindings](/docs/reference/access-authn-authz/rbac/#user-facing-roles)
224
241
for additional information on RBAC and built-in ClusterRoles and groups.
225
242
226
-
Please note that:
243
+
You can run [`kubeadm kubeconfig user`](/docs/reference/setup-tools/kubeadm/kubeadm-kubeconfig/#cmd-kubeconfig-user)
244
+
to generate kubeconfig files for additional users.
245
+
246
+
{{< caution >}}
247
+
The generated configuration files include an embedded authentication key, and you should treat
248
+
them as confidential.
249
+
{{< /caution >}}
250
+
251
+
Also note that:
227
252
228
253
1.`ca.crt` certificate is embedded in all the kubeconfig files.
229
254
1. If a given kubeconfig file exists, and its content is evaluated as compliant with the above specs,
@@ -253,7 +278,7 @@ Static Pod manifests share a set of common properties:
253
278
254
279
- Leader election is enabled for both the controller-manager and the scheduler
255
280
- Controller-manager and the scheduler will reference kubeconfig files with their respective, unique identities
256
-
- All static Pods get any extra flags specified by the user as described in
281
+
- All static Pods get any extra flags or patches that you specify, as described in
257
282
[passing custom arguments to control plane components](/docs/setup/production-environment/tools/kubeadm/control-plane-flags/)
258
283
- All static Pods get any extra Volumes specified by the user (Host path)
259
284
@@ -344,10 +369,6 @@ the users:
344
369
-`--allocate-node-cidrs=true`
345
370
-`--cluster-cidr` and `--node-cidr-mask-size` flags according to the given CIDR
346
371
347
-
- If a cloud provider is specified, the corresponding `--cloud-provider` is specified together
348
-
with the `--cloud-config` path if such configuration file exists (this is experimental, alpha
349
-
and will be removed in a future version)
350
-
351
372
Other flags that are set unconditionally are:
352
373
353
374
-`--controllers` enabling all the default controllers plus `BootstrapSigner` and `TokenCleaner`
@@ -365,7 +386,7 @@ Other flags that are set unconditionally are:
365
386
366
387
#### Scheduler
367
388
368
-
The static Pod manifest for the scheduler is not affected by parameters provided by the users.
389
+
The static Pod manifest for the scheduler is not affected by parameters provided by the user.
369
390
370
391
### Generate static Pod manifest for local etcd
371
392
@@ -389,12 +410,10 @@ Please note that:
389
410
390
411
### Wait for the control plane to come up
391
412
392
-
kubeadm waits (upto 4m0s) until `localhost:6443/healthz` (kube-apiserver liveness) returns `ok`.
393
-
However, in order to detect deadlock conditions, kubeadm fails fast if `localhost:10255/healthz`
394
-
(kubelet liveness) or `localhost:10255/healthz/syncloop` (kubelet readiness) don't return `ok`
395
-
within 40s and 60s respectively.
413
+
On control plane nodes, kubeadm waits up to 4 minutes for the control plane components
414
+
and the kubelet to be available. It does that by performing a health check on the respective
415
+
component `/healthz` or `/livez` endpoints.
396
416
397
-
kubeadm relies on the kubelet to pull the control plane images and run them properly as static Pods.
398
417
After the control plane is up, kubeadm completes the tasks described in following paragraphs.
399
418
400
419
### Save the kubeadm ClusterConfiguration in a ConfigMap for later reference
@@ -518,9 +537,8 @@ deployed as a DaemonSet:
518
537
519
538
#### DNS
520
539
521
-
- The CoreDNS service is named `kube-dns`. This is done to prevent any interruption
522
-
in service when the user is switching the cluster DNS from kube-dns to CoreDNS
523
-
through the `--config` method described [here](/docs/reference/setup-tools/kubeadm/kubeadm-init-phase/#cmd-phase-addon).
540
+
- The CoreDNS service is named `kube-dns` for compatibility reasons with the legacy `kube-dns`
541
+
addon.
524
542
525
543
- A ServiceAccount for CoreDNS is created in the `kube-system` namespace.
526
544
@@ -534,8 +552,8 @@ You can use CoreDNS with kubeadm even when the related Service is named `kube-dn
534
552
Similarly to `kubeadm init`, also `kubeadm join` internal workflow consists of a sequence of
535
553
atomic work tasks to perform.
536
554
537
-
This is split into discovery (having the Node trust the Kubernetes Master) and TLS bootstrap
538
-
(having the Kubernetes Master trust the Node).
555
+
This is split into discovery (having the Node trust the Kubernetes API Server) and TLS bootstrap
556
+
(having the Kubernetes API Server trust the Node).
539
557
540
558
see [Authenticating with Bootstrap Tokens](/docs/reference/access-authn-authz/bootstrap-tokens/)
541
559
or the corresponding [design proposal](https://git.k8s.io/design-proposals-archive/cluster-lifecycle/bootstrap-discovery.md).
@@ -545,12 +563,10 @@ or the corresponding [design proposal](https://git.k8s.io/design-proposals-archi
545
563
`kubeadm` executes a set of preflight checks before starting the join, with the aim to verify
546
564
preconditions and avoid common cluster startup problems.
547
565
548
-
Please note that:
566
+
Also note that:
549
567
550
568
1.`kubeadm join` preflight checks are basically a subset of `kubeadm init` preflight checks
551
-
1. Starting from 1.24, kubeadm uses crictl to communicate to all known CRI endpoints.
552
-
1. Starting from 1.9, kubeadm provides support for joining nodes running on Windows; in that case,
553
-
linux specific controls are skipped.
569
+
1. If you are joining a Windows node, Linux specific controls are skipped.
554
570
1. In any case the user can skip specific preflight checks (or eventually all preflight checks)
555
571
with the `--ignore-preflight-errors` option.
556
572
@@ -582,9 +598,8 @@ In order to prevent "man in the middle" attacks, several steps are taken:
582
598
compared with the CA retrieved initially
583
599
584
600
{{< note >}}
585
-
586
-
Pub key validation can be skipped passing `--discovery-token-unsafe-skip-ca-verification` flag;
587
-
This weakens the kubeadm security model since others can potentially impersonate the Kubernetes Master.
601
+
You can skip CA validation by passing the `--discovery-token-unsafe-skip-ca-verification` flag on the command line.
602
+
This weakens the kubeadm security model since others can potentially impersonate the Kubernetes API server.
588
603
{{< /note >}}
589
604
590
605
#### File/https discovery
@@ -620,3 +635,88 @@ is deleted.
620
635
- The automatic CSR approval is managed by the csrapprover controller, according to
621
636
the configuration present in the `kubeadm init` process
622
637
{{< /note >}}
638
+
639
+
## kubeadm upgrade workflow internal design
640
+
641
+
`kubeadm upgrade` has sub-commands for handling the upgrade of the Kubernets cluster created by kubeadm.
642
+
You must run `kubeadm upgrade apply` on a control plane node (you can choose which one);
643
+
this starts the upgrade process. You then run `kubeadm upgrade node` on all remaining
644
+
nodes (both worker nodes and control plane nodes).
645
+
646
+
Both `kubeadm upgrade apply` and `kubeadm upgrade node` have a `phase` subcommand which provides access
647
+
to the internal phases of the upgrade process.
648
+
See [`kubeadm upgrade phase`](/docs/reference/setup-tools/kubeadm/kubeadm-upgrade-phase/) for more details.
649
+
650
+
Additional utility upgrade commands are `kubeadm upgrade plan` and `kubeadm upgrade diff`.
651
+
652
+
All upgrade sub-commands support passing a configuration file.
653
+
654
+
### kubeadm upgrade plan
655
+
656
+
You can optionally run `kubeadm upgrade plan` before you run `kubeadm upgrade apply`.
657
+
The `plan` subcommand checks which versions are available to upgrade
658
+
to and validates whether your current cluster is upgradeable.
659
+
660
+
### kubeadm upgrade diff
661
+
662
+
This shows what differences would be applied to existing static pod manifests for control plane nodes.
663
+
A more verbose way to do the same thing is running `kubeadm upgrade apply --dry-run` or
664
+
`kubeadm upgrade node --dry-run`.
665
+
666
+
### kubeadm upgrade apply
667
+
668
+
`kubeadm upgrade apply` prepares the cluster for the upgrade of all nodes, and also
669
+
upgrades the control plane node where it's run. The steps it performs are:
670
+
671
+
- Runs preflight checks similarly to `kubeadm init` and `kubeadm join`, ensuring container images are downloaded
672
+
and the cluster is in a good state to be upgraded.
673
+
- Upgrades the control plane manifest files on disk in `/etc/kubernetes/manifests` and waits
674
+
for the kubelet to restart the components if the files have changed.
675
+
- Uploads the updated kubeadm and kubelet configurations to the cluster in the `kubeadm-config`
676
+
and the `kubelet-config` ConfigMaps (both in the `kube-system` namespace).
677
+
- Writes updated kubelet configuration for this node in `/var/lib/kubelet/config.yaml`.
678
+
- Configures bootstrap token and the `cluster-info` ConfigMap for RBAC rules. This is the same as
679
+
in the `kubeadm init` stage and ensures that the cluster continues to support nodes joining with bootstrap tokens.
680
+
- Upgrades the kube-proxy and CoreDNS addons conditionally if all existing kube-apiservers in the cluster
681
+
have already been upgraded to the target version.
682
+
- Performs any post-upgrade tasks, such as, cleaning up deprecated features which are release specific.
683
+
684
+
### kubeadm upgrade node
685
+
686
+
`kubeadm upgrade node` upgrades a single control plane or worker node after the cluster upgrade has
687
+
started (by running `kubeadm upgrade apply`). The command detects if the node is a control plane node by checking
688
+
if the file `/etc/kubernetes/manifests/kube-apiserver.yaml` exists. On finding that file, the kubeadm tool
689
+
infers that there is a running kube-apiserver Pod on this node.
690
+
691
+
- Runs preflight checks similarly to `kubeadm upgrade apply`.
692
+
- For control plane nodes, upgrades the control plane manifest files on disk in `/etc/kubernetes/manifests`
693
+
and waits for the kubelet to restart the components if the files have changed.
694
+
- Writes the updated kubelet configuration for this node in `/var/lib/kubelet/config.yaml`.
695
+
- (For control plane nodes) upgrades the kube-proxy and CoreDNS
696
+
{{< glossary_tooltip text="addons" term_id="addons" >}} conditionally, provided that all existing
697
+
API servers in the cluster have already been upgraded to the target version.
698
+
- Performs any post-upgrade tasks, such as cleaning up deprecated features which are release specific.
699
+
700
+
## kubeadm reset workflow internal design
701
+
702
+
You can use the `kubeadm reset` subcommand on a node where kubeadm commands previously executed.
703
+
This subcommand performs a **best-effort** cleanup of the node.
704
+
If certain actions fail you must intervene and perform manual cleanup.
705
+
706
+
The command supports phases.
707
+
See [`kubeadm reset phase`](/docs/reference/setup-tools/kubeadm/kubeadm-reset-phase/) for more details.
708
+
709
+
The command supports a configuration file.
710
+
711
+
Additionally:
712
+
- IPVS, iptables and nftables rules are **not** cleaned up.
713
+
- CNI (network plugin) configuration is **not** cleaned up.
714
+
-`.kube/` in the user's home directory is **not** cleaned up.
715
+
716
+
The command has the following stages:
717
+
- Runs preflight checks on the node to determine if its healthy.
718
+
- For control plane nodes, removes any local etcd member data.
719
+
- Stops the kubelet.
720
+
- Stops running containers.
721
+
- Unmounts any mounted directories in `/var/lib/kubelet`.
722
+
- Deletes any files and directories managed by kubeadm in `/var/lib/kubelet` and `/etc/kubernetes`.
0 commit comments