containerd二进制安装

news2024/9/22 7:30:24

文章目录

  • 安装版本(截止2024年9月10日)
  • 方式1:yum安装(不推荐)
    • 设置主机名
    • 设置IP
    • 获取阿里YUM源
    • 查询containerd
    • 安装
    • 验证与启动服务
    • 测试命令
  • 方式2:二进制安装(推荐)
    • 安装之前先了解containerd、cni、runc三者的关系
    • 设置主机名
    • 设置IP
    • 下载文件
    • containerd安装
      • 创建containerd服务
      • 将官方配置文件写入
      • 设置开机自启
    • runc安装
    • cni安装
    • 旧版本配置config.toml
      • 生成默认配置
      • 修改
    • 高版本hostpath问题
      • 生成默认配置文件
      • 创建镜像源配置文件
      • 设置配置文件位置
    • 重启启动
    • 测试
    • 成功

安装版本(截止2024年9月10日)

containerd 1.7.22

runc 1.1.12

cni 1.5.1

方式1:yum安装(不推荐)

设置主机名

hostnamectl set-hostname node1 

设置IP

vim /etc/sysconfig/network-scripts/ifcfg-enp0s3
重点设置以下几项

BOOTPROTO="static"
IPADDR=192.168.3.31
NETMASK=255.255.255.0
GATEWAY=192.168.3.1
DNS1=223.5.5.5

获取阿里YUM源

wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo

查询containerd

yum list | grep containerd

安装

yum install -y containerd.io

验证与启动服务

rpm -qa | grep containerd
systemctl enable containerd
systemctl start containerd
systemctl status containerd

测试命令

ctr version

方式2:二进制安装(推荐)

安装之前先了解containerd、cni、runc三者的关系

containerd 作为容器运行时,负责管理容器的生命周期和资源分配。它调用 RunC 来创建和运行容器,并通过调用 CNI 插件为容器配置网络。

54034d57ad166bcc91c0c0ec050995c9.png

设置主机名

hostnamectl set-hostname node1 

设置IP

vim /etc/sysconfig/network-scripts/ifcfg-enp0s3
重点设置以下几项

BOOTPROTO="static"
IPADDR=192.168.3.31
NETMASK=255.255.255.0
GATEWAY=192.168.3.1
DNS1=223.5.5.5

下载文件

containerd 1.7.22
runc 1.1.12
cni 1.5.1

containerd安装

$ tar Cxzvf /usr/local containerd-1.7.22-linux-amd64.tar.gz
bin/
bin/containerd-shim-runc-v2
bin/containerd-shim
bin/ctr
bin/containerd-shim-runc-v1
bin/containerd
bin/containerd-stress

创建containerd服务

mkdir -p /usr/local/lib/systemd/system/
touch /usr/local/lib/systemd/system/containerd.service
vim /usr/local/lib/systemd/system/containerd.service

将官方配置文件写入

官方配置文件

# Copyright The containerd Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target local-fs.target

