@@ -7,62 +7,64 @@ content_type: concept
7
7
weight : 10
8
8
---
9
9
<!-- overview -->
10
- {{< feature-state for_k8s_version="v1.6" state="stable" >}}
11
- To run containers in Pods, Kubernetes uses a container runtime. Here are
12
- the installation instructions for various runtimes.
13
-
14
10
11
+ You need to install a
12
+ {{< glossary_tooltip text="container runtime" term_id="container-runtime" >}}
13
+ into each node in the cluster so that Pods can run there. This page outlines
14
+ what is involved and describes related tasks for setting up nodes.
15
15
16
16
<!-- body -->
17
17
18
+ This page lists details for using several common container runtimes with
19
+ Kubernetes, on Linux:
18
20
19
- {{< caution >}}
20
- A flaw was found in the way runc handled system file descriptors when running containers.
21
- A malicious container could use this flaw to overwrite contents of the runc binary and
22
- consequently run arbitrary commands on the container host system.
23
-
24
- Please refer to [ CVE-2019 -5736] ( https://access.redhat.com/security/cve/cve-2019-5736 ) for more
25
- information about the issue.
26
- {{< /caution >}}
27
-
28
- ### Applicability
21
+ - [ Docker] ( #docker )
22
+ - [ CRI-O] ( #cri-o )
23
+ - [ containerd] ( #containerd )
29
24
30
25
{{< note >}}
31
- This document is written for users installing CRI onto Linux. For other operating
32
- systems, look for documentation specific to your platform.
26
+ For other operating systems, look for documentation specific to your platform.
33
27
{{< /note >}}
34
28
35
- ### Cgroup drivers
36
-
37
- When systemd is chosen as the init system for a Linux distribution, the init process generates
38
- and consumes a root control group (` cgroup ` ) and acts as a cgroup manager. Systemd has a tight
39
- integration with cgroups and will allocate cgroups per process. It's possible to configure your
40
- container runtime and the kubelet to use ` cgroupfs ` . Using ` cgroupfs ` alongside systemd means
41
- that there will be two different cgroup managers.
29
+ ## Cgroup drivers
42
30
43
31
Control groups are used to constrain resources that are allocated to processes.
44
- A single cgroup manager will simplify the view of what resources are being allocated
45
- and will by default have a more consistent view of the available and in-use resources. When we have
46
- two managers we end up with two views of those resources. We have seen cases in the field
47
- where nodes that are configured to use ` cgroupfs ` for the kubelet and Docker, and ` systemd `
48
- for the rest of the processes running on the node becomes unstable under resource pressure.
32
+
33
+ When [ systemd] ( https://www.freedesktop.org/wiki/Software/systemd/ ) is chosen as the init
34
+ system for a Linux distribution, the init process generates and consumes a root control group
35
+ (` cgroup ` ) and acts as a cgroup manager.
36
+ Systemd has a tight integration with cgroups and allocates a cgroup per systemd unit. It's possible
37
+ to configure your container runtime and the kubelet to use ` cgroupfs ` . Using ` cgroupfs ` alongside
38
+ systemd means that there will be two different cgroup managers.
39
+
40
+ A single cgroup manager simplifies the view of what resources are being allocated
41
+ and will by default have a more consistent view of the available and in-use resources.
42
+ When there are two cgroup managers on a system, you end up with two views of those resources.
43
+ In the field, people have reported cases where nodes that are configured to use ` cgroupfs `
44
+ for the kubelet and Docker, but ` systemd ` for the rest of the processes, become unstable under
45
+ resource pressure.
49
46
50
47
Changing the settings such that your container runtime and kubelet use ` systemd ` as the cgroup driver
51
- stabilized the system. Please note the ` native.cgroupdriver=systemd ` option in the Docker setup below .
48
+ stabilized the system. To configure this for Docker, set ` native.cgroupdriver=systemd ` .
52
49
53
50
{{< caution >}}
54
- Changing the cgroup driver of a Node that has joined a cluster is highly unrecommended.
51
+ Changing the cgroup driver of a Node that has joined a cluster is strongly * not * recommended.
55
52
If the kubelet has created Pods using the semantics of one cgroup driver, changing the container
56
- runtime to another cgroup driver can cause errors when trying to re-create the PodSandbox
57
- for such existing Pods. Restarting the kubelet may not solve such errors. The recommendation
58
- is to drain the Node from its workloads, remove it from the cluster and re-join it.
53
+ runtime to another cgroup driver can cause errors when trying to re-create the Pod sandbox
54
+ for such existing Pods. Restarting the kubelet may not solve such errors.
55
+
56
+ If you have automation that makes it feasible, replace the node with another using the updated
57
+ configuration, or reinstall it using automation.
59
58
{{< /caution >}}
60
59
61
- ## Docker
60
+ ## Container runtimes
61
+
62
+ ### Docker
62
63
63
- On each of your machines, install Docker.
64
- Version 19.03.11 is recommended, but 1.13.1, 17.03, 17.06, 17.09, 18.06 and 18.09 are known to work as well.
65
- Keep track of the latest verified Docker version in the Kubernetes release notes.
64
+ On each of your nodes, install Docker CE.
65
+
66
+ The Kubernetes release notes list which versions of Docker are compatible
67
+ with that version of Kubernetes.
66
68
67
69
Use the following commands to install Docker on your system:
68
70
@@ -179,7 +181,7 @@ sudo systemctl restart docker
179
181
{{% /tab %}}
180
182
{{< /tabs >}}
181
183
182
- If you want the docker service to start on boot, run the following command:
184
+ If you want the ` docker ` service to start on boot, run the following command:
183
185
184
186
``` shell
185
187
sudo systemctl enable docker
@@ -188,9 +190,9 @@ sudo systemctl enable docker
188
190
Refer to the [ official Docker installation guides] ( https://docs.docker.com/engine/installation/ )
189
191
for more information.
190
192
191
- ## CRI-O
193
+ ### CRI-O
192
194
193
- This section contains the necessary steps to install ` CRI-O ` as CRI runtime.
195
+ This section contains the necessary steps to install CRI-O as a container runtime.
194
196
195
197
Use the following commands to install CRI-O on your system:
196
198
@@ -199,7 +201,7 @@ The CRI-O major and minor versions must match the Kubernetes major and minor ver
199
201
For more information, see the [ CRI-O compatibility matrix] ( https://github.com/cri-o/cri-o ) .
200
202
{{< /note >}}
201
203
202
- ### Prerequisites
204
+ Install and configure prerequisites:
203
205
204
206
``` shell
205
207
sudo modprobe overlay
@@ -218,9 +220,10 @@ sudo sysctl --system
218
220
{{< tabs name="tab-cri-cri-o-installation" >}}
219
221
{{% tab name="Debian" %}}
220
222
221
- To install CRI-O on the following operating systems, set the environment variable $OS to the appropriate field in the following table:
223
+ To install CRI-O on the following operating systems, set the environment variable ` OS `
224
+ to the appropriate value from the following table:
222
225
223
- | Operating system | $OS |
226
+ | Operating system | ` $OS ` |
224
227
| ---------------- | ----------------- |
225
228
| Debian Unstable | ` Debian_Unstable ` |
226
229
| Debian Testing | ` Debian_Testing ` |
@@ -252,9 +255,9 @@ sudo apt-get install cri-o cri-o-runc
252
255
253
256
{{% tab name="Ubuntu" %}}
254
257
255
- To install on the following operating systems, set the environment variable $OS to the appropriate field in the following table:
258
+ To install on the following operating systems, set the environment variable ` OS ` to the appropriate field in the following table:
256
259
257
- | Operating system | $OS |
260
+ | Operating system | ` $OS ` |
258
261
| ---------------- | ----------------- |
259
262
| Ubuntu 20.04 | ` xUbuntu_20.04 ` |
260
263
| Ubuntu 19.10 | ` xUbuntu_19.10 ` |
@@ -283,9 +286,9 @@ sudo apt-get install cri-o cri-o-runc
283
286
284
287
{{% tab name="CentOS" %}}
285
288
286
- To install on the following operating systems, set the environment variable $OS to the appropriate field in the following table:
289
+ To install on the following operating systems, set the environment variable ` OS ` to the appropriate field in the following table:
287
290
288
- | Operating system | $OS |
291
+ | Operating system | ` $OS ` |
289
292
| ---------------- | ----------------- |
290
293
| Centos 8 | ` CentOS_8 ` |
291
294
| Centos 8 Stream | ` CentOS_8_Stream ` |
@@ -316,7 +319,8 @@ sudo zypper install cri-o
316
319
{{% tab name="Fedora" %}}
317
320
318
321
Set ` $VERSION ` to the CRI-O version that matches your Kubernetes version.
319
- For instance, if you want to install CRI-O 1.18, ` VERSION=1.18 `
322
+ For instance, if you want to install CRI-O 1.18, ` VERSION=1.18 ` .
323
+
320
324
You can find available versions with:
321
325
``` shell
322
326
sudo dnf module list cri-o
@@ -332,7 +336,7 @@ sudo dnf install cri-o
332
336
{{% /tab %}}
333
337
{{< /tabs >}}
334
338
335
- ### Start CRI-O
339
+ Start CRI-O:
336
340
337
341
``` shell
338
342
sudo systemctl daemon-reload
@@ -342,13 +346,13 @@ sudo systemctl start crio
342
346
Refer to the [ CRI-O installation guide] ( https://github.com/kubernetes-sigs/cri-o#getting-started )
343
347
for more information.
344
348
345
- ## Containerd
349
+ ### containerd
346
350
347
351
This section contains the necessary steps to use ` containerd ` as CRI runtime.
348
352
349
353
Use the following commands to install Containerd on your system:
350
354
351
- ### Prerequisites
355
+ Install and configure prerequisites:
352
356
353
357
``` shell
354
358
cat << EOF | sudo tee /etc/modules-load.d/containerd.conf
369
373
sudo sysctl --system
370
374
```
371
375
372
- ### Install containerd
376
+ Install containerd:
373
377
374
378
{{< tabs name="tab-cri-containerd-installation" >}}
375
379
{{% tab name="Ubuntu 16.04" %}}
@@ -470,7 +474,7 @@ Start-Service containerd
470
474
{{% /tab %}}
471
475
{{< /tabs >}}
472
476
473
- ### systemd
477
+ #### systemd
474
478
475
479
To use the ` systemd ` cgroup driver in ` /etc/containerd/config.toml ` with ` runc ` set
476
480
@@ -480,11 +484,7 @@ To use the `systemd` cgroup driver in `/etc/containerd/config.toml` with `runc`
480
484
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
481
485
SystemdCgroup = true
482
486
```
483
- When using kubeadm, manually configure the
484
- [ cgroup driver for kubelet] ( /docs/setup/production-environment/tools/kubeadm/install-kubeadm/#configure-cgroup-driver-used-by-kubelet-on-control-plane-node )
485
-
486
- ## Other CRI runtimes: frakti
487
-
488
- Refer to the [ Frakti QuickStart guide] ( https://github.com/kubernetes/frakti#quickstart ) for more information.
489
487
488
+ When using kubeadm, manually configure the
489
+ [ cgroup driver for kubelet] ( /docs/setup/production-environment/tools/kubeadm/install-kubeadm/#configure-cgroup-driver-used-by-kubelet-on-control-plane-node ) .
490
490
0 commit comments