List container runtimes in alphabetical order

This commit is contained in:
Tim Bannister
2020-10-12 21:37:42 +01:00
parent 6b0165e7b5
commit 0c9a8e8242
@@ -18,9 +18,9 @@ what is involved and describes related tasks for setting up nodes.
This page lists details for using several common container runtimes with This page lists details for using several common container runtimes with
Kubernetes, on Linux: Kubernetes, on Linux:
- [Docker](#docker)
- [CRI-O](#cri-o)
- [containerd](#containerd) - [containerd](#containerd)
- [CRI-O](#cri-o)
- [Docker](#docker)
{{< note >}} {{< note >}}
For other operating systems, look for documentation specific to your platform. For other operating systems, look for documentation specific to your platform.
@@ -59,136 +59,147 @@ configuration, or reinstall it using automation.
## Container runtimes ## Container runtimes
### Docker {{% thirdparty-content %}}
On each of your nodes, install Docker CE. ### containerd
The Kubernetes release notes list which versions of Docker are compatible This section contains the necessary steps to use `containerd` as CRI runtime.
with that version of Kubernetes.
Use the following commands to install Docker on your system: Use the following commands to install Containerd on your system:
{{< tabs name="tab-cri-docker-installation" >}} Install and configure prerequisites:
{{% tab name="Ubuntu 16.04+" %}}
```shell ```shell
# (Install Docker CE) cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
## Set up the repository: overlay
br_netfilter
EOF
sudo modprobe overlay
sudo modprobe br_netfilter
# Setup required sysctl params, these persist across reboots.
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF
sudo sysctl --system
```
Install containerd:
{{< tabs name="tab-cri-containerd-installation" >}}
{{% tab name="Ubuntu 16.04" %}}
```shell
# (Install containerd)
## Set up the repository
### Install packages to allow apt to use a repository over HTTPS ### Install packages to allow apt to use a repository over HTTPS
sudo apt-get update && sudo apt-get install -y \ sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
apt-transport-https ca-certificates curl software-properties-common gnupg2
``` ```
```shell ```shell
# Add Docker's official GPG key: ## Add Docker's official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add --keyring /etc/apt/trusted.gpg.d/docker.gpg - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add --keyring /etc/apt/trusted.gpg.d/docker.gpg -
``` ```
```shell ```shell
# Add the Docker apt repository: ## Add Docker apt repository.
sudo add-apt-repository \ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \ $(lsb_release -cs) \
stable" stable"
``` ```
```shell ```shell
# Install Docker CE ## Install containerd
sudo apt-get update && sudo apt-get install -y \ sudo apt-get update && sudo apt-get install -y containerd.io
containerd.io=1.2.13-2 \
docker-ce=5:19.03.11~3-0~ubuntu-$(lsb_release -cs) \
docker-ce-cli=5:19.03.11~3-0~ubuntu-$(lsb_release -cs)
``` ```
```shell ```shell
# Set up the Docker daemon # Configure containerd
cat <<EOF | sudo tee /etc/docker/daemon.json sudo mkdir -p /etc/containerd
{ sudo containerd config default > /etc/containerd/config.toml
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
EOF
``` ```
```shell ```shell
sudo mkdir -p /etc/systemd/system/docker.service.d # Restart containerd
``` sudo systemctl restart containerd
```shell
# Restart Docker
sudo systemctl daemon-reload
sudo systemctl restart docker
``` ```
{{% /tab %}} {{% /tab %}}
{{% tab name="CentOS/RHEL 7.4+" %}} {{% tab name="CentOS/RHEL 7.4+" %}}
```shell ```shell
# (Install Docker CE) # (Install containerd)
## Set up the repository ## Set up the repository
### Install required packages ### Install required packages
sudo yum install -y yum-utils device-mapper-persistent-data lvm2 sudo yum install -y yum-utils device-mapper-persistent-data lvm2
``` ```
```shell ```shell
## Add the Docker repository ## Add docker repository
sudo yum-config-manager --add-repo \ sudo yum-config-manager \
https://download.docker.com/linux/centos/docker-ce.repo --add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
``` ```
```shell ```shell
# Install Docker CE ## Install containerd
sudo yum update -y && sudo yum install -y \ sudo yum update -y && sudo yum install -y containerd.io
containerd.io-1.2.13 \
docker-ce-19.03.11 \
docker-ce-cli-19.03.11
``` ```
```shell ```shell
## Create /etc/docker ## Configure containerd
sudo mkdir /etc/docker sudo mkdir -p /etc/containerd
sudo containerd config default > /etc/containerd/config.toml
``` ```
```shell ```shell
# Set up the Docker daemon # Restart containerd
cat <<EOF | sudo tee /etc/docker/daemon.json sudo systemctl restart containerd
{ ```
"exec-opts": ["native.cgroupdriver=systemd"], {{% /tab %}}
"log-driver": "json-file", {{% tab name="Windows (PowerShell)" %}}
"log-opts": { ```powershell
"max-size": "100m" # (Install containerd)
}, # download containerd
"storage-driver": "overlay2", cmd /c curl -OL https://github.com/containerd/containerd/releases/download/v1.4.0-beta.2/containerd-1.4.0-beta.2-windows-amd64.tar.gz
"storage-opts": [ cmd /c tar xvf .\containerd-1.4.0-beta.2-windows-amd64.tar.gz
"overlay2.override_kernel_check=true"
]
}
EOF
``` ```
```shell ```powershell
sudo mkdir -p /etc/systemd/system/docker.service.d # extract and configure
Copy-Item -Path ".\bin\" -Destination "$Env:ProgramFiles\containerd" -Recurse -Force
cd $Env:ProgramFiles\containerd\
.\containerd.exe config default | Out-File config.toml -Encoding ascii
# review the configuration. depending on setup you may want to adjust:
# - the sandbox_image (kubernetes pause image)
# - cni bin_dir and conf_dir locations
Get-Content config.toml
``` ```
```shell ```powershell
# Restart Docker # start containerd
sudo systemctl daemon-reload .\containerd.exe --register-service
sudo systemctl restart docker Start-Service containerd
``` ```
{{% /tab %}} {{% /tab %}}
{{< /tabs >}} {{< /tabs >}}
If you want the `docker` service to start on boot, run the following command: #### systemd
```shell To use the `systemd` cgroup driver in `/etc/containerd/config.toml` with `runc`, set
sudo systemctl enable docker
```
[plugins.cri]
systemd_cgroup = true
``` ```
Refer to the [official Docker installation guides](https://docs.docker.com/engine/installation/) When using kubeadm, manually configure the
for more information. [cgroup driver for kubelet](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#configure-cgroup-driver-used-by-kubelet-on-control-plane-node).
### CRI-O ### CRI-O
@@ -346,145 +357,136 @@ sudo systemctl start crio
Refer to the [CRI-O installation guide](https://github.com/kubernetes-sigs/cri-o#getting-started) Refer to the [CRI-O installation guide](https://github.com/kubernetes-sigs/cri-o#getting-started)
for more information. for more information.
### containerd
This section contains the necessary steps to use `containerd` as CRI runtime.
Use the following commands to install Containerd on your system: ### Docker
Install and configure prerequisites: On each of your nodes, install Docker CE.
The Kubernetes release notes list which versions of Docker are compatible
with that version of Kubernetes.
Use the following commands to install Docker on your system:
{{< tabs name="tab-cri-docker-installation" >}}
{{% tab name="Ubuntu 16.04+" %}}
```shell ```shell
cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf # (Install Docker CE)
overlay ## Set up the repository:
br_netfilter
EOF
sudo modprobe overlay
sudo modprobe br_netfilter
# Setup required sysctl params, these persist across reboots.
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF
sudo sysctl --system
```
Install containerd:
{{< tabs name="tab-cri-containerd-installation" >}}
{{% tab name="Ubuntu 16.04" %}}
```shell
# (Install containerd)
## Set up the repository
### Install packages to allow apt to use a repository over HTTPS ### Install packages to allow apt to use a repository over HTTPS
sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common sudo apt-get update && sudo apt-get install -y \
apt-transport-https ca-certificates curl software-properties-common gnupg2
``` ```
```shell ```shell
## Add Docker's official GPG key # Add Docker's official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add --keyring /etc/apt/trusted.gpg.d/docker.gpg - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add --keyring /etc/apt/trusted.gpg.d/docker.gpg -
``` ```
```shell ```shell
## Add Docker apt repository. # Add the Docker apt repository:
sudo add-apt-repository \ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \ $(lsb_release -cs) \
stable" stable"
``` ```
```shell ```shell
## Install containerd # Install Docker CE
sudo apt-get update && sudo apt-get install -y containerd.io sudo apt-get update && sudo apt-get install -y \
containerd.io=1.2.13-2 \
docker-ce=5:19.03.11~3-0~ubuntu-$(lsb_release -cs) \
docker-ce-cli=5:19.03.11~3-0~ubuntu-$(lsb_release -cs)
``` ```
```shell ```shell
# Configure containerd # Set up the Docker daemon
sudo mkdir -p /etc/containerd cat <<EOF | sudo tee /etc/docker/daemon.json
sudo containerd config default > /etc/containerd/config.toml {
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
EOF
``` ```
```shell ```shell
# Restart containerd sudo mkdir -p /etc/systemd/system/docker.service.d
sudo systemctl restart containerd ```
```shell
# Restart Docker
sudo systemctl daemon-reload
sudo systemctl restart docker
``` ```
{{% /tab %}} {{% /tab %}}
{{% tab name="CentOS/RHEL 7.4+" %}} {{% tab name="CentOS/RHEL 7.4+" %}}
```shell ```shell
# (Install containerd) # (Install Docker CE)
## Set up the repository ## Set up the repository
### Install required packages ### Install required packages
sudo yum install -y yum-utils device-mapper-persistent-data lvm2 sudo yum install -y yum-utils device-mapper-persistent-data lvm2
``` ```
```shell ```shell
## Add docker repository ## Add the Docker repository
sudo yum-config-manager \ sudo yum-config-manager --add-repo \
--add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
https://download.docker.com/linux/centos/docker-ce.repo
``` ```
```shell ```shell
## Install containerd # Install Docker CE
sudo yum update -y && sudo yum install -y containerd.io sudo yum update -y && sudo yum install -y \
containerd.io-1.2.13 \
docker-ce-19.03.11 \
docker-ce-cli-19.03.11
``` ```
```shell ```shell
## Configure containerd ## Create /etc/docker
sudo mkdir -p /etc/containerd sudo mkdir /etc/docker
sudo containerd config default > /etc/containerd/config.toml
``` ```
```shell ```shell
# Restart containerd # Set up the Docker daemon
sudo systemctl restart containerd cat <<EOF | sudo tee /etc/docker/daemon.json
``` {
{{% /tab %}} "exec-opts": ["native.cgroupdriver=systemd"],
{{% tab name="Windows (PowerShell)" %}} "log-driver": "json-file",
```powershell "log-opts": {
# (Install containerd) "max-size": "100m"
# download containerd },
cmd /c curl -OL https://github.com/containerd/containerd/releases/download/v1.4.0-beta.2/containerd-1.4.0-beta.2-windows-amd64.tar.gz "storage-driver": "overlay2",
cmd /c tar xvf .\containerd-1.4.0-beta.2-windows-amd64.tar.gz "storage-opts": [
"overlay2.override_kernel_check=true"
]
}
EOF
``` ```
```powershell ```shell
# extract and configure sudo mkdir -p /etc/systemd/system/docker.service.d
Copy-Item -Path ".\bin\" -Destination "$Env:ProgramFiles\containerd" -Recurse -Force
cd $Env:ProgramFiles\containerd\
.\containerd.exe config default | Out-File config.toml -Encoding ascii
# review the configuration. depending on setup you may want to adjust:
# - the sandbox_image (kubernetes pause image)
# - cni bin_dir and conf_dir locations
Get-Content config.toml
``` ```
```powershell ```shell
# start containerd # Restart Docker
.\containerd.exe --register-service sudo systemctl daemon-reload
Start-Service containerd sudo systemctl restart docker
``` ```
{{% /tab %}} {{% /tab %}}
{{< /tabs >}} {{< /tabs >}}
#### systemd If you want the `docker` service to start on boot, run the following command:
To use the `systemd` cgroup driver in `/etc/containerd/config.toml` with `runc` set ```shell
sudo systemctl enable docker
```
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
...
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
SystemdCgroup = true
``` ```
When using kubeadm, manually configure the Refer to the [official Docker installation guides](https://docs.docker.com/engine/installation/)
[cgroup driver for kubelet](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#configure-cgroup-driver-used-by-kubelet-on-control-plane-node). for more information.