In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to build a k8s cluster integrated with containerd". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to build a k8s cluster integrated with containerd".
Concept introduction
Cri (Container runtime interface)
Cri is a containerd plugin implementation of Kubernetes container runtime interface (CRI).
Cri is the container plug-in implementation of kubernetes's container runtime interface.
Containerd
Containerd is an industry-standard container runtime with an emphasis on simplicity, robustness and portability.
Containerd fully supports the CRI runtime specification of the running container.
Native plug-ins for cri above containerd1.1. It is built into containerd and enabled by default.
Cri-o
OCI-based implementation of Kubernetes Container Runtime Interface.
Kubernetes incubates the project cri-o for compatibility with cri and oci. To build a bridge between cri and oci. As a result, cri-o is compatible with both cri plug-in implementation and oci container runtime standards.
Oci (Open Container Initiative)
Oci is a project established by a number of companies and managed by the linux Foundation, dedicated to the formulation of container runtime standards and the development of runc.
Runc
Runc is a CLI tool for spawning and running containers according to the OCI specification.
Runc, a reference implementation of the OCI standard, is a CLI (command-line interface) tool that can be used to create and run containers.
Overview
Because docker embeds too much of its own content, in order to reduce the burden on the container. This time, containerd is selected as the container implementation of kubernetes.
Environmental preparation
Download the containerd binary package. I have compiled and packaged it here, including containerd, runc, crictl, ctr and so on.
Runc version: 1.0.1-dev
Containerd version: v1.2.4
Install containerd
Extract the binary package and generate a default file
Tar-C / usr/local/bin-xzf containerd-v1.2.4.tar.gzchmod astatx / usr/local/bin/*containerd config default > / etc/containerd/config.toml
The generated default configuration file notes that the address field of [grpc] defaults to / run/containerd/containerd.sock
For the meaning of other parameters in the configuration file, please see github address: https://github.com/containerd/containerd/blob/master/docs/man/containerd-config.toml.5.md
Write the file containerd.service in the / etc/systemd/system directory as follows
[Unit] Description=containerd container runtimeDocumentation= https://containerd.ioAfter=network.target[Service]ExecStartPre=/sbin/modprobe overlayExecStart=/usr/local/bin/containerdRestart=alwaysRestartSec=5Delegate=yesKillMode=processOOMScoreAdjust=-999LimitNOFILE=1048576# Having non-zero Limit*s causes performance problems due to accounting overhead# in the kernel. We recommend using cgroups to do container-local accounting.LimitNPROC=infinityLimitCORE= infinity[Install] WantedBy=multi-user.target
Start containerd
Systemctl enable containerdsystemctl restart containerdsystemctl status containerd
Look at the startup status of containerd. If it is running, there will be no problem. Let's test and pull the image of hub.
Test containerd
Ctr images pull docker.io/library/nginx:alpine
Seeing the output done indicates that containerd is running normally.
Connect to containerd using crictl
Next we use crictl to connect to containerd.
Modify the configuration file for crictl and write the following in / etc/crictl.yaml:
Runtime-endpoint: unix:///run/containerd/containerd.sockimage-endpoint: unix:///run/containerd/containerd.socktimeout: 10debug: false
Note here that runtime-endpoint and image-endpoint must be consistent with the configuration in / etc/containerd/config.toml.
Verify that the cri plug-in is available
Crictl pull nginx:alpinecrictl rmi nginx:alpinecrictl images
Crictl images lists all cri container images.
At this point, our cri + containerd has been integrated. Next we need to modify the kubeadm configuration for installation.
Import kubenetes offline Mirror package
Here we need to import the offline image package of K8s. Note here that kubernetes is the cri interface that is invoked, so you also need to import the image from the cri plug-in.
Cri Import Image command (cri Import Image):
Ctr cri load images.tar
Containerd Import Image command (containerd Import Image):
Ctr images import images.tar
Modify kubelet configuration and kubeadm installation configuration
Add the following configuration to the [Service] node of the kubelet configuration file 10-kubeadm.conf:
Environment= "KUBELET_EXTRA_ARGS=--container-runtime=remote-runtime-request-timeout=15m-container-runtime-endpoint=unix:///run/containerd/containerd.sock"
Add to the kubeadm configuration file kubeadm.yaml
ApiVersion: kubeadm.k8s.io/v1beta1kind: InitConfigurationnodeRegistration: criSocket: / run/containerd/containerd.sock name: containerd
At this point, the integration of containerd and kubernetes is complete. The following can be installed directly.
Thank you for your reading, the above is the content of "how to build a k8s cluster integrated with containerd". After the study of this article, I believe you have a deeper understanding of how to build a k8s cluster integrated with containerd, and the specific use needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.