k8s系列-05-k8s集群搭建方案对比,以及containerd是什么,如何安装

网友投稿 257 2022-09-11

k8s系列-05-k8s集群搭建方案对比,以及containerd是什么,如何安装

​​

​​主旨​​

k8s在使用过程中,有多个部署方案,我们该如何做选择呢,各自更加适用于什么环境呢,为什么k8s中使用的是containerd,他和docker之间有什么关系呢?

​​集群​​

可选方案

方案来源

易难度

高可用

部署方式

kubeadm

官方

适中

自定义

容器

kubespray

官方

简单

生产级

容器

kubernetes-the-hard-way

社区

困难

自定义

二进制

可以根据自己的实际需求,自行选择哈,咱们这个k8s系列,主要使用kubespray和kubernetes-the-hard-way这两个方式来延伸。

​​containerd​​

官网介绍:

containerd is available as a daemon for Linux and Windows. It manages the complete container lifecycle of its host system, from image transfer and storage to container execution and supervision to low-level storage to network attachments and beyond.

以上内容翻译过来就是:containerd是Linux和Windows的守护程序。它管理其主机系统的完整容器生命周期,从图像传输和存储到容器执行和监督,再到低级存储到网络附件等等。

containerd是容器虚拟化技术,从docker中剥离出来,形成开放容器接口(OCI)标准的一部分。

Containerd 负责干下面这些事情:

•管理容器的生命周期(从创建容器到销毁容器)•拉取/推送容器镜像•存储管理(管理镜像及容器数据的存储)•调用 runC 运行容器(与 runC 等容器运行时交互)•管理容器网络接口及网络

注意:Containerd 被设计成嵌入到一个更大的系统中,而不是直接由开发人员或终端用户使用。

我们可以从下面几点来理解为什么需要独立的 containerd:

•继续从整体 docker 引擎中分离出的项目(开源项目的思路)•可以被 Kubernets CRI 等项目使用(通用化)•为广泛的行业合作打下基础(就像 runC 一样)

就简单说到这里吧,都是概念性的事儿,都是小问题,理解即可。

​​安装containerd​​

首先我们登录github官网上,可以看到截止今日最新版本是1.6.1,咱们这里就根据这个版本来进行安装。

[yunweijia@localhost ~]$ mkdir containerd[yunweijia@localhost ~]$ cd containerd/# 上传软件包[yunweijia@localhost containerd]$ lscri-containerd-1.6.1-linux-amd64.tar.gz[yunweijia@localhost containerd]$

解压:

[yunweijia@localhost containerd]$ tar xf cri-containerd-1.6.1-linux-amd64.tar.gz [yunweijia@localhost containerd]$ lscri-containerd-1.6.1-linux-amd64.tar.gz etc opt usr[yunweijia@localhost containerd]$

删除一些我们不需要的内容:

[yunweijia@localhost containerd]$ rm -rf opt/

拷贝:

[yunweijia@localhost containerd]$ sudo cp -r etc /[yunweijia@localhost containerd]$ sudo cp -r usr /

生成默认的配置文件,不知道为啥sudo报错没权限,我直接切换到了root用户进行该操作:

[yunweijia@localhost containerd]$ su root密码:[root@localhost containerd]# [root@localhost containerd]# containerd config default > /etc/containerd/config.toml [root@localhost containerd]# exitexit[yunweijia@localhost containerd]$

开启自启动并重启:

[yunweijia@localhost containerd]$ sudo systemctl enable containerdCreated symlink from /etc/systemd/system/multi-user.target.wants/containerd.service to /etc/systemd/system/containerd.service.[yunweijia@localhost containerd]$ sudo systemctl restart containerd[yunweijia@localhost containerd]$ [yunweijia@localhost containerd]$ sudo systemctl status containerd● containerd.service - containerd container runtime Loaded: loaded (/etc/systemd/system/containerd.service; enabled; vendor preset: disabled) Active: active (running) since 一 2022-03-07 11:38:41 CST; 1min 44s ago Docs: Process: 38862 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS) Main PID: 38864 (containerd) Tasks: 8 Memory: 47.3M CGroup: /system.slice/containerd.service └─38864 /usr/local/bin/containerd3月 07 11:38:41 localhost.localdomain containerd[38864]: time="2022-03-07T11:38:41.713543190+08:00" level=error msg="failed to load cni during init, please che...i config"3月 07 11:38:41 localhost.localdomain containerd[38864]: time="2022-03-07T11:38:41.713701928+08:00" level=info msg=serving... address=/run/containerd/containerd.sock.ttrpc3月 07 11:38:41 localhost.localdomain containerd[38864]: time="2022-03-07T11:38:41.713726263+08:00" level=info msg=serving... address=/run/containerd/containerd.sock3月 07 11:38:41 localhost.localdomain containerd[38864]: time="2022-03-07T11:38:41.713760788+08:00" level=info msg="containerd successfully booted in 0.077920s"3月 07 11:38:41 localhost.localdomain containerd[38864]: time="2022-03-07T11:38:41.730233904+08:00" level=info msg="Start subscribing containerd event"3月 07 11:38:41 localhost.localdomain containerd[38864]: time="2022-03-07T11:38:41.730310137+08:00" level=info msg="Start recovering state"3月 07 11:38:41 localhost.localdomain containerd[38864]: time="2022-03-07T11:38:41.730404474+08:00" level=info msg="Start event monitor"3月 07 11:38:41 localhost.localdomain containerd[38864]: time="2022-03-07T11:38:41.730417359+08:00" level=info msg="Start snapshots syncer"3月 07 11:38:41 localhost.localdomain containerd[38864]: time="2022-03-07T11:38:41.730425694+08:00" level=info msg="Start cni network conf syncer for default"3月 07 11:38:41 localhost.localdomain containerd[38864]: time="2022-03-07T11:38:41.730432477+08:00" level=info msg="Start streaming server"Hint: Some lines were ellipsized, use -l to show in full.[yunweijia@localhost containerd]$

至此,搭建完毕,下一篇我们将介绍如何使用containerd。

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:【K8S】k8s pv,pvc无法删除问题
下一篇:做营销有哪些不可不知的套路?
相关文章

 发表评论

暂时没有评论,来抢沙发吧~