[root@k8s-node02 k8s-install]# ctr plugin ls TYPE ID PLATFORMS STATUS io.containerd.grpc.v1 cri linux/amd64 ok
2 单独设置一个分区,将ftype=1
格式化xfs分区并且设置ftype=1
1
mkfs.xfs -f -n ftype=1/dev/sda3
挂在分区
1 2 3 4
# 临时挂在 mount /dev/sda3 /var/lib/containerd # 永久挂在 vi /etc/fstab
查看插件启动状态
1 2 3 4 5 6 7 8
[root@k8s-node02 k8s-install]# ctr plugins ls TYPE ID PLATFORMS STATUS io.containerd.content.v1 content - ok io.containerd.snapshotter.v1 aufs linux/amd64 skip io.containerd.snapshotter.v1 btrfs linux/amd64 skip io.containerd.snapshotter.v1 devmapper linux/amd64 error io.containerd.snapshotter.v1 native linux/amd64 ok io.containerd.snapshotter.v1 overlayfs linux/amd64 ok
COMMANDS: plugins, plugin 提供有关容器插件的信息,例如:ctr plugin ls version 版本信息 containers, c, container 管理容器 content 管理内容 events, event 事件显示容器事件 images, image, i 管理镜像 leases 管理租赁 namespaces, namespace, ns 管理命名空间 pprof 为containerd提供golang Pprof输出 run 运行容器 snapshots, snapshot 管理快照 tasks, t, task 管理任务 install 安装一个新的包 oci OCI tools shim 与shim直接交互 help, h Shows a list of commands or helpfor one command
GLOBAL OPTIONS: --debug 打开日志的调试输出 --address value, -a value containerd的GRPC服务器地址 (default: "/run/containerd/containerd.sock") [$CONTAINERD_ADDRESS] --timeout value CTR命令的总超时时间(默认值:0) --connect-timeout value 连接到容器的超时时间(默认值:0) --namespace value, -n value 命名空间与命令一起使用 (default: "default") [$CONTAINERD_NAMESPACE] --help, -h show help --version, -v 打印版本
查看镜像
1 2 3
ctr images list 或 ctr i ls # 查看指定命名空间下的镜像 ctr -n k8s.io images list
命名空间查看
1
ctr namespaces list 或 ctr ns list
镜像标记
1
ctr -n k8s.io images tag registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.2 k8s.gcr.io/pause:3.2
[root@k8s-node02 k8s-install]# crictl --help NAME: crictl - client for CRI USAGE: crictl [global options] command [command options] [arguments...] COMMANDS: attach 连接到一个运行的容器 create 创建一个新容器 exec 在运行的容器中运行命令 version 显示运行时版本信息 images, image, img 镜像 inspect 显示一个或多个容器的状态 inspecti 返回一个或多个镜像的状态 imagefsinfo 返回映像文件系统信息 inspectp 显示一个或多个pod的状态 logs 获取容器日志 port-forward 将本地端口转发给pod ps 容器列表 pull 拉去镜像 run 在沙箱中运行一个新容器 runp 运行一个新pod rm 移除container rmi 移除镜像 rmp 移除pod pods pods列表 start 启动一个或多个已创建的容器 info 启动一个或多个创建的容器显示容器运行时的信息 stop 停止一个或多个运行中的容器 stopp 停止一个或多个运行中的pod update 更新一个或多个运行中的容器 config Getandset crictl client configuration options stats 列出容器资源使用统计信息 statsp 列出pod资源使用统计信息 completion 输出shell完成代码 help, h Shows a list of commands or help forone command
GLOBAL OPTIONS: --config value, -c value Location of the client config file. If not specified and the default does not exist, the program's directory is searched as well (default: "/etc/crictl.yaml") [$CRI_CONFIG_FILE] --debug, -D Enable debug mode (default: false) --image-endpoint value, -i value Endpoint of CRI image manager service (default: uses 'runtime-endpoint' setting) [$IMAGE_SERVICE_ENDPOINT] --runtime-endpoint value, -r value Endpoint of CRI container runtime service (default: uses in order the first successful one of [unix:///var/run/dockershim.sock unix:///run/containerd/containerd.sock unix:///run/crio/crio.sock unix:///var/run/cri-dockerd.sock]). Default is now deprecated and the endpoint should be set instead. [$CONTAINER_RUNTIME_ENDPOINT] --timeout value, -t value Timeout of connecting to the server in seconds (e.g. 2s, 20s.). 0 or less is set to default (default: 2s) --help, -h show help (default: false) --version, -v print the version (default: false)
拉取镜像
1
crictl pull docker.io/library/redis:latest
查看运行的容器
1
crictl ps
查看运行中的pod
1
crictl pods
查看pod详细信息
1
crictl inspectp eea1584366c1d
查看容器详细信息
1
crictl inspect 5389d4e04a974
查看容器镜像详细信息
1
crictl inspecti 70f5e18fddce8
九 异常问题
(1)问题一
runc: symbol lookup error: runc: undefined symbol: seccomp_notify_respond
解决方式一:源码编译runc
1 2 3 4 5 6
yum install -y epel-release yum install -y golang yum install -y libseccomp-devel git clone https://github.com/opencontainers/runc cd runc make&& make install
解决方式二:
1 2 3 4 5
[root@k8s-node02 k8s-install]# ctr task start -d nginx ctr: failed to create shim task: OCI runtime create failed: unable to retrieve OCI runtime error (open /run/containerd/io.containerd.runtime.v2.task/default/nginx/log.json: no such file or directory): runc did not terminate successfully: exit status 127: unknown