From a11ecef6f180d0fca21bb22eb8ae76dd6e51b663 Mon Sep 17 00:00:00 2001 From: Qiming Teng Date: Mon, 14 Mar 2022 20:36:51 +0800 Subject: [PATCH] Wrap long lines and fix a few nits in the text --- .../change-runtime-containerd.md | 57 +++++++++++-------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/content/en/docs/tasks/administer-cluster/migrating-from-dockershim/change-runtime-containerd.md b/content/en/docs/tasks/administer-cluster/migrating-from-dockershim/change-runtime-containerd.md index b18b340897..b4074a1385 100644 --- a/content/en/docs/tasks/administer-cluster/migrating-from-dockershim/change-runtime-containerd.md +++ b/content/en/docs/tasks/administer-cluster/migrating-from-dockershim/change-runtime-containerd.md @@ -4,20 +4,28 @@ weight: 8 content_type: task --- -This task outlines the steps needed to update your container runtime to containerd from Docker. It is applicable for cluster operators running Kubernetes 1.23 or earlier. Also this covers an example scenario for migrating from dockershim to containerd and alternative container runtimes can be picked from this [page](/docs/setup/production-environment/container-runtimes/). +This task outlines the steps needed to update your container runtime to containerd from Docker. It +is applicable for cluster operators running Kubernetes 1.23 or earlier. Also this covers an +example scenario for migrating from dockershim to containerd and alternative container runtimes +can be picked from this [page](/docs/setup/production-environment/container-runtimes/). ## {{% heading "prerequisites" %}} {{% thirdparty-content %}} -Install containerd. For more information see, [containerd's installation documentation](https://containerd.io/docs/getting-started/) and for specific prerequisite follow [this](/docs/setup/production-environment/container-runtimes/#containerd). +Install containerd. For more information see +[containerd's installation documentation](https://containerd.io/docs/getting-started/) +and for specific prerequisite follow +[the containerd guide](/docs/setup/production-environment/container-runtimes/#containerd). ## Drain the node -``` -# replace with the name of your node you are draining +```shell kubectl drain --ignore-daemonsets ``` + +Replace `` with the name of your node you are draining. + ## Stop the Docker daemon ```shell @@ -27,32 +35,33 @@ systemctl disable docker.service --now ## Install Containerd -This [page](/docs/setup/production-environment/container-runtimes/#containerd) contains detailed steps to install containerd. +Follow the [guide](/docs/setup/production-environment/container-runtimes/#containerd) +for detailed steps to install containerd. {{< tabs name="tab-cri-containerd-installation" >}} {{% 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). + 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: +1. Configure containerd: ```shell sudo mkdir -p /etc/containerd containerd config default | sudo tee /etc/containerd/config.toml ``` - -3. Restart containerd: +1. Restart containerd: ```shell sudo systemctl restart containerd ``` - {{% /tab %}} {{% tab name="Windows (PowerShell)" %}} -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: 1. Download containerd: @@ -89,24 +98,25 @@ Start a Powershell session, set `$Version` to the desired version (ex: `$Version ## Configure the kubelet to use containerd as its container runtime -Edit the file `/var/lib/kubelet/kubeadm-flags.env` and add the containerd runtime to the flags. `--container-runtime=remote` and `--container-runtime-endpoint=unix:///run/containerd/containerd.sock"` +Edit the file `/var/lib/kubelet/kubeadm-flags.env` and add the containerd runtime to the flags. +`--container-runtime=remote` and +`--container-runtime-endpoint=unix:///run/containerd/containerd.sock"`. -For users using kubeadm should consider the following: +Users using kubeadm should be aware that the `kubeadm` tool stores the CRI socket for each host as +an annotation in the Node object for that host. To change it you can execute the following command +on a machine that has the kubeadm `/etc/kubernetes/admin.conf` file. -The `kubeadm` tool stores the CRI socket for each host as an annotation in the Node object for that host. - -To change it you must do the following: - -Execute `kubectl edit no ` on a machine that has the kubeadm `/etc/kubernetes/admin.conf` file. +```shell +kubectl edit no +``` This will start a text editor where you can edit the Node object. - To choose a text editor you can set the `KUBE_EDITOR` environment variable. - Change the value of `kubeadm.alpha.kubernetes.io/cri-socket` from `/var/run/dockershim.sock` - to the CRI socket path of your choice (for example `unix:///run/containerd/containerd.sock`). + to the CRI socket path of your choice (for example `unix:///run/containerd/containerd.sock`). - Note that new CRI socket paths must be prefixed with `unix://` ideally. + Note that new CRI socket paths must be prefixed with `unix://` ideally. - Save the changes in the text editor, which will update the Node object. @@ -124,7 +134,7 @@ Run `kubectl get nodes -o wide` and containerd appears as the runtime for the no {{% thirdparty-content %}} -Finally if everything goes well remove docker +Finally if everything goes well, remove Docker. {{< tabs name="tab-remove-docker-enigine" >}} {{% tab name="CentOS" %}} @@ -152,3 +162,4 @@ sudo apt-get purge docker-ce docker-ce-cli ``` {{% /tab %}} {{< /tabs >}} +