• CentOS二进制安装Containerd


    Containerd有两种安装包∶

            1>.  第一种是containerd-xxx,这种包用于单机测试没问题,不包runC,需要提前安装。

            2>.  第二种是cri-containerd-cni-xxx,包含runC和k8s里的所需要的相关文件。k8s集群里需要用到此包,呈然包含runC,但是依赖系统中的seccomp(安全计算模式,是一种限制容器调用系统资源的模式。)

    一.  安装cri-containerd:

            1.  下载软件包:

    1. [root@node2 ~]# wget -c https://github.com/containerd/containerd/releases/
    2. download/v1.6.6/cri-containerd-1.6.6-linux-amd64.tar.gz

            2.  解压软件包:

    [root@node2 ~]# tar xf cri-containerd-1.6.6-linux-amd64.tar.gz

            3.  复制cotainerd运行时至文件系统:

    [root@node2 ~]# cp usr/local/bin/* /usr/local/bin/

            4.  添加cotainerd.service至服务脚本:

    [root@node2 ~]# cp etc/systemd/system/containerd.service /usr/lib/systemd/system/

            5.  生成配置文件:

    1. [root@node2 ~]# mkdir /etc/containerd
    2. [root@node2 ~]# containerd config default > /etc/containerd/config.toml

            6.  启动服务:

    1. [root@node2 ~]# systemctl start containerd
    2. ##查看containerd服务状态
    3. [root@node2 ~]# systemctl status containerd

            7.  验证ctr版本:

     二.  安装runC:

            1.  去网址上下载runc软件包:https://github.com/opencontainers/runc/releases。

            2.  复制runc:

    [root@node2 ~]# mv runc.amd64 /usr/sbin/runc

            3.  添加执行权限:

    [root@node2 ~]# chmod +x /usr/sbin/runc

            4.  查看runc版本:

     三.  修改containerd配置文件:

            1.  结合runc使用systemd cgroup驱动,在" /etc/containerd/config.toml "中设置,进行两处修改。

    1. [root@node2 ~]# vim /etc/containerd/config.toml
    2. ........
    3. [plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
    4. ...
    5. [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
    6. SystemdCgroup = true ## 将该参数的值改为true
    7. ........
    8. [plugins."io.containerd.grpc.v1.cri".registry]
    9. [plugins."io.containerd.grpc.v1.cri".registry.mirrors]
    10. ##添加两行参数,使用阿里云的镜像加速器
    11. [plugins."io.containerd.grpc.v1.cri".registry.mirrors."aliyuncs.com"]
    12. endpoint = ["https://t2alg15i.mirror.aliyuncs.com"]

            2.  再次重启containerd:

    [root@node2 ~]# systemctl restart containerd

            3. 运行命令并验证:containerd 相比于docker,多了namespace概念,每个image和container都会在各自的namespaq下可见,目前k8s会使用k8s.io作为命名空间∶ctr ns Is 可以查看命名空间。

    ctr是containerd提供的命令行工具,更多命令说明请执行∶ctr-h。

    1. [root@node2 ~]# ctr -h
    2. NAME:
    3. ctr -
    4. __
    5. _____/ /______
    6. / ___/ __/ ___/
    7. / /__/ /_/ /
    8. \___/\__/_/
    9. containerd CLI
    10. USAGE:
    11. ctr [global options] command [command options] [arguments...]
    12. VERSION:
    13. v1.6.6
    14. DESCRIPTION:
    15. ctr is an unsupported debug and administrative client for interacting
    16. with the containerd daemon. Because it is unsupported, the commands,
    17. options, and operations are not guaranteed to be backward compatible or
    18. stable from release to release of the containerd project.
    19. COMMANDS:
    20. plugins, plugin provides information about containerd plugins
    21. version print the client and server versions
    22. containers, c, container manage containers
    23. content manage content
    24. events, event display containerd events
    25. images, image, i manage images
    26. leases manage leases
    27. namespaces, namespace, ns manage namespaces
    28. pprof provide golang pprof outputs for containerd
    29. run run a container
    30. snapshots, snapshot manage snapshots
    31. tasks, t, task manage tasks
    32. install install a new package
    33. oci OCI tools
    34. shim interact with a shim directly
    35. help, h Shows a list of commands or help for one command
    36. GLOBAL OPTIONS:
    37. --debug enable debug output in logs
    38. --address value, -a value address for containerd's GRPC server (default: "/run/containerd/containerd.sock") [$CONTAINERD_ADDRESS]
    39. --timeout value total timeout for ctr commands (default: 0s)
    40. --connect-timeout value timeout for connecting to containerd (default: 0s)
    41. --namespace value, -n value namespace to use with commands (default: "default") [$CONTAINERD_NAMESPACE]
    42. --help, -h show help
    43. --version, -v print the version

  • 相关阅读:
    字符型液晶显示器LCD 1602的显示控制(Keil+Proteus)
    Delphi 报错 Type androidx.collection.ArraySet is defined multiple times
    【英语:基础进阶_读写专项训练】G4.图表类写作
    Java第12章-Iterator接口、Map接口、Collections类
    论文投稿前需要检查下参考文献
    原生K8S部署pig微服务项目
    【LeetCode-中等题】17. 电话号码的字母组合
    Apache DolphinScheduler源码分析(超详细)
    【JavaScript】DOM增删改的操作
    JavaScript中的运算符
  • 原文地址:https://blog.csdn.net/NancyLCL/article/details/126903425