External Plugins

v2 Runtime

其实是shim程序(进程),这个shim程序(进程)会启动一个ttrpc服务 TaskService,containerd通过这个shim程序再去启动容器。

containerd负责启动这个shim进程。

The runtime v2 interface allows resolving runtimes to binaries on the system. These binaries are used to start the shim process for containerd and allows containerd to manage those containers using the runtime shim api returned by the binary.

ctr run --runtime io.containerd.runc.v1 指定了runtime name是 io.containerd.runc.v1,这里指定了runtime name是 runc,runtime version是v1,会转换成io.containerd.runc.v1 -> containerd-shim-runc-v1

Proxy Plugins

proxy plugin通常是一个gRPC服务,gRPC服务也是一个独立的程序,独立启动。 containerd会发送 gRPC请求。
The currently supported types are snapshot and content.

  1. version = 2
  2. [proxy_plugins]
  3. [proxy_plugins.customsnapshot]
  4. type = "snapshot"
  5. address = "/var/run/mysnapshotter.sock"

Snapshotter 是一种gRPC服务,提供container启动的文件系统。

Built-in Plugins

查看plugin信息:ctr plugins ls

Every plugin can have its own section using the pattern [plugins.”.“].

  1. version = 2
  2. [plugins]
  3. [plugins."io.containerd.monitor.v1.cgroups"]
  4. no_prometheus = false

有很多内置的gRPC服务,包括CRI、Snapshotter等

CRI 提供了CRI协议的接口服务,比如可以直接对接K8s。