Skip to content

Commit 4c6a904

Browse files
authored
Merge pull request #28360 from neolit123/1.22-add-v1beta3
kubeadm: use the new v1beta3 instead of v1beta2
2 parents e10ad90 + 3437d01 commit 4c6a904

File tree

10 files changed

+173
-62
lines changed

10 files changed

+173
-62
lines changed

content/en/docs/reference/setup-tools/kubeadm/kubeadm-init-phase.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ install them selectively.
143143
{{< tab name="kube-proxy" include="generated/kubeadm_init_phase_addon_kube-proxy.md" />}}
144144
{{< /tabs >}}
145145

146-
For more details on each field in the `v1beta2` configuration you can navigate to our
147-
[API reference pages.] (https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2)
146+
For more details on each field in the `v1beta3` configuration you can navigate to our
147+
[API reference pages.] (https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3)
148148

149149
## {{% heading "whatsnext" %}}
150150

content/en/docs/reference/setup-tools/kubeadm/kubeadm-init.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ sudo kubeadm init --skip-phases=control-plane,etcd --config=configfile.yaml
104104

105105
What this example would do is write the manifest files for the control plane and etcd in `/etc/kubernetes/manifests` based on the configuration in `configfile.yaml`. This allows you to modify the files and then skip these phases using `--skip-phases`. By calling the last command you will create a control plane node with the custom manifest files.
106106

107+
{{< feature-state for_k8s_version="v1.22" state="beta" >}}
108+
109+
Alternatively, you can use the `skipPhases` field under `InitConfiguration`.
110+
107111
### Using kubeadm init with a configuration file {#config-file}
108112

109113
{{< caution >}}