[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/containerd

Type=notify
Delegate=yes
KillMode=process
Restart=always
RestartSec=5

# 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=infinity
LimitCORE=infinity

# Comment TasksMax if your systemd version does not supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
OOMScoreAdjust=-999

[Install]
WantedBy=multi-user.target

设置开机自启

systemctl daemon-reload
systemctl enable --now containerd

runc安装

# runc安装
install -m 755 runc.amd64 /usr/local/sbin/runc

cni安装

mkdir -p /opt/cni/bin
tar Cxzvf /opt/cni/bin cni-plugins-linux-amd64-v1.5.1.tgz

旧版本配置config.toml

生成默认配置

mkdir /etc/containerd
containerd config default > /etc/containerd/config.toml
vim /etc/containerd/config.toml

修改

"https://xxxxxx.mirror.aliyuncs.com"自己登录阿里云换成自己的链接

# 原来是这样registry.k8s.io/pause:3.8
sandbox_image = "registry.aliyuncs.com/google_containers/pause:3.8"
# 原来是false
SystemdCgroup = true

# 镜像配置
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
  [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
    endpoint = ["https://xxxxxxxxx.mirror.aliyuncs.com"]
  [plugins."io.containerd.grpc.v1.cri".registry.mirrors."k8s.gcr.io"]
    endpoint = ["registry.aliyuncs.com/google_containers"]
或者是这样
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
  [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
    endpoint = ["https://xxxxxxxxx.mirror.aliyuncs.com","registry.aliyuncs.com/google_containers"]

高版本hostpath问题

WARN[0000] DEPRECATION: The `mirrors` property of `[plugins."io.containerd.grpc.v1.cri".registry]` is deprecated since containerd v1.5 and will be removed in containerd v2.1. Use `config_path` instead.

官方原文
原文解决方案链接

生成默认配置文件

mkdir /etc/containerd
containerd config default > /etc/containerd/config.toml
vim /etc/containerd/config.toml

创建镜像源配置文件

mkdir -p /etc/containerd/certs.d/docker.io/
mkdir -p /etc/containerd/certs.d/k8s.gcr.io/
cat<<EOF > /etc/containerd/certs.d/docker.io/hosts.toml
server = "https://docker.io"

[host."https://xxxxxxxxx.mirror.aliyuncs.com"]
  capabilities = ["pull", "resolve"]
EOF

cat<<EOF > /etc/containerd/certs.d/docker.io/hosts.toml
server = "https://docker.io"

[host."registry.aliyuncs.com/google_containers"]
  capabilities = ["pull", "resolve"]
EOF

设置配置文件位置

[plugins."io.containerd.grpc.v1.cri".registry]
config_path = "/etc/containerd/certs.d"

51a05dfa81df2dec981cbb578d57dc21.png

重启启动

systemctl restart containerd
systemctl status containerd

测试

# docker.io
ctr images pull docker.io/library/ubuntu:latest
ctr images del docker.io/library/ubuntu:latest

# k8s的镜像仓库叫k8s.gcr.io,没配镜像就要指定registry.cn-hangzhou.aliyuncs.com/google_containers
ctr images pull registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.2
ctr images del registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.2

成功

[root@node3 containerd]# ctr images pull docker.io/library/ubuntu:latest
docker.io/library/ubuntu:latest:                                                  resolved       |++++++++++++++++++++++++++++++++++++++|
index-sha256:8a37d68f4f73ebf3d4efafbcf66379bf3728902a8038616808f04e34a9ab63ee:    done           |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:d35dfc2fe3ef66bcc085ca00d3152b482e6cafb23cdda1864154caf3b19094ba: done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:31e907dcc94a592a57796786399eb004dcbba714389fa615f5efa05a91316356:    done           |++++++++++++++++++++++++++++++++++++++|
config-sha256:edbfe74c41f8a3501ce542e137cf28ea04dd03e6df8c9d66519b6ad761c2598a:   done           |++++++++++++++++++++++++++++++++++++++|
elapsed: 9.9 s                                                                    total:  28.3 M (2.9 MiB/s)
unpacking linux/amd64 sha256:8a37d68f4f73ebf3d4efafbcf66379bf3728902a8038616808f04e34a9ab63ee...
done: 672.496318ms

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2122681.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

游戏创作的梦想之地!EE GAMES 创作者社区上线,VipSkill产学研结合迈开重大步伐

&#xff25;&#xff25; &#xff27;&#xff21;&#xff2d;&#xff25;&#xff33; 官网 EE GAMES创作者社区 是一个怎样的平台&#xff1f; EE GAMES 创作者社区&#xff0c;是专注于链接每一位游戏创作者&#xff0c;提供全方位服务的游戏领域垂类社区。 这里不仅…

信号完整性仿真中关于铜箔粗糙度的三篇文献

首先放文献&#xff1a; Paul G. Huray. "Surface Roughness", in The Foundations of Signal Integrity. John Wiley & Sons, Inc., Hoboken, New Jersey. 2009. Paul G. Huray. "Impact of Copper Surface Texture on Loss: A model That Works", …

算法工程师重生之第三天( 链表理论基础 移除链表元素 设计链表 反转链表 )

参考文献 代码随想录 一、 链表理论基础 什么是链表&#xff0c;链表是一种通过指针串联在一起的线性结构&#xff0c;每一个节点由两部分组成&#xff0c;一个是数据域一个是指针域&#xff08;存放指向下一个节点的指针&#xff09;&#xff0c;最后一个节点的指针域指向nu…

关于粒子滤波的解析

粒子滤波流程 基本原理&#xff1a;随机选取预测域的 N NN 个点&#xff0c;称为粒子。以此计算出预测值&#xff0c;并算出在测量域的概率&#xff0c;即权重&#xff0c;加权平均就是最优估计。之后按权重比例&#xff0c;重采样&#xff0c;进行下次迭代。 初始状态&#x…

抖音评论区截流脚本软件详细使用教学,抖音私域获客引流的五种方法。

1.先说下什么是抖音截流玩法&#xff0c;截流顾名思义就是在别的博主的视频下面去截流评论潜在流量&#xff0c;然后用评论文案的形式或者其它方式吸引用户加我们的私域~ 玩截流一定不是主动去私信别人&#xff0c;这个就不叫截流了&#xff0c;且一个账号私信多了一定会降权和…

MIT6.824 课程-MapReduce

MapReduce&#xff1a;在大型集群上简化数据处理 概要 MapReduce是一种编程模型&#xff0c;它是一种用于处理和生成大型数据集的实现。用户通过指定一个用来处理键值对(Key/Value)的map函数来生成一个中间键值对集合。然后&#xff0c;再指定一个reduce函数&#xff0c; 它用…

OpenCV-模板匹配

文章目录 一、简介1.定义与原理2.算法与方法3.参数解释 二、代码实现1.读取数据2.检查图像是否成功加载3.获取模板的高度和宽度4.模板匹配5.计算匹配区域坐标6.显示图像7.全部代码 三、总结 一、简介 在OpenCV中&#xff0c;模型匹配&#xff08;或称为模板匹配&#xff09;是…

机器学习-逻辑回归原理及其公式

逻辑回归&#xff08;Logistic Regression&#xff09;是一种广泛应用于分类任务的统计学方法&#xff0c;尤其是在二分类问题中表现尤为突出。尽管它的名字中包含“回归”&#xff0c;但实际上逻辑回归是一种分类算法。逻辑回归的目标是预测一个样本属于某一类别的概率&#x…

如何在本地Windows运行hadoop

我们在本地运行hadoop的时候&#xff0c;发现了报错&#xff1a; 两种情况&#xff1a; 1、没有配置winutils 这种情况只能从本地上传文件到hdfs&#xff0c;但是不能从hdfs下载文件到windows本地&#xff0c;也无法在本地运行MapReduce的过程。如果连上传的时候都报这种错误…

Linux shell编程学习笔记78:cpio命令——文件和目录归档工具

0 前言 在Linux系统中&#xff0c;除了tar命令&#xff0c;我们还可以使用cpio命令来进行文件和目录的归档。 1 cpio命令的功能&#xff0c;帮助信息&#xff0c;格式&#xff0c;选项和参数说明 1.1 cpio命令的功能 cpio 名字来自 "copy in, copy out"&#xf…

NLP基础及其代码-tokenizer

基础知识 NLP-分词器&#xff1a;SentencePiece【参考Chinese-LLaMA-Alpaca在通用中文语料上训练的20K中文词表并与原版LLaMA模型的32K词表进行合并的代码】_sentencepiece 中文训练-CSDN博客 【OpenLLM 008】大模型基础组件之分词器-万字长文全面解读LLM中的分词算法与分词器…

链表题目训练

https://leetcode.cn/problems/remove-linked-li​​​​​​st-elements/description/第一题&#xff1a;移除链表元素 https://leetcode.cn/problems/remove-linked-li​​​​​​st-elements/description/ 第二题&#xff1a;反转链表 https://leetcode.cn/problems/reve…

前端JS常见面试题

数据双向绑定 Bug解决 集成工作涉及 版本node 依赖包报错 版本问题&#xff01;&#xff01;&#xff01;ElementUI、Cesium、ant-design 配置、代码和其他 混入 在Vue中&#xff0c;混入&#xff08;Mixins&#xff09;是一种非常有用的功能&#xff0c;它允许你创建可复…

C语言-数据结构 无向图迪杰斯特拉算法(Dijkstra)邻接矩阵存储

在迪杰斯特拉中&#xff0c;相比普利姆算法&#xff0c;是从顶点出发的一条路径不断的寻找最短路径&#xff0c;在实现的时候需要创建三个辅助数组&#xff0c;记录算法的关键操作&#xff0c;分别是Visited[MAXVEX]记录顶点是否被访问&#xff0c;教材上写的final数组但作用是…

springboot请求传参常用模板

注释很详细&#xff0c;直接上代码 项目结构 源码 HelloController package com.amoorzheyu.controller;import com.amoorzheyu.pojo.User; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.*;import java.ti…

选择开放式耳机时应该注重哪些?值得入手的四款蓝牙耳机推荐

在选择开放式耳机时&#xff0c;以下这些方面需要重点关注&#xff1a; 舒适度方面&#xff1a; 设计与材质考量&#xff1a;耳挂和耳翼的设计必须合理&#xff0c;能够与不同的耳朵形状及大小相契合&#xff0c;保证佩戴牢固且不会过紧&#xff0c;防止对耳朵造成挤压。例如…

【解决bug之路】npm install node-sass(^4.14.1)连环报错解决!!!(Windows)

有关node-sass的深入分析可参考&#xff1a;又报gyp ERR&#xff01;为什么有那么多人被node-sass 坑过&#xff1f; 主要有如下三方面错误&#xff0c;请自查&#xff1a; 1.node&#xff0c;npm版本需与node-sass版本匹配&#xff0c;像node-sass&#xff08;^4.14.1&#x…

李沐关于大模型应用及职业发展的分享

前几天看了 李沐 在上海交大做的一个 分享 &#xff0c; 主要分享了他对于大模型的一些看法和他个人的经历。 我很喜欢李沐&#xff0c;技术厉害&#xff0c;看起来比较接地气&#xff0c;录制的 课程 也比较容易看懂。 大模型的应用 下面这张图是他对当前大模型应用的看法。…

前端学习笔记-Web APls篇-03

Dom事件进阶 1.事件流 事件流和两个阶段说明 事件流指的是事件完整执行过程中的流动路径 说明&#xff1a;假设页面里有个div&#xff0c;当触发事件时&#xff0c;会经历两个阶段&#xff0c;分别是捕获阶段、冒泡阶段简单来说&#xff1a;捕获阶段是 从父到子【大到小】 …

【鸿蒙开发工具报错】Build task failed. Open the Run window to view details.

Build task failed. Open the Run window to view details. 问题描述 在使用deveco-studio 开发工具进行HarmonyOS第一个应用构建开发时&#xff0c;通过Previewer预览页面时报错&#xff0c;报错信息为&#xff1a;Build task failed. Open the Run window to view details.…