From e80821d3c48e5f04a2ecfbaa1b3a8ad3c36142e4 Mon Sep 17 00:00:00 2001 From: makocchi-git Date: Tue, 23 Jun 2020 12:14:07 +0900 Subject: [PATCH 1/7] update container-runtimes.md --- .../container-runtimes.md | 278 +++++++++++++----- 1 file changed, 208 insertions(+), 70 deletions(-) diff --git a/content/ja/docs/setup/production-environment/container-runtimes.md b/content/ja/docs/setup/production-environment/container-runtimes.md index a9604a7b59..2eebe5c7ce 100644 --- a/content/ja/docs/setup/production-environment/container-runtimes.md +++ b/content/ja/docs/setup/production-environment/container-runtimes.md @@ -18,8 +18,7 @@ Podのコンテナを実行するために、Kubernetesはコンテナランタ 悪意のあるコンテナがこの脆弱性を利用してruncのバイナリを上書きし、 コンテナホストシステム上で任意のコマンドを実行する可能性があります。 -この問題の更なる情報は以下のリンクを参照してください。 -[cve-2019-5736 : runc vulnerability](https://access.redhat.com/security/cve/cve-2019-5736) +詳細は[CVE-2019-5736](https://access.redhat.com/security/cve/cve-2019-5736)を参照してください。 {{< /caution >}} ### 適用性 @@ -53,34 +52,45 @@ kubeletとDockerに `cgroupfs` を使用し、ノード上で実行されてい ## Docker それぞれのマシンに対してDockerをインストールします。 -バージョン18.06.2が推奨されていますが、1.11、1.12、1.13、17.03、18.09についても動作が確認されています。 +バージョン19.03.11が推奨されていますが、1.13.1、17.03、17.06、17.09、18.06、18.09についても動作が確認されています。 Kubernetesのリリースノートにある、Dockerの動作確認済み最新バージョンについてもご確認ください。 システムへDockerをインストールするには、次のコマンドを実行します。 {{< tabs name="tab-cri-docker-installation" >}} -{{< tab name="Ubuntu 16.04" codelang="bash" >}} +{{% tab name="Ubuntu 16.04+" %}} + +```shell # Docker CEのインストール ## リポジトリをセットアップ -### aptパッケージインデックスを更新 - apt-get update - ### HTTPS越しのリポジトリの使用をaptに許可するために、パッケージをインストール - apt-get update && apt-get install apt-transport-https ca-certificates curl software-properties-common +apt-get update && apt-get install -y \ + apt-transport-https ca-certificates curl software-properties-common gnupg2 +``` -### Docker公式のGPG鍵を追加 - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - +```shell +# Docker公式のGPG鍵を追加 +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - +``` -### dockerのaptリポジトリを追加 - add-apt-repository \ - "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ - $(lsb_release -cs) \ - stable" +```shell +# dockerのaptリポジトリを追加 +add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) \ + stable" +``` -## docker ceのインストール -apt-get update && apt-get install docker-ce=18.06.2~ce~3-0~ubuntu +```shell +# docker ceのインストール +apt-get update && 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 +# Dockerデーモンをセットアップ cat > /etc/docker/daemon.json < /etc/docker/daemon.json <}} -{{< tab name="CentOS/RHEL 7.4+" codelang="bash" >}} +{{% tab name="CentOS/RHEL 7.4+" %}} +```shell # Docker CEのインストール ## リポジトリをセットアップ ### 必要なパッケージのインストール - yum install yum-utils device-mapper-persistent-data lvm2 +yum install -y yum-utils device-mapper-persistent-data lvm2 +``` -### dockerパッケージ用のyumリポジトリを追加 -yum-config-manager \ - --add-repo \ - https://download.docker.com/linux/centos/docker-ce.repo +```shell +### Dockerリポジトリを追加 +yum-config-manager --add-repo \ + https://download.docker.com/linux/centos/docker-ce.repo +``` -## docker ceのインストール -yum update && yum install docker-ce-18.06.2.ce +```shell +# Docker CEのインストール +yum update -y && yum install -y \ + containerd.io-1.2.13 \ + docker-ce-19.03.11 \ + docker-ce-cli-19.03.11 +``` +```shell ## /etc/docker ディレクトリを作成 mkdir /etc/docker +``` -# デーモンをセットアップ +```shell +# Dockerデーモンをセットアップ cat > /etc/docker/daemon.json < /etc/docker/daemon.json <}} {{< /tabs >}} +ブート時にdockerサービスを起動したい場合は、以下のコマンドを実行してください。 + +```shell +sudo systemctl enable docker +``` + 詳細については、[Dockerの公式インストールガイド](https://docs.docker.com/engine/installation/)を参照してください。 ## CRI-O @@ -164,37 +201,85 @@ sysctl --system ``` {{< tabs name="tab-cri-cri-o-installation" >}} -{{< tab name="Ubuntu 16.04" codelang="bash" >}} +{{% tab name="Debian" %}} -# 必要なパッケージをインストールし、リポジトリを追加 -apt-get update -apt-get install software-properties-common +```shell +# Debian Unstable/Sid +echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_Unstable/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list +wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_Unstable/Release.key -O- | sudo apt-key add - +``` -add-apt-repository ppa:projectatomic/ppa -apt-get update +```shell +# Debian Testing +echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_Testing/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list +wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_Testing/Release.key -O- | sudo apt-key add - +``` +```shell +# Debian 10 +echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_10/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list +wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_10/Release.key -O- | sudo apt-key add - +``` + +```shell +# Raspbian 10 +echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Raspbian_10/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list +wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Raspbian_10/Release.key -O- | sudo apt-key add - +``` + +その後CRI-Oをインストール +```shell +sudo apt-get install cri-o-1.17 +``` +{{% /tab %}} + +{{% tab name="Ubuntu 18.04, 19.04 and 19.10" %}} + +```shell +# パッケージリポジトリの設定 +. /etc/os-release +sudo sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/x${NAME}_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" +wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/x${NAME}_${VERSION_ID}/Release.key -O- | sudo apt-key add - +sudo apt-get update +``` + +```shell # CRI-Oをインストール -apt-get install cri-o-1.11 +sudo apt-get install cri-o-1.17 +``` +{{% /tab %}} -{{< /tab >}} -{{< tab name="CentOS/RHEL 7.4+" codelang="bash" >}} +{{% tab name="CentOS/RHEL 7.4+" %}} -# 必要なリポジトリを追加 -yum-config-manager --add-repo=https://cbs.centos.org/repos/paas7-crio-311-candidate/x86_64/os/ +```shell +# 事前に必要なものをインストール +# Install prerequisites +curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/CentOS_7/devel:kubic:libcontainers:stable.repo +curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable:cri-o:{{< skew latestVersion >}}.repo https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:{{< skew latestVersion >}}/CentOS_7/devel:kubic:libcontainers:stable:cri-o:{{< skew latestVersion >}}.repo +``` +```shell # CRI-Oをインストール -yum install --nogpgcheck cri-o +yum install -y cri-o +``` +{{% /tab %}} -{{< /tab >}} +{{% tab name="openSUSE Tumbleweed" %}} + +```shell +sudo zypper install cri-o +``` +{{% /tab %}} {{< /tabs >}} ### CRI-Oの起動 ``` +systemctl daemon-reload systemctl start crio ``` -詳細については、[CRI-Oインストールガイド](https://github.com/kubernetes-sigs/cri-o#getting-started)を参照してください。 +詳細については、[CRI-Oインストールガイド]((https://github.com/kubernetes-sigs/cri-o#getting-started)を参照してください。 ## Containerd @@ -202,9 +287,14 @@ systemctl start crio システムへContainerdをインストールするためには次のコマンドを実行します。 -### 必要な設定の追加 +### 事前準備 ```shell +cat > /etc/modules-load.d/containerd.conf <}} -{{< tab name="Ubuntu 16.04+" codelang="bash" >}} -apt-get install -y libseccomp2 -{{< /tab >}} -{{< tab name="CentOS/RHEL 7.4+" codelang="bash" >}} -yum install -y libseccomp -{{< /tab >}} -{{< /tabs >}} - ### containerdのインストール -[Containerdは定期的にリリース](https://github.com/containerd/containerd/releases)されますが、以下に示すコマンドで利用している値は、この手順が作成された時点での最新のバージョンにしたがって書かれています。より新しいバージョンとダウンロードするファイルのハッシュ値については[こちら](https://storage.googleapis.com/cri-containerd-release)で確認するようにしてください。 +{{< tabs name="tab-cri-containerd-installation" >}} +{{% tab name="Ubuntu 16.04" %}} ```shell -# 必要な環境変数をexportします。 -export CONTAINERD_VERSION="1.1.2" -export CONTAINERD_SHA256="d4ed54891e90a5d1a45e3e96464e2e8a4770cd380c21285ef5c9895c40549218" - -# containerdのtarボールをダウンロードします。 -wget https://storage.googleapis.com/cri-containerd-release/cri-containerd-${CONTAINERD_VERSION}.linux-amd64.tar.gz - -# ハッシュ値をチェックします。 -echo "${CONTAINERD_SHA256} cri-containerd-${CONTAINERD_VERSION}.linux-amd64.tar.gz" | sha256sum --check - - -# 解凍して展開します。 -tar --no-overwrite-dir -C / -xzf cri-containerd-${CONTAINERD_VERSION}.linux-amd64.tar.gz - -# containerdを起動します。 -systemctl start containerd +# containerdのインストール +## リポジトリの設定 +### HTTPS越しのリポジトリの使用をaptに許可するために、パッケージをインストール +apt-get update && apt-get install -y apt-transport-https ca-certificates curl software-properties-common ``` +```shell +# Docker公式のGPG鍵を追加 +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - +``` + +```shell +## Dockerのaptリポジトリを追加 +add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) \ + stable" +``` + +```shell +## containerdのインストール +apt-get update && apt-get install -y containerd.io +``` + +```shell +# containerdの設定 +mkdir -p /etc/containerd +containerd config default > /etc/containerd/config.toml +``` + +```shell +# containerdの再起動 +systemctl restart containerd +``` +{{% /tab %}} +{{% tab name="CentOS/RHEL 7.4+" %}} + +```shell +# containerdのインストール +## リポジトリの設定 +### 必要なパッケージのインストール +yum install -y yum-utils device-mapper-persistent-data lvm2 +``` + +```shell +## Dockerリポジトリを追加 +yum-config-manager \ + --add-repo \ + https://download.docker.com/linux/centos/docker-ce.repo +``` + +```shell +## containerdのインストール +yum update -y && yum install -y containerd.io +``` + +```shell +## containerdの設定 +mkdir -p /etc/containerd +containerd config default > /etc/containerd/config.toml +``` + +```shell +# Restart containerd +systemctl restart containerd +``` +{{% /tab %}} +{{< /tabs >}} + +### systemd + +`systemd`のcgroupドライバーを使うには、`/etc/containerd/config.toml`内で`plugins.cri.systemd_cgroup = true`を設定してください。 +kubeadmを使う場合は[kubeletのためのcgroupドライバー](/ja/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)を手動で設定してください。 + ## その他のCRIランタイム: frakti 詳細については[Fraktiのクイックスタートガイド](https://github.com/kubernetes/frakti#quickstart)を参照してください。 - From 59664b886168601aab4ef6c26eefb12d69f46731 Mon Sep 17 00:00:00 2001 From: makocchi-git Date: Wed, 24 Jun 2020 19:24:05 +0900 Subject: [PATCH 2/7] Revert "update container-runtimes.md" This reverts commit e80821d3c48e5f04a2ecfbaa1b3a8ad3c36142e4. --- .../container-runtimes.md | 280 +++++------------- 1 file changed, 71 insertions(+), 209 deletions(-) diff --git a/content/ja/docs/setup/production-environment/container-runtimes.md b/content/ja/docs/setup/production-environment/container-runtimes.md index 2eebe5c7ce..a9604a7b59 100644 --- a/content/ja/docs/setup/production-environment/container-runtimes.md +++ b/content/ja/docs/setup/production-environment/container-runtimes.md @@ -18,7 +18,8 @@ Podのコンテナを実行するために、Kubernetesはコンテナランタ 悪意のあるコンテナがこの脆弱性を利用してruncのバイナリを上書きし、 コンテナホストシステム上で任意のコマンドを実行する可能性があります。 -詳細は[CVE-2019-5736](https://access.redhat.com/security/cve/cve-2019-5736)を参照してください。 +この問題の更なる情報は以下のリンクを参照してください。 +[cve-2019-5736 : runc vulnerability](https://access.redhat.com/security/cve/cve-2019-5736) {{< /caution >}} ### 適用性 @@ -52,45 +53,34 @@ kubeletとDockerに `cgroupfs` を使用し、ノード上で実行されてい ## Docker それぞれのマシンに対してDockerをインストールします。 -バージョン19.03.11が推奨されていますが、1.13.1、17.03、17.06、17.09、18.06、18.09についても動作が確認されています。 +バージョン18.06.2が推奨されていますが、1.11、1.12、1.13、17.03、18.09についても動作が確認されています。 Kubernetesのリリースノートにある、Dockerの動作確認済み最新バージョンについてもご確認ください。 システムへDockerをインストールするには、次のコマンドを実行します。 {{< tabs name="tab-cri-docker-installation" >}} -{{% tab name="Ubuntu 16.04+" %}} - -```shell +{{< tab name="Ubuntu 16.04" codelang="bash" >}} # Docker CEのインストール ## リポジトリをセットアップ +### aptパッケージインデックスを更新 + apt-get update + ### HTTPS越しのリポジトリの使用をaptに許可するために、パッケージをインストール -apt-get update && apt-get install -y \ - apt-transport-https ca-certificates curl software-properties-common gnupg2 -``` + apt-get update && apt-get install apt-transport-https ca-certificates curl software-properties-common -```shell -# Docker公式のGPG鍵を追加 -curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - -``` +### Docker公式のGPG鍵を追加 + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - -```shell -# dockerのaptリポジトリを追加 -add-apt-repository \ - "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ - $(lsb_release -cs) \ - stable" -``` +### dockerのaptリポジトリを追加 + add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) \ + stable" -```shell -# docker ceのインストール -apt-get update && 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) -``` +## docker ceのインストール +apt-get update && apt-get install docker-ce=18.06.2~ce~3-0~ubuntu -```shell -# Dockerデーモンをセットアップ +# デーモンをセットアップ cat > /etc/docker/daemon.json < /etc/docker/daemon.json <}} -{{% tab name="CentOS/RHEL 7.4+" %}} +{{< tab name="CentOS/RHEL 7.4+" codelang="bash" >}} -```shell # Docker CEのインストール ## リポジトリをセットアップ ### 必要なパッケージのインストール -yum install -y yum-utils device-mapper-persistent-data lvm2 -``` + yum install yum-utils device-mapper-persistent-data lvm2 -```shell -### Dockerリポジトリを追加 -yum-config-manager --add-repo \ - https://download.docker.com/linux/centos/docker-ce.repo -``` +### dockerパッケージ用のyumリポジトリを追加 +yum-config-manager \ + --add-repo \ + https://download.docker.com/linux/centos/docker-ce.repo -```shell -# Docker CEのインストール -yum update -y && yum install -y \ - containerd.io-1.2.13 \ - docker-ce-19.03.11 \ - docker-ce-cli-19.03.11 -``` +## docker ceのインストール +yum update && yum install docker-ce-18.06.2.ce -```shell ## /etc/docker ディレクトリを作成 mkdir /etc/docker -``` -```shell -# Dockerデーモンをセットアップ +# デーモンをセットアップ cat > /etc/docker/daemon.json < /etc/docker/daemon.json <}} {{< /tabs >}} -ブート時にdockerサービスを起動したい場合は、以下のコマンドを実行してください。 - -```shell -sudo systemctl enable docker -``` - 詳細については、[Dockerの公式インストールガイド](https://docs.docker.com/engine/installation/)を参照してください。 ## CRI-O @@ -201,85 +164,37 @@ sysctl --system ``` {{< tabs name="tab-cri-cri-o-installation" >}} -{{% tab name="Debian" %}} +{{< tab name="Ubuntu 16.04" codelang="bash" >}} -```shell -# Debian Unstable/Sid -echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_Unstable/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list -wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_Unstable/Release.key -O- | sudo apt-key add - -``` +# 必要なパッケージをインストールし、リポジトリを追加 +apt-get update +apt-get install software-properties-common -```shell -# Debian Testing -echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_Testing/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list -wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_Testing/Release.key -O- | sudo apt-key add - -``` +add-apt-repository ppa:projectatomic/ppa +apt-get update -```shell -# Debian 10 -echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_10/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list -wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_10/Release.key -O- | sudo apt-key add - -``` - -```shell -# Raspbian 10 -echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Raspbian_10/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list -wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Raspbian_10/Release.key -O- | sudo apt-key add - -``` - -その後CRI-Oをインストール -```shell -sudo apt-get install cri-o-1.17 -``` -{{% /tab %}} - -{{% tab name="Ubuntu 18.04, 19.04 and 19.10" %}} - -```shell -# パッケージリポジトリの設定 -. /etc/os-release -sudo sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/x${NAME}_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" -wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/x${NAME}_${VERSION_ID}/Release.key -O- | sudo apt-key add - -sudo apt-get update -``` - -```shell # CRI-Oをインストール -sudo apt-get install cri-o-1.17 -``` -{{% /tab %}} +apt-get install cri-o-1.11 -{{% tab name="CentOS/RHEL 7.4+" %}} +{{< /tab >}} +{{< tab name="CentOS/RHEL 7.4+" codelang="bash" >}} -```shell -# 事前に必要なものをインストール -# Install prerequisites -curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/CentOS_7/devel:kubic:libcontainers:stable.repo -curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable:cri-o:{{< skew latestVersion >}}.repo https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:{{< skew latestVersion >}}/CentOS_7/devel:kubic:libcontainers:stable:cri-o:{{< skew latestVersion >}}.repo -``` +# 必要なリポジトリを追加 +yum-config-manager --add-repo=https://cbs.centos.org/repos/paas7-crio-311-candidate/x86_64/os/ -```shell # CRI-Oをインストール -yum install -y cri-o -``` -{{% /tab %}} +yum install --nogpgcheck cri-o -{{% tab name="openSUSE Tumbleweed" %}} - -```shell -sudo zypper install cri-o -``` -{{% /tab %}} +{{< /tab >}} {{< /tabs >}} ### CRI-Oの起動 ``` -systemctl daemon-reload systemctl start crio ``` -詳細については、[CRI-Oインストールガイド]((https://github.com/kubernetes-sigs/cri-o#getting-started)を参照してください。 +詳細については、[CRI-Oインストールガイド](https://github.com/kubernetes-sigs/cri-o#getting-started)を参照してください。 ## Containerd @@ -287,14 +202,9 @@ systemctl start crio システムへContainerdをインストールするためには次のコマンドを実行します。 -### 事前準備 +### 必要な設定の追加 ```shell -cat > /etc/modules-load.d/containerd.conf <}} -{{% tab name="Ubuntu 16.04" %}} - -```shell -# containerdのインストール -## リポジトリの設定 -### HTTPS越しのリポジトリの使用をaptに許可するために、パッケージをインストール -apt-get update && apt-get install -y apt-transport-https ca-certificates curl software-properties-common -``` - -```shell -# Docker公式のGPG鍵を追加 -curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - -``` - -```shell -## Dockerのaptリポジトリを追加 -add-apt-repository \ - "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ - $(lsb_release -cs) \ - stable" -``` - -```shell -## containerdのインストール -apt-get update && apt-get install -y containerd.io -``` - -```shell -# containerdの設定 -mkdir -p /etc/containerd -containerd config default > /etc/containerd/config.toml -``` - -```shell -# containerdの再起動 -systemctl restart containerd -``` -{{% /tab %}} -{{% tab name="CentOS/RHEL 7.4+" %}} - -```shell -# containerdのインストール -## リポジトリの設定 -### 必要なパッケージのインストール -yum install -y yum-utils device-mapper-persistent-data lvm2 -``` - -```shell -## Dockerリポジトリを追加 -yum-config-manager \ - --add-repo \ - https://download.docker.com/linux/centos/docker-ce.repo -``` - -```shell -## containerdのインストール -yum update -y && yum install -y containerd.io -``` - -```shell -## containerdの設定 -mkdir -p /etc/containerd -containerd config default > /etc/containerd/config.toml -``` - -```shell -# Restart containerd -systemctl restart containerd -``` -{{% /tab %}} +{{< tab name="Ubuntu 16.04+" codelang="bash" >}} +apt-get install -y libseccomp2 +{{< /tab >}} +{{< tab name="CentOS/RHEL 7.4+" codelang="bash" >}} +yum install -y libseccomp +{{< /tab >}} {{< /tabs >}} -### systemd +### containerdのインストール -`systemd`のcgroupドライバーを使うには、`/etc/containerd/config.toml`内で`plugins.cri.systemd_cgroup = true`を設定してください。 -kubeadmを使う場合は[kubeletのためのcgroupドライバー](/ja/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)を手動で設定してください。 +[Containerdは定期的にリリース](https://github.com/containerd/containerd/releases)されますが、以下に示すコマンドで利用している値は、この手順が作成された時点での最新のバージョンにしたがって書かれています。より新しいバージョンとダウンロードするファイルのハッシュ値については[こちら](https://storage.googleapis.com/cri-containerd-release)で確認するようにしてください。 + +```shell +# 必要な環境変数をexportします。 +export CONTAINERD_VERSION="1.1.2" +export CONTAINERD_SHA256="d4ed54891e90a5d1a45e3e96464e2e8a4770cd380c21285ef5c9895c40549218" + +# containerdのtarボールをダウンロードします。 +wget https://storage.googleapis.com/cri-containerd-release/cri-containerd-${CONTAINERD_VERSION}.linux-amd64.tar.gz + +# ハッシュ値をチェックします。 +echo "${CONTAINERD_SHA256} cri-containerd-${CONTAINERD_VERSION}.linux-amd64.tar.gz" | sha256sum --check - + +# 解凍して展開します。 +tar --no-overwrite-dir -C / -xzf cri-containerd-${CONTAINERD_VERSION}.linux-amd64.tar.gz + +# containerdを起動します。 +systemctl start containerd +``` ## その他のCRIランタイム: frakti 詳細については[Fraktiのクイックスタートガイド](https://github.com/kubernetes/frakti#quickstart)を参照してください。 + From 9bc2a924df8bc6106dd38f7a4d848acf61c7f892 Mon Sep 17 00:00:00 2001 From: makocchi-git Date: Wed, 24 Jun 2020 20:04:18 +0900 Subject: [PATCH 3/7] follow 1.17 doc --- .../container-runtimes.md | 186 ++++++++++++------ 1 file changed, 127 insertions(+), 59 deletions(-) diff --git a/content/ja/docs/setup/production-environment/container-runtimes.md b/content/ja/docs/setup/production-environment/container-runtimes.md index a9604a7b59..b91a8f4fc2 100644 --- a/content/ja/docs/setup/production-environment/container-runtimes.md +++ b/content/ja/docs/setup/production-environment/container-runtimes.md @@ -3,14 +3,14 @@ title: CRIのインストール content_type: concept weight: 10 --- - +{{% capture overview %}} {{< feature-state for_k8s_version="v1.6" state="stable" >}} Podのコンテナを実行するために、Kubernetesはコンテナランタイムを使用します。 様々なランタイムのインストール手順は次のとおりです。 +{{% /capture %}} - - +{{% capture body %}} {{< caution >}} @@ -47,9 +47,16 @@ systemdと一緒に `cgroupfs` を使用するということは、2つの異な kubeletとDockerに `cgroupfs` を使用し、ノード上で実行されている残りのプロセスに `systemd` を使用するように設定されたノードが、 リソース圧迫下で不安定になる場合があります。 -あなたのコンテナランタイムとkubeletにcgroupドライバーとしてsystemdを使用するように設定を変更することはシステムを安定させました。 +コンテナランタイムとkubeletがcgroupドライバーとしてsystemdを使用するように設定を変更することでシステムは安定します。 以下のDocker設定の `native.cgroupdriver=systemd` オプションに注意してください。 +{{< caution >}} +すでにクラスターに組み込まれているノードのcgroupドライバーを変更することは非常におすすめしません。 +kubeletが一方のcgroupドライバーを使用してPodを作成した場合、コンテナランタイムを別のもう一方のcgroupドライバーに変更すると、そのような既存のPodのPodサンドボックスを再作成しようとするとエラーが発生する可能性があります。 +kubeletを再起動しても問題は解決しないでしょう。 +ワークロードからノードを縮退させ、クラスターから削除して再び組み込むことを推奨します。 +{{< /caution >}} + ## Docker それぞれのマシンに対してDockerをインストールします。 @@ -62,23 +69,24 @@ Kubernetesのリリースノートにある、Dockerの動作確認済み最新 {{< tab name="Ubuntu 16.04" codelang="bash" >}} # Docker CEのインストール ## リポジトリをセットアップ -### aptパッケージインデックスを更新 - apt-get update - ### HTTPS越しのリポジトリの使用をaptに許可するために、パッケージをインストール - apt-get update && apt-get install apt-transport-https ca-certificates curl software-properties-common +apt-get update && apt-get install -y \ + apt-transport-https ca-certificates curl software-properties-common gnupg2 ### Docker公式のGPG鍵を追加 - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - -### dockerのaptリポジトリを追加 - add-apt-repository \ - "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ - $(lsb_release -cs) \ - stable" +### Dockerのaptリポジトリを追加 +add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) \ + stable" -## docker ceのインストール -apt-get update && apt-get install docker-ce=18.06.2~ce~3-0~ubuntu +## Docker CEのインストール +apt-get update && apt-get install -y \ + containerd.io=1.2.10-3 \ + docker-ce=5:19.03.4~3-0~ubuntu-$(lsb_release -cs) \ + docker-ce-cli=5:19.03.4~3-0~ubuntu-$(lsb_release -cs) # デーモンをセットアップ cat > /etc/docker/daemon.json <}} +CRI-OのメジャーとマイナーバージョンはKubernetesのメジャーとマイナーバージョンと一致しなければなりません。 +詳細は[CRI-O互換性表](https://github.com/cri-o/cri-o)を参照してください。 +{{< /note >}} + +### 事前準備 ```shell modprobe overlay @@ -164,33 +179,55 @@ sysctl --system ``` {{< tabs name="tab-cri-cri-o-installation" >}} -{{< tab name="Ubuntu 16.04" codelang="bash" >}} +{{< tab name="Debian" codelang="bash" >}} +# Debian Unstable/Sid +echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_Unstable/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list +wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_Unstable/Release.key -O- | sudo apt-key add - -# 必要なパッケージをインストールし、リポジトリを追加 -apt-get update -apt-get install software-properties-common +# Debian Testing +echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_Testing/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list +wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_Testing/Release.key -O- | sudo apt-key add - -add-apt-repository ppa:projectatomic/ppa -apt-get update +# Debian 10 +echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_10/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list +wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_10/Release.key -O- | sudo apt-key add - -# CRI-Oをインストール -apt-get install cri-o-1.11 +# Raspbian 10 +echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Raspbian_10/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list +wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Raspbian_10/Release.key -O- | sudo apt-key add - +# CRI-Oのインストール +sudo apt-get install cri-o-1.17 {{< /tab >}} + +{{< tab name="Ubuntu 18.04, 19.04 and 19.10" codelang="bash" >}} +# リポジトリの設定 +. /etc/os-release +sudo sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/x${NAME}_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" +wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/x${NAME}_${VERSION_ID}/Release.key -O- | sudo apt-key add - +sudo apt-get update + +# CRI-Oのインストール +sudo apt-get install cri-o-1.17 +{{< /tab >}} + {{< tab name="CentOS/RHEL 7.4+" codelang="bash" >}} +# 必要なパッケージのインストール +yum-config-manager --add-repo=https://cbs.centos.org/repos/paas7-crio-115-release/x86_64/os/ -# 必要なリポジトリを追加 -yum-config-manager --add-repo=https://cbs.centos.org/repos/paas7-crio-311-candidate/x86_64/os/ - -# CRI-Oをインストール -yum install --nogpgcheck cri-o +# CRI-Oのインストール +yum install --nogpgcheck -y cri-o +{{< /tab >}} +{{< tab name="openSUSE Tumbleweed" codelang="bash" >}} +sudo zypper install cri-o {{< /tab >}} {{< /tabs >}} ### CRI-Oの起動 ``` +systemctl daemon-reload systemctl start crio ``` @@ -205,6 +242,11 @@ systemctl start crio ### 必要な設定の追加 ```shell +cat > /etc/modules-load.d/containerd.conf <}} -{{< tab name="Ubuntu 16.04+" codelang="bash" >}} -apt-get install -y libseccomp2 +{{< tab name="Ubuntu 16.04" codelang="bash" >}} +# containerdのインストール +## リポジトリの設定 +### HTTPS越しのリポジトリの使用をaptに許可するために、パッケージをインストール +apt-get update && apt-get install -y apt-transport-https ca-certificates curl software-properties-common + +### Docker公式のGPG鍵を追加 +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - + +### Dockerのaptリポジトリの追加 +add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) \ + stable" + +## containerdのインストール +apt-get update && apt-get install -y containerd.io + +# containerdの設定 +mkdir -p /etc/containerd +containerd config default > /etc/containerd/config.toml + +# containerdの再起動 +systemctl restart containerd {{< /tab >}} {{< tab name="CentOS/RHEL 7.4+" codelang="bash" >}} -yum install -y libseccomp +# containerdのインストール +## リポジトリの設定 +### 必要なパッケージのインストール +yum install -y yum-utils device-mapper-persistent-data lvm2 + +### Dockerのリポジトリの追加 +yum-config-manager \ + --add-repo \ + https://download.docker.com/linux/centos/docker-ce.repo + +## containerdのインストール +yum update -y && yum install -y containerd.io + +# containerdの設定 +mkdir -p /etc/containerd +containerd config default > /etc/containerd/config.toml + +# containerdの再起動 +systemctl restart containerd {{< /tab >}} {{< /tabs >}} -### containerdのインストール +### systemd -[Containerdは定期的にリリース](https://github.com/containerd/containerd/releases)されますが、以下に示すコマンドで利用している値は、この手順が作成された時点での最新のバージョンにしたがって書かれています。より新しいバージョンとダウンロードするファイルのハッシュ値については[こちら](https://storage.googleapis.com/cri-containerd-release)で確認するようにしてください。 - -```shell -# 必要な環境変数をexportします。 -export CONTAINERD_VERSION="1.1.2" -export CONTAINERD_SHA256="d4ed54891e90a5d1a45e3e96464e2e8a4770cd380c21285ef5c9895c40549218" - -# containerdのtarボールをダウンロードします。 -wget https://storage.googleapis.com/cri-containerd-release/cri-containerd-${CONTAINERD_VERSION}.linux-amd64.tar.gz - -# ハッシュ値をチェックします。 -echo "${CONTAINERD_SHA256} cri-containerd-${CONTAINERD_VERSION}.linux-amd64.tar.gz" | sha256sum --check - - -# 解凍して展開します。 -tar --no-overwrite-dir -C / -xzf cri-containerd-${CONTAINERD_VERSION}.linux-amd64.tar.gz - -# containerdを起動します。 -systemctl start containerd -``` +`systemd`のcgroupドライバーを使うには、`/etc/containerd/config.toml`内で`plugins.cri.systemd_cgroup = true`を設定してください。 +kubeadmを使う場合は[kubeletのためのcgroupドライバー](/ja/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)を手動で設定してください。 ## その他のCRIランタイム: frakti 詳細については[Fraktiのクイックスタートガイド](https://github.com/kubernetes/frakti#quickstart)を参照してください。 +{{% /capture %}} From b4e2cdfa593829d5a58351dfda72744124953a72 Mon Sep 17 00:00:00 2001 From: makocchi-git Date: Wed, 24 Jun 2020 20:19:57 +0900 Subject: [PATCH 4/7] fix caption --- .../docs/setup/production-environment/container-runtimes.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/content/ja/docs/setup/production-environment/container-runtimes.md b/content/ja/docs/setup/production-environment/container-runtimes.md index b91a8f4fc2..ddb52386f3 100644 --- a/content/ja/docs/setup/production-environment/container-runtimes.md +++ b/content/ja/docs/setup/production-environment/container-runtimes.md @@ -3,14 +3,13 @@ title: CRIのインストール content_type: concept weight: 10 --- -{{% capture overview %}} + {{< feature-state for_k8s_version="v1.6" state="stable" >}} Podのコンテナを実行するために、Kubernetesはコンテナランタイムを使用します。 様々なランタイムのインストール手順は次のとおりです。 -{{% /capture %}} -{{% capture body %}} + {{< caution >}} @@ -320,5 +319,4 @@ kubeadmを使う場合は[kubeletのためのcgroupドライバー](/ja/docs/set 詳細については[Fraktiのクイックスタートガイド](https://github.com/kubernetes/frakti#quickstart)を参照してください。 -{{% /capture %}} From 45cdfae246057ed05610ae049770530527444fd5 Mon Sep 17 00:00:00 2001 From: makocchi-git Date: Wed, 24 Jun 2020 20:21:27 +0900 Subject: [PATCH 5/7] tiny fix --- .../ja/docs/setup/production-environment/container-runtimes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/content/ja/docs/setup/production-environment/container-runtimes.md b/content/ja/docs/setup/production-environment/container-runtimes.md index ddb52386f3..26aa83ded8 100644 --- a/content/ja/docs/setup/production-environment/container-runtimes.md +++ b/content/ja/docs/setup/production-environment/container-runtimes.md @@ -9,6 +9,7 @@ Podのコンテナを実行するために、Kubernetesはコンテナランタ 様々なランタイムのインストール手順は次のとおりです。 + From bf33586da5fcc91c31869f6f2cc10df691dd657d Mon Sep 17 00:00:00 2001 From: makocchi-git Date: Mon, 6 Jul 2020 18:15:45 +0900 Subject: [PATCH 6/7] tiny fix --- .../setup/production-environment/container-runtimes.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/ja/docs/setup/production-environment/container-runtimes.md b/content/ja/docs/setup/production-environment/container-runtimes.md index 26aa83ded8..12e9bc27fe 100644 --- a/content/ja/docs/setup/production-environment/container-runtimes.md +++ b/content/ja/docs/setup/production-environment/container-runtimes.md @@ -60,13 +60,13 @@ kubeletを再起動しても問題は解決しないでしょう。 ## Docker それぞれのマシンに対してDockerをインストールします。 -バージョン18.06.2が推奨されていますが、1.11、1.12、1.13、17.03、18.09についても動作が確認されています。 +バージョン19.03.11が推奨されていますが、1.13.1、17.03、17.06、17.09、18.06、18.09についても動作が確認されています。 Kubernetesのリリースノートにある、Dockerの動作確認済み最新バージョンについてもご確認ください。 システムへDockerをインストールするには、次のコマンドを実行します。 {{< tabs name="tab-cri-docker-installation" >}} -{{< tab name="Ubuntu 16.04" codelang="bash" >}} +{{< tab name="Ubuntu 16.04+" codelang="bash" >}} # Docker CEのインストール ## リポジトリをセットアップ ### HTTPS越しのリポジトリの使用をaptに許可するために、パッケージをインストール @@ -111,7 +111,7 @@ systemctl restart docker # Docker CEのインストール ## リポジトリをセットアップ ### 必要なパッケージのインストール - yum install yum-utils device-mapper-persistent-data lvm2 +yum install -y yum-utils device-mapper-persistent-data lvm2 ### Dockerリポジトリの追加 yum-config-manager --add-repo \ @@ -314,7 +314,7 @@ systemctl restart containerd ### systemd `systemd`のcgroupドライバーを使うには、`/etc/containerd/config.toml`内で`plugins.cri.systemd_cgroup = true`を設定してください。 -kubeadmを使う場合は[kubeletのためのcgroupドライバー](/ja/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)を手動で設定してください。 +kubeadmを使う場合は[kubeletのためのcgroupドライバー](/ja/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#マスターノードのkubeletによって使用されるcgroupドライバーの設定)を手動で設定してください。 ## その他のCRIランタイム: frakti From 720411b167be5f85f30ce83a95005fe135256a5e Mon Sep 17 00:00:00 2001 From: makocchi-git Date: Mon, 6 Jul 2020 18:22:16 +0900 Subject: [PATCH 7/7] fix version --- .../ja/docs/setup/production-environment/container-runtimes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/ja/docs/setup/production-environment/container-runtimes.md b/content/ja/docs/setup/production-environment/container-runtimes.md index 12e9bc27fe..b6ef66143f 100644 --- a/content/ja/docs/setup/production-environment/container-runtimes.md +++ b/content/ja/docs/setup/production-environment/container-runtimes.md @@ -60,7 +60,7 @@ kubeletを再起動しても問題は解決しないでしょう。 ## Docker それぞれのマシンに対してDockerをインストールします。 -バージョン19.03.11が推奨されていますが、1.13.1、17.03、17.06、17.09、18.06、18.09についても動作が確認されています。 +バージョン19.03.4が推奨されていますが、1.13.1、17.03、17.06、17.09、18.06、18.09についても動作が確認されています。 Kubernetesのリリースノートにある、Dockerの動作確認済み最新バージョンについてもご確認ください。 システムへDockerをインストールするには、次のコマンドを実行します。