content/en/docs/reference/setup-tools/kubeadm/kubeadm-join.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ For example:
6666
sudo kubeadm join --skip-phases=preflight --config=config.yaml
6767
```
6868

69+
{{< feature-state for_k8s_version="v1.22" state="beta" >}}
70+
71+
Alternatively, you can use the `skipPhases` field in `JoinConfiguration`.
72+
6973
### Discovering what cluster CA to trust
7074

7175
The kubeadm discovery has several options, each with security tradeoffs.
Lines changed: 140 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,108 @@
11
---
22
reviewers:
33
- sig-cluster-lifecycle
4-
title: Customizing control plane configuration with kubeadm
4+
title: Customizing components with the kubeadm API
55
content_type: concept
66
weight: 40
77
---
88

99
<!-- overview -->
1010

11+
This page covers how to customize the components that kubeadm deploys. For control plane components
12+
you can use flags in the `ClusteConfiguration` structure or patches per-node. For the kubelet
13+
and kube-proxy you can use `KubeletConfiguration` and `KubeProxyConfiguration`, accordingly.
14+
15+
All of these options are possible via the kubeadm configuration API.
16+
For more details on each field in the configuration you can navigate to our
17+
[API reference pages](https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3).
18+
19+
{{< note >}}
20+
Customizing the CoreDNS deployment of kubeadm is currently not supported. You must manually
21+
patch the `kube-system/coredns` {{< glossary_tooltip text="ConfigMap" term_id="configmap" >}}
22+
and recreate the CoreDNS {{< glossary_tooltip text="Pods" term_id="pod" >}} after that. Alternatively,
23+
you can skip the default CoreDNS deployment and deploy your own variant.
24+
For more details on that see [Using init phases with kubeadm](/docs/reference/setup-tools/kubeadm/kubeadm-init/#init-phases).
25+
{{< /note >}}
26+
27+
<!-- body -->
28+
1129
{{< feature-state for_k8s_version="v1.12" state="stable" >}}
1230

13-
The kubeadm `ClusterConfiguration` object exposes the field `extraArgs` that can override the default flags passed to control plane
14-
components such as the APIServer, ControllerManager and Scheduler. The components are defined using the following fields:
31+
## Customizing the control plane with flags in `ClusterConfiguration`
32+
33+
The kubeadm `ClusterConfiguration` object exposes a way for users to override the default
34+
flags passed to control plane components such as the APIServer, ControllerManager, Scheduler and Etcd.
35+
The components are defined using the following structures:
1536

1637
- `apiServer`
1738
- `controllerManager`
1839
- `scheduler`
40+
- `etcd`
1941

20-
The `extraArgs` field consist of `key: value` pairs. To override a flag for a control plane component:
42+
These structures contain a common `extraArgs` field, that consists of `key: value` pairs.
43+
To override a flag for a control plane component:
2144

22-
1. Add the appropriate fields to your configuration.
23-
2. Add the flags to override to the field.
45+
1. Add the appropriate `extraArgs` to your configuration.
46+
2. Add flags to the `extraArgs` field.
2447
3. Run `kubeadm init` with `--config <YOUR CONFIG YAML>`.
2548

26-
For more details on each field in the configuration you can navigate to our
27-
[API reference pages](https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2#ClusterConfiguration).
28-
2949
{{< note >}}
30-
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.
50+
You can generate a `ClusterConfiguration` object with default values by running `kubeadm config print init-defaults`
51+
and saving the output to a file of your choice.
3152
{{< /note >}}
3253

54+
{{< note >}}
55+
The `ClusterConfiguration` object is currently global in kubeadm clusters. This means that any flags that you add,
56+
will apply to all instances of the same component on different nodes. To apply individual configuration per component
57+
on different nodes you can use [patches](#patches).
58+
{{< /note >}}
3359

60+
{{< note >}}
61+
Duplicate flags (keys), or passing the same flag `--foo` multiple times, is currently not supported.
62+
To workaround that you must use [patches](#patches).
63+
{{< /note >}}
3464

35-
<!-- body -->
36-
37-
## APIServer flags
65+
### APIServer flags
3866

3967
For details, see the [reference documentation for kube-apiserver](/docs/reference/command-line-tools-reference/kube-apiserver/).
4068

4169
Example usage:
70+
4271
```yaml
43-
apiVersion: kubeadm.k8s.io/v1beta2
72+
apiVersion: kubeadm.k8s.io/v1beta3
4473
kind: ClusterConfiguration
4574
kubernetesVersion: v1.16.0
4675
apiServer:
4776
extraArgs:
48-
advertise-address: 192.168.0.103
4977
anonymous-auth: "false"
5078
enable-admission-plugins: AlwaysPullImages,DefaultStorageClass
5179
audit-log-path: /home/johndoe/audit.log
5280
```
5381
54-
## ControllerManager flags
82+
### ControllerManager flags
5583
5684
For details, see the [reference documentation for kube-controller-manager](/docs/reference/command-line-tools-reference/kube-controller-manager/).
5785
5886
Example usage:
87+
5988
```yaml
60-
apiVersion: kubeadm.k8s.io/v1beta2
89+
apiVersion: kubeadm.k8s.io/v1beta3
6190
kind: ClusterConfiguration
6291
kubernetesVersion: v1.16.0
6392
controllerManager:
6493
extraArgs:
6594
cluster-signing-key-file: /home/johndoe/keys/ca.key
66-
bind-address: 0.0.0.0
6795
deployment-controller-sync-period: "50"
6896
```
6997
70-
## Scheduler flags
98+
### Scheduler flags
7199
72100
For details, see the [reference documentation for kube-scheduler](/docs/reference/command-line-tools-reference/kube-scheduler/).
73101
74102
Example usage:
103+
75104
```yaml
76-
apiVersion: kubeadm.k8s.io/v1beta2
105+
apiVersion: kubeadm.k8s.io/v1beta3
77106
kind: ClusterConfiguration
78107
kubernetesVersion: v1.16.0
79108
scheduler:
@@ -87,4 +116,95 @@ scheduler:
87116
pathType: "File"
88117
```
89118
119+
### Etcd flags
120+
121+
For details, see the [etcd server documentation](https://etcd.io/docs/).
122+
123+
Example usage:
124+
125+
```yaml
126+
apiVersion: kubeadm.k8s.io/v1beta3
127+
kind: ClusterConfiguration
128+
etcd:
129+
local:
130+
extraArgs:
131+
election-timeout: 1000
132+
```
133+
134+
## Customizing the control plane with patches {#patches}
135+
136+
{{< feature-state for_k8s_version="v1.22" state="beta" >}}
90137
138+
Kubeadm allows you to pass a directory with patch files to `InitConfiguration` and `JoinConfiguration`
139+
on individual nodes. These patches can be used as the last customization step before the control
140+
plane component manifests are written to disk.
141+
142+
You can pass this file to `kubeadm init` with `--config <YOUR CONFIG YAML>`:
143+
144+
```yaml
145+
apiVersion: kubeadm.k8s.io/v1beta3
146+
kind: InitConfiguration
147+
nodeRegistration:
148+
patches:
149+
directory: /home/user/somedir
150+
```
151+
152+
{{< note >}}
153+
For `kubeadm init` you can pass a file containing both a `ClusterConfiguration` and `InitConfiguration`
154+
separated by `---`.
155+
{{< /note >}}
156+
157+
You can pass this file to `kubeadm join` with `--config <YOUR CONFIG YAML>`:
158+
159+
```yaml
160+
apiVersion: kubeadm.k8s.io/v1beta3
161+
kind: JoinConfiguration
162+
nodeRegistration:
163+
patches:
164+
directory: /home/user/somedir
165+
```
166+
167+
The directory must contain files named `target[suffix][+patchtype].extension`.
168+
For example, `kube-apiserver0+merge.yaml` or just `etcd.json`.
169+
170+
- `target` can be one of `kube-apiserver`, `kube-controller-manager`, `kube-scheduler` and `etcd`.
171+
- `patchtype` can be one of `strategic`, `merge` or `json` and these must match the patching formats
172+
[supported by kubectl](/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch).
173+
The default `patchtype` is `strategic`.
174+
- `extension` must be either `json` or `yaml`.
175+
- `suffix` is an optional string that can be used to determine which patches are applied first
176+
alpha-numerically.
177+
178+
{{< note >}}
179+
If you are using `kubeadm upgrade` to upgrade your kubeadm nodes you must again provide the same
180+
patches, so that the customization is preserved after upgrade. To do that you can use the `--patches`
181+
flag, which must point to the same directory. `kubeadm upgrade` currently does not support a configuration
182+
API structure that can be used for the same purpose.
183+
{{< /note >}}
184+
185+
## Customizing the kubelet
186+
187+
To customize the kubelet you can add a `KubeletConfiguration` next to the `ClusterConfiguration` or
188+
`InitConfiguration` separated by `---` within the same configuration file. This file can then be passed to `kubeadm init`.
189+
190+
{{< note >}}
191+
kubeadm applies the same `KubeletConfiguration` to all nodes in the cluster. To apply node
192+
specific settings you can use kubelet flags as overrides by passing them in the `nodeRegistration.kubeletExtraArgs`
193+
field supported by both `InitConfiguration` and `JoinConfiguration`. Some kubelet flags are deprecated,
194+
so check their status in the [kubelet reference documentation](/docs/reference/command-line-tools-reference/kubelet)
195+
before using them.
196+
{{< /note >}}
197+
198+
For more details see [Configuring each kubelet in your cluster using kubeadm](/docs/setup/production-environment/tools/kubeadm/kubelet-integration)
199+
200+
## Customizing kube-proxy
201+
202+
To customize kube-proxy you can pass a `KubeProxyConfiguration` next your `ClusterConfiguration` or
203+
`InitConfiguration` to `kubeadm init` separated by `---`.
204+
205+
For more details you can navigate to our [API reference pages](https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3).
206+
207+
{{< note >}}
208+
kubeadm deploys kube-proxy as a {{< glossary_tooltip text="DaemonSet" term_id="daemonset" >}}, which means
209+
that the `KubeProxyConfiguration` would apply to all instances of kube-proxy in the cluster.
210+
{{< /note >}}

content/en/docs/setup/production-environment/tools/kubeadm/dual-stack-support.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ For each server that you want to use as a {{< glossary_tooltip text="node" term_
2121

2222
You need to have an IPv4 and and IPv6 address range to use. Cluster operators typically
2323
use private address ranges for IPv4. For IPv6, a cluster operator typically chooses a global
24-
unicast address block from within `2000::/3`, using a range that is assigned to the operator.
24+
unicast address block from within `2000::/3`, using a range that is assigned to the operator.
2525
You don't have to route the cluster's IP address ranges to the public internet.
2626

2727
The size of the IP address allocations should be suitable for the number of Pods and
@@ -30,7 +30,7 @@ Services that you are planning to run.
3030
{{< note >}}
3131
If you are upgrading an existing cluster then, by default, the `kubeadm upgrade` command
3232
changes the [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
33-
`IPv6DualStack` to `true` if that is not already enabled.
33+
`IPv6DualStack` to `true` if that is not already enabled.
3434
However, `kubeadm` does not support making modifications to the pod IP address range
3535
(“cluster CIDR”) nor to the cluster's Service address range (“Service CIDR”).
3636
{{< /note >}}
@@ -45,19 +45,19 @@ similar to the following example:
4545
kubeadm init --pod-network-cidr=10.244.0.0/16,2001:db8:42:0::/56 --service-cidr=10.96.0.0/16,2001:db8:42:1::/112
4646
```
4747

