-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs to change Container runtime #30141
Changes from 3 commits
1ad36f6
1a5066b
63f34ed
f1aade1
b95629f
60efd5d
138a3d9
ec6061c
deb40dd
f97bf9f
8eb2aa7
36ad07c
704bf04
ec48473
8b73923
7dc0d47
c38dc24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,115 @@ | ||||||||||||
--- | ||||||||||||
title: "Migrating Container runtime from dockershim to containerd" | ||||||||||||
weight: 10 | ||||||||||||
content_type: task | ||||||||||||
--- | ||||||||||||
|
||||||||||||
- Drain Node | ||||||||||||
``` | ||||||||||||
# replace <node-to-drain> with the name of your node you are draining | ||||||||||||
kubectl drain <node-to-drain> --ignore-daemonsets | ||||||||||||
``` | ||||||||||||
- Stop docker | ||||||||||||
Debanitrkl marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
``` | ||||||||||||
systemctl stop kubelet | ||||||||||||
systemctl stop docker | ||||||||||||
``` | ||||||||||||
- Install & start containerd | ||||||||||||
|
||||||||||||
|
||||||||||||
### For linux systems | ||||||||||||
Debanitrkl marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
Use the following commands to install Containerd on your system: | ||||||||||||
|
||||||||||||
Install and configure prerequisites: | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the guide seems to be duplicating steps that already existing the in the "installing a container runtime" page: the steps can be generalized as:
i know that it works and i've seen users already do it, but before we merge such a guide for hotswap SIG node must tell us if this is even supported and if something unpredictable can happen. cgroup (drivers)? proper cleanup after uninstalling the old CR - logs, container state, etc? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we do want a “dummies guide to” here, because the Docker deprecation is already worrying quite a few people. |
||||||||||||
|
||||||||||||
```shell | ||||||||||||
cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf | ||||||||||||
overlay | ||||||||||||
br_netfilter | ||||||||||||
EOF | ||||||||||||
|
||||||||||||
sudo modprobe overlay | ||||||||||||
sudo modprobe br_netfilter | ||||||||||||
|
||||||||||||
# Setup required sysctl params, these persist across reboots. | ||||||||||||
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf | ||||||||||||
net.bridge.bridge-nf-call-iptables = 1 | ||||||||||||
net.ipv4.ip_forward = 1 | ||||||||||||
net.bridge.bridge-nf-call-ip6tables = 1 | ||||||||||||
EOF | ||||||||||||
|
||||||||||||
# Apply sysctl params without reboot | ||||||||||||
sudo sysctl --system | ||||||||||||
``` | ||||||||||||
|
||||||||||||
Install containerd: | ||||||||||||
|
||||||||||||
1. Install the `containerd.io` package from the official Docker repositories. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why use the Docker repository for this? I would recommend that people fetch it from their I suspect that telling people to get containerd from Docker is liable to add to the confusion. |
||||||||||||
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). | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
|
||||||||||||
2. Configure containerd: | ||||||||||||
|
||||||||||||
```shell | ||||||||||||
sudo mkdir -p /etc/containerd | ||||||||||||
containerd config default | sudo tee /etc/containerd/config.toml | ||||||||||||
``` | ||||||||||||
|
||||||||||||
3. Restart containerd: | ||||||||||||
|
||||||||||||
```shell | ||||||||||||
sudo systemctl restart containerd | ||||||||||||
``` | ||||||||||||
### For windows powershell | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider splitting this into two task pages, one for Linux nodes and one for Windows nodes. |
||||||||||||
|
||||||||||||
Start a Powershell session, set `$Version` to the desired version (ex: `$Version=1.4.3`), | ||||||||||||
and then run the following commands: | ||||||||||||
|
||||||||||||
1. Download containerd: | ||||||||||||
|
||||||||||||
```powershell | ||||||||||||
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 | ||||||||||||
``` | ||||||||||||
|
||||||||||||
2. Extract and configure: | ||||||||||||
|
||||||||||||
```powershell | ||||||||||||
Copy-Item -Path ".\bin\" -Destination "$Env:ProgramFiles\containerd" -Recurse -Force | ||||||||||||
cd $Env:ProgramFiles\containerd\ | ||||||||||||
.\containerd.exe config default | Out-File config.toml -Encoding ascii | ||||||||||||
|
||||||||||||
# Review the configuration. Depending on setup you may want to adjust: | ||||||||||||
# - the sandbox_image (Kubernetes pause image) | ||||||||||||
# - cni bin_dir and conf_dir locations | ||||||||||||
Get-Content config.toml | ||||||||||||
|
||||||||||||
# (Optional - but highly recommended) Exclude containerd from Windows Defender Scans | ||||||||||||
Add-MpPreference -ExclusionProcess "$Env:ProgramFiles\containerd\containerd.exe" | ||||||||||||
``` | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This piece of code block has also been taken from the documentation here https://github.com/kubernetes/website/blob/main/content/en/docs/setup/production-environment/container-runtimes.md#container-runtimes, but yes I will add more descriptions to make this more clear and if required separately group them. |
||||||||||||
|
||||||||||||
3. Start containerd: | ||||||||||||
|
||||||||||||
```powershell | ||||||||||||
.\containerd.exe --register-service | ||||||||||||
Start-Service containerd | ||||||||||||
``` | ||||||||||||
- configure kubelet to use containerd | ||||||||||||
Edit the file `/var/lib/kubelet/kubeadm-flags.env` and add the containerd runtime to the flags. `--container-runtime=remote` and `--container-runtimeendpoint=unix:///run/containerd/containerd.sock"` | ||||||||||||
Debanitrkl marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
|
||||||||||||
- restart kubelet | ||||||||||||
`systemctl start kubelet` | ||||||||||||
|
||||||||||||
- verify pods are running | ||||||||||||
Run `kubectl get nodes -o wide` and containerd appears as the runtime for the node we just changed. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is not rendered on separate lines if that was your original intent. And same for the ones below and above it as well. |
||||||||||||
|
||||||||||||
- finally if everything goes well remove docker | ||||||||||||
``` | ||||||||||||
apt purge docker-ce docker-ce-cli | ||||||||||||
OR | ||||||||||||
yum remove docker-ce docker-ce-cli | ||||||||||||
``` | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't try this myself took it from the reference here https://kruyt.org/migrate-docker-containerd-kubernetes/. Also, I guess given the formatting style of this doc a separate code section would be better There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would use https://kubernetes.io/docs/contribute/style/hugo-shortcodes/#tabs and have a tab for Debian-heritage systems and another for RedHat-heritage systems. |
||||||||||||
|
||||||||||||
|
||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems to be an opinionated suggestion for transition.
what if the user wishes to use cri-o instead of containerd?
in the CR popularity survey we did before docker was first, followed by containerd and then cri-o.
so if containerd wins here by being second, it makes sense, but cri-o might not be very happy about this.
cc @saschagrunert for feedback on CRI-O.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reaching out! I think the whole guide is opinionated to a particular setup, which is probably fine. Mentioning CRI-O as alternative container runtime to containerd would make us very happy, though. 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, i think it's worth denoting with a sentence near the top of the guide that this covers an example scenario for migrating from dockershim to containerd and that alternative container runtime such as cri-o can be picked from the https://kubernetes.io/docs/setup/production-environment/container-runtimes/ page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds like a good way to head off issues around https://kubernetes.io/docs/contribute/style/content-guide/#third-party-content
We make an exception for container runtimes - these are necessary out-of-project packages that you must have to make a working Kubernetes cluster - but we don't like to be in the business of picking favorites.