From 5edbf56ec55ee97deb84a34aa63632c9e5792518 Mon Sep 17 00:00:00 2001 From: Shannon Kularathna Date: Tue, 8 Mar 2022 23:09:36 +0000 Subject: [PATCH 1/3] Add draft content for migrating to dockerd --- .../migrate-dockershim-dockerd.md | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 content/en/docs/tasks/administer-cluster/migrating-from-dockershim/migrate-dockershim-dockerd.md diff --git a/content/en/docs/tasks/administer-cluster/migrating-from-dockershim/migrate-dockershim-dockerd.md b/content/en/docs/tasks/administer-cluster/migrating-from-dockershim/migrate-dockershim-dockerd.md new file mode 100644 index 0000000000..2660644a6d --- /dev/null +++ b/content/en/docs/tasks/administer-cluster/migrating-from-dockershim/migrate-dockershim-dockerd.md @@ -0,0 +1,116 @@ +--- +title: "Migrate Docker Engine nodes from dockershim to cri-dockerd" +weight: 9 +content_type: task +--- + +{{% thirdparty-content %}} + +This page shows you how to migrate your Docker Engine nodes to use `cri-dockerd` +instead of dockershim. Follow these steps if your clusters run Kubernetes 1.23 +or earlier and you want to continue using Docker Engine after +you upgrade to Kubernetes 1.24 and later, or if you just want to move off the +dockershim component. + +## What is cri-dockerd? {#what-is-cri-dockerd} + +In Kubernetes 1.23 and earlier, Docker Engine used a component called the +dockershim to interact with Kubernetes system components such as the kubelet. +The dockershim component is deprecated and will be removed in Kubernetes 1.24. A +third-party replacement, `cri-dockerd`, is available. The `cri-dockerd` adapter +lets you use Docker Engine through the {{}}. + +{{}} +If you already use `cri-dockerd`, you aren't affected by the dockershim removal. +Before you begin, [Check whether your nodes use the dockershim](/docs/tasks/administer-cluster/migrating-from-dockershim/find-out-runtime-you-use/). +{{}} + +If you want to migrate to `cri-dockerd` so that you can continue using Docker +Engine as your container runtime, you should do the following for each affected +node: + +1. Install `cri-dockerd`. +1. Cordon and drain the node. +1. Configure the kubelet to use `cri-dockerd`. +1. Restart the kubelet. +1. Verify that the node is healthy. + +Test the migration on non-critical nodes first. + +You should perform the following steps for each node that you want to migrate +to `cri-dockerd`. + +## {{% heading "prerequisites" %}} + +* [`cri-dockerd`](https://github.com/mirantis/cri-dockerd#build-and-install) + installed and started on each node. +* A [network plugin](/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/). + +## Cordon and drain the node + +1. Cordon the node to stop new Pods scheduling on it: + + ```shell + kubectl cordon + ``` + Replace `` with the name of the node. + +1. Drain the node to safely evict running Pods: + + ```shell + kubectl drain \ + --ignore-daemonsets + ``` + +## Configure the kubelet to use cri-dockerd + +The following steps apply to clusters set up using the kubeadm tool. If you use +a different tool, you should modify the kubelet using the configuration +instructions for that tool. + +1. Open `/var/lib/kubelet/kubeadm-flags.env` on each affected node. +1. Modify the `--container-runtime-endpoint` flag to + `unix:///var/run/cri-dockerd.sock`. + +The kubeadm tool stores the node's socket as an annotation on the `Node` object +in the control plane. To modify this socket for each affected node: + +1. Edit the YAML representation of the `Node` object: + + ```shell + KUBECONFIG=/path/to/admin.conf kubectl edit no + ``` + Replace the following: + + * `/path/to/admin.conf`: the path to the kubectl configuration file, + `admin.conf`. + * ``: the name of the node you want to modify. + +1. Change `kubeadm.alpha.kubernetes.io/cri-socket` from + `/var/run/dockershim.sock` to `unix:///var/run/cri-dockerd.sock`. +1. Save the changes. The `Node` object is updated on save. + +## Restart the kubelet + +```shell +systemctl start kubelet +``` + +## Verify that the node is healthy + +To check whether the node uses the `cri-dockerd` endpoint, follow the +instructions in [Find out which runtime you use](/docs/tasks/administer-cluster/migrating-from-dockershim/find-out-runtime-you-use/). +The `--container-runtime-endpoint` flag for the kubelet should be `unix:///var/run/cri-dockerd.sock`. + +## Uncordon the node + +Uncordon the node to let Pods schedule on it: + +```shell +kubectl uncordon +``` + +## {{% heading "whatsnext" %}} + +* Read the [dockershim removal FAQ](/dockershim/). +* [Learn how to migrate from Docker Engine with dockershim to containerd](/docs/tasks/administer-cluster/migrating-from-dockershim/change-runtime-containerd/). \ No newline at end of file From b9a7ec6f351158b49420820083d9db23ccb5a3ae Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Wed, 30 Mar 2022 22:18:36 +0100 Subject: [PATCH 2/3] Update cri-dockerd switchover docs for v1.24 --- .../migrate-dockershim-dockerd.md | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/content/en/docs/tasks/administer-cluster/migrating-from-dockershim/migrate-dockershim-dockerd.md b/content/en/docs/tasks/administer-cluster/migrating-from-dockershim/migrate-dockershim-dockerd.md index 2660644a6d..7bdb1bd023 100644 --- a/content/en/docs/tasks/administer-cluster/migrating-from-dockershim/migrate-dockershim-dockerd.md +++ b/content/en/docs/tasks/administer-cluster/migrating-from-dockershim/migrate-dockershim-dockerd.md @@ -7,17 +7,20 @@ content_type: task {{% thirdparty-content %}} This page shows you how to migrate your Docker Engine nodes to use `cri-dockerd` -instead of dockershim. Follow these steps if your clusters run Kubernetes 1.23 -or earlier and you want to continue using Docker Engine after -you upgrade to Kubernetes 1.24 and later, or if you just want to move off the -dockershim component. +instead of dockershim. If you want to switch away from using dockershim and still +use Docker Engine to run containers in Kubernetes, you can follow these steps. +If you want to upgrade to Kubernetes v{{< skew currentVersion >}} and your +existing cluster relies on dockershim, you will have to migrate away and +`cri-dockerd` is one of your options. + +To learn more about the removal of dockershim, read the [FAQ page](/dockershim). ## What is cri-dockerd? {#what-is-cri-dockerd} -In Kubernetes 1.23 and earlier, Docker Engine used a component called the -dockershim to interact with Kubernetes system components such as the kubelet. -The dockershim component is deprecated and will be removed in Kubernetes 1.24. A -third-party replacement, `cri-dockerd`, is available. The `cri-dockerd` adapter +In Kubernetes 1.23 and earlier, you could use Docker Engine with Kubernetes, +relying on a built-in component of Kubernetes named _dockershim_. +The dockershim component was removed in the Kubernetes 1.24 release; however, +a third-party replacement, `cri-dockerd`, is available. The `cri-dockerd` adapter lets you use Docker Engine through the {{}}. {{}} @@ -93,7 +96,7 @@ in the control plane. To modify this socket for each affected node: ## Restart the kubelet ```shell -systemctl start kubelet +systemctl restart kubelet ``` ## Verify that the node is healthy From 83514e6dc155c51714ecbe49b11b05653886d7d8 Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Wed, 30 Mar 2022 23:15:09 +0100 Subject: [PATCH 3/3] Tweak page introduction Co-authored-by: Shannon Kularathna --- .../migrate-dockershim-dockerd.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/content/en/docs/tasks/administer-cluster/migrating-from-dockershim/migrate-dockershim-dockerd.md b/content/en/docs/tasks/administer-cluster/migrating-from-dockershim/migrate-dockershim-dockerd.md index 7bdb1bd023..b9bdcd9a2d 100644 --- a/content/en/docs/tasks/administer-cluster/migrating-from-dockershim/migrate-dockershim-dockerd.md +++ b/content/en/docs/tasks/administer-cluster/migrating-from-dockershim/migrate-dockershim-dockerd.md @@ -7,11 +7,13 @@ content_type: task {{% thirdparty-content %}} This page shows you how to migrate your Docker Engine nodes to use `cri-dockerd` -instead of dockershim. If you want to switch away from using dockershim and still -use Docker Engine to run containers in Kubernetes, you can follow these steps. -If you want to upgrade to Kubernetes v{{< skew currentVersion >}} and your -existing cluster relies on dockershim, you will have to migrate away and -`cri-dockerd` is one of your options. +instead of dockershim. You should follow these steps in these scenarios: + + * You want to switch away from dockershim and still use Docker Engine to run + containers in Kubernetes. + * You want to upgrade to Kubernetes v{{< skew currentVersion >}} and your + existing cluster relies on dockershim, in which case you must migrate + from dockershim and `cri-dockerd` is one of your options. To learn more about the removal of dockershim, read the [FAQ page](/dockershim).