Merge pull request #26952 from tmoschou/update-apt-repo-setup-install-steps

Update Ubuntu/Debian installation instructions to use Signed-By option
This commit is contained in:
Kubernetes Prow Robot
2021-03-10 08:07:15 -08:00
committed by GitHub
3 changed files with 125 additions and 292 deletions
@@ -63,7 +63,7 @@ configuration, or reinstall it using automation.
### containerd ### containerd
This section contains the necessary steps to use `containerd` as CRI runtime. This section contains the necessary steps to use containerd as CRI runtime.
Use the following commands to install Containerd on your system: Use the following commands to install Containerd on your system:
@@ -92,147 +92,38 @@ sudo sysctl --system
Install containerd: Install containerd:
{{< tabs name="tab-cri-containerd-installation" >}} {{< tabs name="tab-cri-containerd-installation" >}}
{{% tab name="Ubuntu 16.04" %}} {{% tab name="Linux" %}}
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).
2. Configure containerd:
```shell ```shell
# (Install containerd)
## Set up the repository
### 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
```
```shell
## Add Docker's official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key --keyring /etc/apt/trusted.gpg.d/docker.gpg add -
```
```shell
## Add Docker apt repository.
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
```
```shell
## Install containerd
sudo apt-get update && sudo apt-get install -y containerd.io
```
```shell
# Configure containerd
sudo mkdir -p /etc/containerd sudo mkdir -p /etc/containerd
containerd config default | sudo tee /etc/containerd/config.toml containerd config default | sudo tee /etc/containerd/config.toml
``` ```
3. Restart containerd:
```shell ```shell
# Restart containerd
sudo systemctl restart containerd sudo systemctl restart containerd
``` ```
{{% /tab %}}
{{% tab name="Ubuntu 18.04/20.04" %}}
```shell
# (Install containerd)
sudo apt-get update && sudo apt-get install -y containerd
```
```shell
# Configure containerd
sudo mkdir -p /etc/containerd
containerd config default | sudo tee /etc/containerd/config.toml
```
```shell
# Restart containerd
sudo systemctl restart containerd
```
{{% /tab %}}
{{% tab name="Debian 9+" %}}
```shell
# (Install containerd)
## Set up the repository
### 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
```
```shell
## Add Docker's official GPG key
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key --keyring /etc/apt/trusted.gpg.d/docker.gpg add -
```
```shell
## Add Docker apt repository.
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
```
```shell
## Install containerd
sudo apt-get update && sudo apt-get install -y containerd.io
```
```shell
# Set default containerd configuration
sudo mkdir -p /etc/containerd
containerd config default | sudo tee /etc/containerd/config.toml
```
```shell
# Restart containerd
sudo systemctl restart containerd
```
{{% /tab %}}
{{% tab name="CentOS/RHEL 7.4+" %}}
```shell
# (Install containerd)
## Set up the repository
### Install required packages
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
```
```shell
## Add docker repository
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
```
```shell
## Install containerd
sudo yum update -y && sudo yum install -y containerd.io
```
```shell
## Configure containerd
sudo mkdir -p /etc/containerd
containerd config default | sudo tee /etc/containerd/config.toml
```
```shell
# Restart containerd
sudo systemctl restart containerd
```
{{% /tab %}} {{% /tab %}}
{{% tab name="Windows (PowerShell)" %}} {{% tab name="Windows (PowerShell)" %}}
<br />
Start a Powershell session, set `$Version` to the desired version (ex: `$Version=1.4.3`), and then run the following commands: Start a Powershell session, set `$Version` to the desired version (ex: `$Version=1.4.3`), and then run the following commands:
<br />
1. Download containerd:
```powershell ```powershell
# (Install containerd)
# Download containerd
curl.exe -L https://github.com/containerd/containerd/releases/download/v$Version/containerd-$Version-windows-amd64.tar.gz -o containerd-windows-amd64.tar.gz curl.exe -L https://github.com/containerd/containerd/releases/download/v$Version/containerd-$Version-windows-amd64.tar.gz -o containerd-windows-amd64.tar.gz
tar.exe xvf .\containerd-windows-amd64.tar.gz tar.exe xvf .\containerd-windows-amd64.tar.gz
``` ```
2. Extract and configure:
```powershell ```powershell
# Extract and configure
Copy-Item -Path ".\bin\" -Destination "$Env:ProgramFiles\containerd" -Recurse -Force Copy-Item -Path ".\bin\" -Destination "$Env:ProgramFiles\containerd" -Recurse -Force
cd $Env:ProgramFiles\containerd\ cd $Env:ProgramFiles\containerd\
.\containerd.exe config default | Out-File config.toml -Encoding ascii .\containerd.exe config default | Out-File config.toml -Encoding ascii
@@ -246,8 +137,9 @@ Get-Content config.toml
Add-MpPreference -ExclusionProcess "$Env:ProgramFiles\containerd\containerd.exe" Add-MpPreference -ExclusionProcess "$Env:ProgramFiles\containerd\containerd.exe"
``` ```
3. Start containerd:
```powershell ```powershell
# Start containerd
.\containerd.exe --register-service .\containerd.exe --register-service
Start-Service containerd Start-Service containerd
``` ```
@@ -455,52 +347,12 @@ in sync.
### Docker ### Docker
On each of your nodes, install Docker CE. 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)
The Kubernetes release notes list which versions of Docker are compatible 2. Configure the Docker daemon, in particular to use systemd for the management of the containers cgroups.
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
# (Install Docker CE)
## Set up the repository:
### 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 gnupg2
```
```shell
# Add Docker's official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key --keyring /etc/apt/trusted.gpg.d/docker.gpg add -
```
```shell
# Add the Docker apt repository:
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
```
```shell
# Install Docker CE
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
## Create /etc/docker
sudo mkdir /etc/docker sudo mkdir /etc/docker
```
```shell
# Set up the Docker daemon
cat <<EOF | sudo tee /etc/docker/daemon.json cat <<EOF | sudo tee /etc/docker/daemon.json
{ {
"exec-opts": ["native.cgroupdriver=systemd"], "exec-opts": ["native.cgroupdriver=systemd"],
@@ -513,80 +365,20 @@ cat <<EOF | sudo tee /etc/docker/daemon.json
EOF EOF
``` ```
```shell {{< note >}}
# Create /etc/systemd/system/docker.service.d `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.
sudo mkdir -p /etc/systemd/system/docker.service.d {{< /note >}}
```
```shell 3. Restart Docker and enable on boot:
# Restart Docker
sudo systemctl daemon-reload
sudo systemctl restart docker
```
{{% /tab %}}
{{% tab name="CentOS/RHEL 7.4+" %}}
```shell
# (Install Docker CE)
## Set up the repository
### Install required packages
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
```
```shell
## Add the Docker repository
sudo yum-config-manager --add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
```
```shell
# Install Docker CE
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
## Create /etc/docker
sudo mkdir /etc/docker
```
```shell
# Set up the Docker daemon
cat <<EOF | sudo tee /etc/docker/daemon.json
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2",
"storage-opts": [
"overlay2.override_kernel_check=true"
]
}
EOF
```
```shell
# Create /etc/systemd/system/docker.service.d
sudo mkdir -p /etc/systemd/system/docker.service.d
```
```shell
# Restart Docker
sudo systemctl daemon-reload
sudo systemctl restart docker
```
{{% /tab %}}
{{< /tabs >}}
If you want the `docker` service to start on boot, run the following command:
```shell ```shell
sudo systemctl enable docker sudo systemctl enable docker
sudo systemctl daemon-reload
sudo systemctl restart docker
``` ```
Refer to the [official Docker installation guides](https://docs.docker.com/engine/installation/) {{< note >}}
for more information. For more information refer to
- [Configure the Docker daemon](https://docs.docker.com/config/daemon/)
- [Control Docker with systemd](https://docs.docker.com/config/daemon/systemd/)
{{< /note >}}
@@ -175,16 +175,34 @@ For more information on version skews, see:
{{< tabs name="k8s_install" >}} {{< tabs name="k8s_install" >}}
{{% tab name="Debian-based distributions" %}} {{% tab name="Debian-based distributions" %}}
```bash
sudo apt-get update && sudo apt-get install -y apt-transport-https curl 1. Update the `apt` package index and install packages needed to use the Kubernetes `apt` repository:
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list ```shell
deb https://apt.kubernetes.io/ kubernetes-xenial main sudo apt-get update
EOF sudo apt-get install -y apt-transport-https ca-certificates curl
```
2. Download the Google Cloud public signing key:
```shell
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
```
3. Add the Kubernetes `apt` repository:
```shell
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
```
4. Update `apt` package index, install kubelet, kubeadm and kubectl, and pin their version:
```shell
sudo apt-get update sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl sudo apt-mark hold kubelet kubeadm kubectl
``` ```
{{% /tab %}} {{% /tab %}}
{{% tab name="Red Hat-based distributions" %}} {{% tab name="Red Hat-based distributions" %}}
```bash ```bash
@@ -100,15 +100,38 @@ For example, to download version {{< param "fullversion" >}} on Linux, type:
### Install using native package management ### Install using native package management
{{< tabs name="kubectl_install" >}} {{< tabs name="kubectl_install" >}}
{{< tab name="Ubuntu, Debian or HypriotOS" codelang="bash" >}} {{% tab name="Debian-based distributions" %}}
sudo apt-get update && sudo apt-get install -y apt-transport-https gnupg2 curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - 1. Update the `apt` package index and install packages needed to use the Kubernetes `apt` repository:
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
```shell
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
```
2. Download the Google Cloud public signing key:
```shell
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
```
3. Add the Kubernetes `apt` repository:
```shell
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
```
4. Update `apt` package index with the new repository and install kubectl:
```shell
sudo apt-get update sudo apt-get update
sudo apt-get install -y kubectl sudo apt-get install -y kubectl
{{< /tab >}} ```
{{< tab name="CentOS, RHEL or Fedora" codelang="bash" >}}cat <<EOF > /etc/yum.repos.d/kubernetes.repo {{% /tab %}}
{{< tab name="Red Hat-based distributions" codelang="bash" >}}
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes] [kubernetes]
name=Kubernetes name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64