Skip to content

Commit f53ca06

Browse files
authored
Merge pull request #43425 from windsonsea/admyh
Clean up /kubeadm/install-kubeadm.md
2 parents 61720e0 + 0b4b808 commit f53ca06

File tree

1 file changed

+43
-41
lines changed

1 file changed

+43
-41
lines changed

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

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ This page shows how to install the `kubeadm` toolbox.
1515
For information on how to create a cluster with kubeadm once you have performed this installation process,
1616
see the [Creating a cluster with kubeadm](/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/) page.
1717

18-
1918
## {{% heading "prerequisites" %}}
2019

21-
2220
* A compatible Linux host. The Kubernetes project provides generic instructions for Linux distributions
2321
based on Debian and Red Hat, and those distributions without a package manager.
2422
* 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
5957
route, we recommend you add IP route(s) so Kubernetes cluster addresses go via the appropriate adapter.
6058

6159
## Check required ports
60+
6261
These [required ports](/docs/reference/networking/ports-and-protocols/)
6362
need to be open in order for Kubernetes components to communicate with each other.
6463
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:
131130
* `kubeadm`: the command to bootstrap the cluster.
132131

133132
* `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.
135134

136135
* `kubectl`: the command line util to talk to your cluster.
137136

@@ -159,7 +158,7 @@ For more information on version skews, see:
159158
{{< note >}}
160159
Kubernetes has [new package repositories hosted at `pkgs.k8s.io`](/blog/2023/08/15/pkgs-k8s-io-introduction/)
161160
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
163162
[deprecation and freezing announcement](/blog/2023/08/31/legacy-package-repository-deprecation/)
164163
for more details.
165164
{{< /note >}}
@@ -177,7 +176,8 @@ These instructions are for Kubernetes {{< skew currentVersion >}}.
177176
sudo apt-get install -y apt-transport-https ca-certificates curl
178177
```
179178

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:
181181

182182
```shell
183183
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`
208208

209209
1. Set SELinux to `permissive` mode:
210210

211-
These instructions are for Kubernetes {{< skew currentVersion >}}.
211+
These instructions are for Kubernetes {{< skew currentVersion >}}.
212212

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+
```
218218

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 >}}
227227

228228
2. Add the Kubernetes `yum` repository. The `exclude` parameter in the
229229
repository definition ensures that the packages related to Kubernetes are
230230
not upgraded upon running `yum update` as there's a special procedure that
231231
must be followed for upgrading Kubernetes.
232232

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+
```
245245
246246
3. Install kubelet, kubeadm and kubectl, and enable kubelet to ensure it's automatically started on startup:
247247
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+
```
252252
253253
{{% /tab %}}
254254
{{% tab name="Without a package manager" %}}
@@ -262,7 +262,7 @@ sudo mkdir -p "$DEST"
262262
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
263263
```
264264
265-
Define the directory to download command files
265+
Define the directory to download command files:
266266
267267
{{< note >}}
268268
The `DOWNLOAD_DIR` variable must be set to a writable directory.
@@ -274,7 +274,7 @@ DOWNLOAD_DIR="/usr/local/bin"
274274
sudo mkdir -p "$DOWNLOAD_DIR"
275275
```
276276
277-
Install crictl (required for kubeadm / Kubelet Container Runtime Interface (CRI))
277+
Install crictl (required for kubeadm / Kubelet Container Runtime Interface (CRI)):
278278
279279
```bash
280280
CRICTL_VERSION="v1.28.0"
@@ -298,7 +298,8 @@ curl -sSL "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSIO
298298
```
299299
300300
{{< 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.
302303
{{< /note >}}
303304
304305
Install `kubectl` by following the instructions on [Install Tools page](/docs/tasks/tools/#kubectl).
@@ -312,12 +313,12 @@ systemctl enable --now kubelet
312313
{{< note >}}
313314
The Flatcar Container Linux distribution mounts the `/usr` directory as a read-only filesystem.
314315
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.
316318
{{< /note >}}
317319
{{% /tab %}}
318320
{{< /tabs >}}
319321
320-
321322
The kubelet is now restarting every few seconds, as it waits in a crashloop for
322323
kubeadm to tell it what to do.
323324
@@ -335,7 +336,8 @@ See [Configuring a cgroup driver](/docs/tasks/administer-cluster/kubeadm/configu
335336
336337
## Troubleshooting
337338
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/).
339341
340342
## {{% heading "whatsnext" %}}
341343

0 commit comments

Comments
 (0)