48-
To make things clearer, here is an example kubeadm [configuration file](https://pkg.go.dev/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2) `kubeadm-config.yaml` for the primary dual-stack control plane node.
48+
To make things clearer, here is an example kubeadm [configuration file](https://pkg.go.dev/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3) `kubeadm-config.yaml` for the primary dual-stack control plane node.
4949

5050
```yaml
5151
---
52-
apiVersion: kubeadm.k8s.io/v1beta2
52+
apiVersion: kubeadm.k8s.io/v1beta3
5353
kind: ClusterConfiguration
5454
featureGates:
5555
IPv6DualStack: true
5656
networking:
5757
podSubnet: 10.244.0.0/16,2001:db8:42:0::/56
5858
serviceSubnet: 10.96.0.0/16,2001:db8:42:1::/112
5959
---
60-
apiVersion: kubeadm.k8s.io/v1beta2
60+
apiVersion: kubeadm.k8s.io/v1beta3
6161
kind: InitConfiguration
6262
localAPIEndpoint:
6363
advertiseAddress: "10.100.0.1"
@@ -85,10 +85,10 @@ The `--apiserver-advertise-address` flag does not support dual-stack.
8585

8686
Before joining a node, make sure that the node has IPv6 routable network interface and allows IPv6 forwarding.
8787

88-
Here is an example kubeadm [configuration file](https://pkg.go.dev/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2) `kubeadm-config.yaml` for joining a worker node to the cluster.
88+
Here is an example kubeadm [configuration file](https://pkg.go.dev/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3) `kubeadm-config.yaml` for joining a worker node to the cluster.
8989

9090
```yaml
91-
apiVersion: kubeadm.k8s.io/v1beta2
91+
apiVersion: kubeadm.k8s.io/v1beta3
9292
kind: JoinConfiguration
9393
discovery:
9494
bootstrapToken:
@@ -98,9 +98,9 @@ nodeRegistration:
9898
node-ip: 10.100.0.3,fd00:1:2:3::3
9999
```
100100

101-
Also, here is an example kubeadm [configuration file](https://pkg.go.dev/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2) `kubeadm-config.yaml` for joining another control plane node to the cluster.
101+
Also, here is an example kubeadm [configuration file](https://pkg.go.dev/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3) `kubeadm-config.yaml` for joining another control plane node to the cluster.
102102
```yaml
103-
apiVersion: kubeadm.k8s.io/v1beta2
103+
apiVersion: kubeadm.k8s.io/v1beta3
104104
kind: JoinConfiguration
105105
controlPlane:
106106
localAPIEndpoint:
@@ -124,7 +124,7 @@ kubeadm join --config=kubeadm-config.yaml ...
124124
### Create a single-stack cluster
125125

126126
{{< note >}}
127-
Enabling the dual-stack feature doesn't mean that you need to use dual-stack addressing.
127+
Enabling the dual-stack feature doesn't mean that you need to use dual-stack addressing.
128128
You can deploy a single-stack cluster that has the dual-stack networking feature enabled.
129129
{{< /note >}}
130130

@@ -134,10 +134,10 @@ In 1.21 the `IPv6DualStack` feature is Beta and the feature gate is defaulted to
134134
kubeadm init --feature-gates IPv6DualStack=false
135135
```
136136

137-
To make things more clear, here is an example kubeadm [configuration file](https://pkg.go.dev/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2) `kubeadm-config.yaml` for the single-stack control plane node.
137+
To make things more clear, here is an example kubeadm [configuration file](https://pkg.go.dev/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3) `kubeadm-config.yaml` for the single-stack control plane node.
138138

139139
```yaml
140-
apiVersion: kubeadm.k8s.io/v1beta2
140+
apiVersion: kubeadm.k8s.io/v1beta3
141141
kind: ClusterConfiguration
142142
featureGates:
143143
IPv6DualStack: false

content/en/docs/setup/production-environment/tools/kubeadm/high-availability.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ option. Your cluster requirements may need a different configuration.
115115

116116
{{< note >}}
117117
The `kubeadm init` flags `--config` and `--certificate-key` cannot be mixed, therefore if you want
118-
to use the [kubeadm configuration](https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2)
118+
to use the [kubeadm configuration](https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3)
119119
you must add the `certificateKey` field in the appropriate config locations
120120
(under `InitConfiguration` and `JoinConfiguration: controlPlane`).
121121
{{< /note >}}
@@ -230,7 +230,7 @@ in the kubeadm config file.
230230

231231
1. Create a file called `kubeadm-config.yaml` with the following contents:
232232

233-
apiVersion: kubeadm.k8s.io/v1beta2
233+
apiVersion: kubeadm.k8s.io/v1beta3
234234
kind: ClusterConfiguration
235235
kubernetesVersion: stable
236236
controlPlaneEndpoint: "LOAD_BALANCER_DNS:LOAD_BALANCER_PORT"

content/en/docs/setup/production-environment/tools/kubeadm/setup-ha-etcd-with-kubeadm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ this example.
9595
HOST=${ETCDHOSTS[$i]}
9696
NAME=${NAMES[$i]}
9797
cat << EOF > /tmp/${HOST}/kubeadmcfg.yaml
98-
apiVersion: "kubeadm.k8s.io/v1beta2"
98+
apiVersion: "kubeadm.k8s.io/v1beta3"
9999
kind: ClusterConfiguration
100100
etcd:
101101
local:

0 commit comments

Comments
 (0)