@@ -15,10 +15,8 @@ This page shows how to install the `kubeadm` toolbox.
15
15
For information on how to create a cluster with kubeadm once you have performed this installation process,
16
16
see the [ Creating a cluster with kubeadm] ( /docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/ ) page.
17
17
18
-
19
18
## {{% heading "prerequisites" %}}
20
19
21
-
22
20
* A compatible Linux host. The Kubernetes project provides generic instructions for Linux distributions
23
21
based on Debian and Red Hat, and those distributions without a package manager.
24
22
* 2 GB or more of RAM per machine (any less will leave little room for your apps).
@@ -59,6 +57,7 @@ If you have more than one network adapter, and your Kubernetes components are no
59
57
route, we recommend you add IP route(s) so Kubernetes cluster addresses go via the appropriate adapter.
60
58
61
59
## Check required ports
60
+
62
61
These [ required ports] ( /docs/reference/networking/ports-and-protocols/ )
63
62
need to be open in order for Kubernetes components to communicate with each other.
64
63
You can use tools like netcat to check if a port is open. For example:
@@ -131,7 +130,7 @@ You will install these packages on all of your machines:
131
130
* ` kubeadm ` : the command to bootstrap the cluster.
132
131
133
132
* ` kubelet ` : the component that runs on all of the machines in your cluster
134
- and does things like starting pods and containers.
133
+ and does things like starting pods and containers.
135
134
136
135
* ` kubectl ` : the command line util to talk to your cluster.
137
136
@@ -159,7 +158,7 @@ For more information on version skews, see:
159
158
{{< note >}}
160
159
Kubernetes has [ new package repositories hosted at ` pkgs.k8s.io ` ] ( /blog/2023/08/15/pkgs-k8s-io-introduction/ )
161
160
starting from August 2023. The legacy package repositories (` apt.kubernetes.io ` and ` yum.kubernetes.io ` )
162
- have been frozen starting from September 13, 2023. Please read our
161
+ have been frozen starting from September 13, 2023. Please read our
163
162
[ deprecation and freezing announcement] ( /blog/2023/08/31/legacy-package-repository-deprecation/ )
164
163
for more details.
165
164
{{< /note >}}
@@ -177,7 +176,8 @@ These instructions are for Kubernetes {{< skew currentVersion >}}.
177
176
sudo apt-get install -y apt-transport-https ca-certificates curl
178
177
```
179
178
180
- 2 . Download the public signing key for the Kubernetes package repositories. The same signing key is used for all repositories so you can disregard the version in the URL:
179
+ 2 . Download the public signing key for the Kubernetes package repositories.
180
+ The same signing key is used for all repositories so you can disregard the version in the URL:
181
181
182
182
``` shell
183
183
curl -fsSL https://pkgs.k8s.io/core:/stable:/{{< param " version" > }}/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
@@ -208,47 +208,47 @@ you can create it by running `sudo mkdir -m 755 /etc/apt/keyrings`
208
208
209
209
1 . Set SELinux to ` permissive ` mode:
210
210
211
- These instructions are for Kubernetes {{< skew currentVersion >}}.
211
+ These instructions are for Kubernetes {{< skew currentVersion >}}.
212
212
213
- ``` shell
214
- # Set SELinux in permissive mode (effectively disabling it)
215
- sudo setenforce 0
216
- sudo sed -i ' s/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
217
- ```
213
+ ``` shell
214
+ # Set SELinux in permissive mode (effectively disabling it)
215
+ sudo setenforce 0
216
+ sudo sed -i ' s/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
217
+ ```
218
218
219
- {{< caution >}}
220
- - Setting SELinux in permissive mode by running ` setenforce 0 ` and ` sed ... `
221
- effectively disables it. This is required to allow containers to access the host
222
- filesystem; for example, some cluster network plugins require that. You have to
223
- do this until SELinux support is improved in the kubelet.
224
- - You can leave SELinux enabled if you know how to configure it but it may require
225
- settings that are not supported by kubeadm.
226
- {{< /caution >}}
219
+ {{< caution >}}
220
+ - Setting SELinux in permissive mode by running ` setenforce 0 ` and ` sed ... `
221
+ effectively disables it. This is required to allow containers to access the host
222
+ filesystem; for example, some cluster network plugins require that. You have to
223
+ do this until SELinux support is improved in the kubelet.
224
+ - You can leave SELinux enabled if you know how to configure it but it may require
225
+ settings that are not supported by kubeadm.
226
+ {{< /caution >}}
227
227
228
228
2 . Add the Kubernetes ` yum ` repository. The ` exclude ` parameter in the
229
229
repository definition ensures that the packages related to Kubernetes are
230
230
not upgraded upon running ` yum update ` as there's a special procedure that
231
231
must be followed for upgrading Kubernetes.
232
232
233
- ``` shell
234
- # This overwrites any existing configuration in /etc/yum.repos.d/kubernetes.repo
235
- cat << EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
236
- [kubernetes]
237
- name=Kubernetes
238
- baseurl=https://pkgs.k8s.io/core:/stable:/{{< param "version" >}}/rpm/
239
- enabled=1
240
- gpgcheck=1
241
- gpgkey=https://pkgs.k8s.io/core:/stable:/{{< param "version" >}}/rpm/repodata/repomd.xml.key
242
- exclude=kubelet kubeadm kubectl cri-tools kubernetes-cni
243
- EOF
244
- ```
233
+ ``` shell
234
+ # This overwrites any existing configuration in /etc/yum.repos.d/kubernetes.repo
235
+ cat << EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
236
+ [kubernetes]
237
+ name=Kubernetes
238
+ baseurl=https://pkgs.k8s.io/core:/stable:/{{< param "version" >}}/rpm/
239
+ enabled=1
240
+ gpgcheck=1
241
+ gpgkey=https://pkgs.k8s.io/core:/stable:/{{< param "version" >}}/rpm/repodata/repomd.xml.key
242
+ exclude=kubelet kubeadm kubectl cri-tools kubernetes-cni
243
+ EOF
244
+ ` ` `
245
245
246
246
3. Install kubelet, kubeadm and kubectl, and enable kubelet to ensure it' s automatically started on startup:
247
247
248
- ``` shell
249
- sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
250
- sudo systemctl enable --now kubelet
251
- ```
248
+ ```shell
249
+ sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
250
+ sudo systemctl enable --now kubelet
251
+ ```
252
252
253
253
{{% /tab %}}
254
254
{{% tab name="Without a package manager" %}}
@@ -262,7 +262,7 @@ sudo mkdir -p "$DEST"
262
262
curl -L "https://github.com/containernetworking/plugins/releases/download/${CNI_PLUGINS_VERSION}/cni-plugins-linux-${ARCH}-${CNI_PLUGINS_VERSION}.tgz" | sudo tar -C "$DEST" -xz
263
263
```
264
264
265
- Define the directory to download command files
265
+ Define the directory to download command files:
266
266
267
267
{{< note >}}
268
268
The `DOWNLOAD_DIR` variable must be set to a writable directory.
@@ -274,7 +274,7 @@ DOWNLOAD_DIR="/usr/local/bin"
274
274
sudo mkdir -p "$DOWNLOAD_DIR"
275
275
```
276
276
277
- Install crictl (required for kubeadm / Kubelet Container Runtime Interface (CRI))
277
+ Install crictl (required for kubeadm / Kubelet Container Runtime Interface (CRI)):
278
278
279
279
```bash
280
280
CRICTL_VERSION="v1.28.0"
@@ -298,7 +298,8 @@ curl -sSL "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSIO
298
298
```
299
299
300
300
{{< note >}}
301
- Please refer to the note in the [ Before you begin] ( #before-you-begin ) section for Linux distributions that do not include ` glibc ` by default.
301
+ Please refer to the note in the [Before you begin](#before-you-begin) section for Linux distributions
302
+ that do not include `glibc` by default.
302
303
{{< /note >}}
303
304
304
305
Install `kubectl` by following the instructions on [Install Tools page](/docs/tasks/tools/#kubectl).
@@ -312,12 +313,12 @@ systemctl enable --now kubelet
312
313
{{< note >}}
313
314
The Flatcar Container Linux distribution mounts the `/usr` directory as a read-only filesystem.
314
315
Before bootstrapping your cluster, you need to take additional steps to configure a writable directory.
315
- See the [ Kubeadm Troubleshooting guide] ( /docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/#usr-mounted-read-only/ ) to learn how to set up a writable directory.
316
+ See the [Kubeadm Troubleshooting guide](/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/#usr-mounted-read-only/)
317
+ to learn how to set up a writable directory.
316
318
{{< /note >}}
317
319
{{% /tab %}}
318
320
{{< /tabs >}}
319
321
320
-
321
322
The kubelet is now restarting every few seconds, as it waits in a crashloop for
322
323
kubeadm to tell it what to do.
323
324
@@ -335,7 +336,8 @@ See [Configuring a cgroup driver](/docs/tasks/administer-cluster/kubeadm/configu
335
336
336
337
## Troubleshooting
337
338
338
- If you are running into difficulties with kubeadm, please consult our [ troubleshooting docs] ( /docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/ ) .
339
+ If you are running into difficulties with kubeadm, please consult our
340
+ [troubleshooting docs](/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/).
339
341
340
342
## {{% heading "whatsnext" %}}
341
343
0 commit comments