Skip to content

Commit 0a196b3

Browse files
authored
Merge pull request #26952 from tmoschou/update-apt-repo-setup-install-steps
Update Ubuntu/Debian installation instructions to use Signed-By option
2 parents f476bd3 + e7e5f0c commit 0a196b3

File tree

3 files changed

+124
-291
lines changed

3 files changed

+124
-291
lines changed

content/en/docs/setup/production-environment/container-runtimes.md

Lines changed: 65 additions & 273 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ configuration, or reinstall it using automation.
6363

6464
### containerd
6565

66-
This section contains the necessary steps to use `containerd` as CRI runtime.
66+
This section contains the necessary steps to use containerd as CRI runtime.
6767

6868
Use the following commands to install Containerd on your system:
6969

@@ -92,165 +92,57 @@ sudo sysctl --system
9292
Install containerd:
9393

9494
{{< tabs name="tab-cri-containerd-installation" >}}
95-
{{% tab name="Ubuntu 16.04" %}}
95+
{{% tab name="Linux" %}}
9696

97-
```shell
98-
# (Install containerd)
99-
## Set up the repository
100-
### Install packages to allow apt to use a repository over HTTPS
101-
sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
102-
```
103-
104-
```shell
105-
## Add Docker's official GPG key
106-
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key --keyring /etc/apt/trusted.gpg.d/docker.gpg add -
107-
```
108-
109-
```shell
110-
## Add Docker apt repository.
111-
sudo add-apt-repository \
112-
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
113-
$(lsb_release -cs) \
114-
stable"
115-
```
116-
117-
```shell
118-
## Install containerd
119-
sudo apt-get update && sudo apt-get install -y containerd.io
120-
```
121-
122-
```shell
123-
# Configure containerd
124-
sudo mkdir -p /etc/containerd
125-
containerd config default | sudo tee /etc/containerd/config.toml
126-
```
127-
128-
```shell
129-
# Restart containerd
130-
sudo systemctl restart containerd
131-
```
132-
{{% /tab %}}
133-
{{% tab name="Ubuntu 18.04/20.04" %}}
134-
135-
```shell
136-
# (Install containerd)
137-
sudo apt-get update && sudo apt-get install -y containerd
138-
```
139-
140-
```shell
141-
# Configure containerd
142-
sudo mkdir -p /etc/containerd
143-
containerd config default | sudo tee /etc/containerd/config.toml
144-
```
145-
146-
```shell
147-
# Restart containerd
148-
sudo systemctl restart containerd
149-
```
150-
{{% /tab %}}
151-
{{% tab name="Debian 9+" %}}
152-
153-
```shell
154-
# (Install containerd)
155-
## Set up the repository
156-
### Install packages to allow apt to use a repository over HTTPS
157-
sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
158-
```
97+
1. Install the `containerd.io` package from the official Docker repositories. Instructions for setting up the Docker repository for your respective Linux distribution and installing the `containerd.io` package can be found at [Install Docker Engine](https://docs.docker.com/engine/install/#server).
15998

160-
```shell
161-
## Add Docker's official GPG key
162-
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key --keyring /etc/apt/trusted.gpg.d/docker.gpg add -
163-
```
99+
2. Configure containerd:
164100

165-
```shell
166-
## Add Docker apt repository.
167-
sudo add-apt-repository \
168-
"deb [arch=amd64] https://download.docker.com/linux/debian \
169-
$(lsb_release -cs) \
170-
stable"
171-
```
101+
```shell
102+
sudo mkdir -p /etc/containerd
103+
containerd config default | sudo tee /etc/containerd/config.toml
104+
```
172105

173-
```shell
174-
## Install containerd
175-
sudo apt-get update && sudo apt-get install -y containerd.io
176-
```
106+
3. Restart containerd:
177107

178-
```shell
179-
# Set default containerd configuration
180-
sudo mkdir -p /etc/containerd
181-
containerd config default | sudo tee /etc/containerd/config.toml
182-
```
108+
```shell
109+
sudo systemctl restart containerd
110+
```
183111

184-
```shell
185-
# Restart containerd
186-
sudo systemctl restart containerd
187-
```
188112
{{% /tab %}}
189-
{{% tab name="CentOS/RHEL 7.4+" %}}
190-
191-
```shell
192-
# (Install containerd)
193-
## Set up the repository
194-
### Install required packages
195-
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
196-
```
197-
198-
```shell
199-
## Add docker repository
200-
sudo yum-config-manager \
201-
--add-repo \
202-
https://download.docker.com/linux/centos/docker-ce.repo
203-
```
113+
{{% tab name="Windows (PowerShell)" %}}
204114

205-
```shell
206-
## Install containerd
207-
sudo yum update -y && sudo yum install -y containerd.io
208-
```
115+
Start a Powershell session, set `$Version` to the desired version (ex: `$Version=1.4.3`), and then run the following commands:
209116

210-
```shell
211-
## Configure containerd
212-
sudo mkdir -p /etc/containerd
213-
containerd config default | sudo tee /etc/containerd/config.toml
214-
```
117+
1. Download containerd:
215118

216-
```shell
217-
# Restart containerd
218-
sudo systemctl restart containerd
219-
```
220-
{{% /tab %}}
221-
{{% tab name="Windows (PowerShell)" %}}
119+
```powershell
120+
curl.exe -L https://github.com/containerd/containerd/releases/download/v$Version/containerd-$Version-windows-amd64.tar.gz -o containerd-windows-amd64.tar.gz
121+
tar.exe xvf .\containerd-windows-amd64.tar.gz
122+
```
222123

223-
<br />
224-
Start a Powershell session, set `$Version` to the desired version (ex: `$Version=1.4.3`), and then run the following commands:
225-
<br />
124+
2. Extract and configure:
226125

227-
```powershell
228-
# (Install containerd)
229-
# Download containerd
230-
curl.exe -L https://github.com/containerd/containerd/releases/download/v$Version/containerd-$Version-windows-amd64.tar.gz -o containerd-windows-amd64.tar.gz
231-
tar.exe xvf .\containerd-windows-amd64.tar.gz
232-
```
126+
```powershell
127+
Copy-Item -Path ".\bin\" -Destination "$Env:ProgramFiles\containerd" -Recurse -Force
128+
cd $Env:ProgramFiles\containerd\
129+
.\containerd.exe config default | Out-File config.toml -Encoding ascii
233130
234-
```powershell
235-
# Extract and configure
236-
Copy-Item -Path ".\bin\" -Destination "$Env:ProgramFiles\containerd" -Recurse -Force
237-
cd $Env:ProgramFiles\containerd\
238-
.\containerd.exe config default | Out-File config.toml -Encoding ascii
131+
# Review the configuration. Depending on setup you may want to adjust:
132+
# - the sandbox_image (Kubernetes pause image)
133+
# - cni bin_dir and conf_dir locations
134+
Get-Content config.toml
239135
240-
# Review the configuration. Depending on setup you may want to adjust:
241-
# - the sandbox_image (Kubernetes pause image)
242-
# - cni bin_dir and conf_dir locations
243-
Get-Content config.toml
136+
# (Optional - but highly recommended) Exclude containerd from Windows Defender Scans
137+
Add-MpPreference -ExclusionProcess "$Env:ProgramFiles\containerd\containerd.exe"
138+
```
244139

245-
# (Optional - but highly recommended) Exclude containerd from Windows Defender Scans
246-
Add-MpPreference -ExclusionProcess "$Env:ProgramFiles\containerd\containerd.exe"
247-
```
140+
3. Start containerd:
248141

249-
```powershell
250-
# Start containerd
251-
.\containerd.exe --register-service
252-
Start-Service containerd
253-
```
142+
```powershell
143+
.\containerd.exe --register-service
144+
Start-Service containerd
145+
```
254146

255147
{{% /tab %}}
256148
{{< /tabs >}}
@@ -455,138 +347,38 @@ in sync.
455347

456348
### Docker
457349

458-
On each of your nodes, install Docker CE.
459-
460-
The Kubernetes release notes list which versions of Docker are compatible
461-
with that version of Kubernetes.
462-
463-
Use the following commands to install Docker on your system:
464-
465-
{{< tabs name="tab-cri-docker-installation" >}}
466-
{{% tab name="Ubuntu 16.04+" %}}
467-
468-
```shell
469-
# (Install Docker CE)
470-
## Set up the repository:
471-
### Install packages to allow apt to use a repository over HTTPS
472-
sudo apt-get update && sudo apt-get install -y \
473-
apt-transport-https ca-certificates curl software-properties-common gnupg2
474-
```
475-
476-
```shell
477-
# Add Docker's official GPG key:
478-
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key --keyring /etc/apt/trusted.gpg.d/docker.gpg add -
479-
```
480-
481-
```shell
482-
# Add the Docker apt repository:
483-
sudo add-apt-repository \
484-
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
485-
$(lsb_release -cs) \
486-
stable"
487-
```
488-
489-
```shell
490-
# Install Docker CE
491-
sudo apt-get update && sudo apt-get install -y \
492-
containerd.io=1.2.13-2 \
493-
docker-ce=5:19.03.11~3-0~ubuntu-$(lsb_release -cs) \
494-
docker-ce-cli=5:19.03.11~3-0~ubuntu-$(lsb_release -cs)
495-
```
496-
497-
```shell
498-
## Create /etc/docker
499-
sudo mkdir /etc/docker
500-
```
501-
502-
```shell
503-
# Set up the Docker daemon
504-
cat <<EOF | sudo tee /etc/docker/daemon.json
505-
{
506-
"exec-opts": ["native.cgroupdriver=systemd"],
507-
"log-driver": "json-file",
508-
"log-opts": {
509-
"max-size": "100m"
510-
},
511-
"storage-driver": "overlay2"
512-
}
513-
EOF
514-
```
515-
516-
```shell
517-
# Create /etc/systemd/system/docker.service.d
518-
sudo mkdir -p /etc/systemd/system/docker.service.d
519-
```
520-
521-
```shell
522-
# Restart Docker
523-
sudo systemctl daemon-reload
524-
sudo systemctl restart docker
525-
```
526-
{{% /tab %}}
527-
{{% tab name="CentOS/RHEL 7.4+" %}}
528-
529-
```shell
530-
# (Install Docker CE)
531-
## Set up the repository
532-
### Install required packages
533-
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
534-
```
535-
536-
```shell
537-
## Add the Docker repository
538-
sudo yum-config-manager --add-repo \
539-
https://download.docker.com/linux/centos/docker-ce.repo
540-
```
541-
542-
```shell
543-
# Install Docker CE
544-
sudo yum update -y && sudo yum install -y \
545-
containerd.io-1.2.13 \
546-
docker-ce-19.03.11 \
547-
docker-ce-cli-19.03.11
548-
```
549-
550-
```shell
551-
## Create /etc/docker
552-
sudo mkdir /etc/docker
553-
```
350+
1. On each of your nodes, install the Docker for your Linux distribution as per [Install Docker Engine](https://docs.docker.com/engine/install/#server)
554351

555-
```shell
556-
# Set up the Docker daemon
557-
cat <<EOF | sudo tee /etc/docker/daemon.json
558-
{
559-
"exec-opts": ["native.cgroupdriver=systemd"],
560-
"log-driver": "json-file",
561-
"log-opts": {
562-
"max-size": "100m"
563-
},
564-
"storage-driver": "overlay2",
565-
"storage-opts": [
566-
"overlay2.override_kernel_check=true"
567-
]
568-
}
569-
EOF
570-
```
352+
2. Configure the Docker daemon, in particular to use systemd for the management of the container’s cgroups.
571353

572-
```shell
573-
# Create /etc/systemd/system/docker.service.d
574-
sudo mkdir -p /etc/systemd/system/docker.service.d
575-
```
354+
```shell
355+
sudo mkdir /etc/docker
356+
cat <<EOF | sudo tee /etc/docker/daemon.json
357+
{
358+
"exec-opts": ["native.cgroupdriver=systemd"],
359+
"log-driver": "json-file",
360+
"log-opts": {
361+
"max-size": "100m"
362+
},
363+
"storage-driver": "overlay2"
364+
}
365+
EOF
366+
```
576367
577-
```shell
578-
# Restart Docker
579-
sudo systemctl daemon-reload
580-
sudo systemctl restart docker
581-
```
582-
{{% /tab %}}
583-
{{< /tabs >}}
368+
{{< note >}}
369+
`overlay2` is the preferred storage driver for systems running Linux kernel version 4.0 or higher, or RHEL or CentOS using version 3.10.0-514 and above.
370+
{{< /note >}}
584371
585-
If you want the `docker` service to start on boot, run the following command:
372+
3. Restart Docker and enable on boot:
586373
587-
```shell
588-
sudo systemctl enable docker
589-
```
374+
```shell
375+
sudo systemctl enable docker
376+
sudo systemctl daemon-reload
377+
sudo systemctl restart docker
378+
```
590379
591-
Refer to the [official Docker installation guides](https://docs.docker.com/engine/installation/)
592-
for more information.
380+
{{< note >}}
381+
For more information refer to
382+
- [Configure the Docker daemon](https://docs.docker.com/config/daemon/)
383+
- [Control Docker with systemd](https://docs.docker.com/config/daemon/systemd/)
384+
{{< /note >}}

0 commit comments

Comments
 (0)