Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support containerd #3040

Merged
merged 3 commits into from
Aug 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deploy/iso/minikube-iso/package/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ menu "System tools"
source "$BR2_EXTERNAL_MINIKUBE_PATH/package/hv-kvp-daemon/Config.in"
source "$BR2_EXTERNAL_MINIKUBE_PATH/package/gluster/Config.in"
source "$BR2_EXTERNAL_MINIKUBE_PATH/package/vbox-guest/Config.in"
source "$BR2_EXTERNAL_MINIKUBE_PATH/package/containerd-bin/Config.in"
endmenu
18 changes: 18 additions & 0 deletions deploy/iso/minikube-iso/package/containerd-bin/Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
config BR2_PACKAGE_CONTAINERD_BIN
bool "containerd-bin"
default y
depends on BR2_x86_64
depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
depends on BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS
depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_USE_MMU # lvm2
depends on !BR2_STATIC_LIBS # lvm2
depends on !BR2_TOOLCHAIN_USES_MUSL # lvm2
select BR2_PACKAGE_RUNC_MASTER
select BR2_PACKAGE_BTRFS_PROGS
select BR2_PACKAGE_LIBSECCOMP
select BR2_PACKAGE_LIBGPGME
select BR2_PACKAGE_LVM2
select BR2_PACKAGE_LVM2_APP_LIBRARY
select BR2_PACKAGE_UTIL_LINUX_LIBMOUNT
select BR2_PACKAGE_LIBGLIB2
69 changes: 69 additions & 0 deletions deploy/iso/minikube-iso/package/containerd-bin/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
root = "/var/lib/containerd"
state = "/run/containerd"
oom_score = 0

[grpc]
address = "/run/containerd/containerd.sock"
uid = 0
gid = 0
max_recv_message_size = 16777216
max_send_message_size = 16777216

[debug]
address = ""
uid = 0
gid = 0
level = ""

[metrics]
address = ""
grpc_histogram = false

[cgroup]
path = ""

[plugins]
[plugins.cgroups]
no_prometheus = false
[plugins.cri]
stream_server_address = ""
stream_server_port = "10010"
enable_selinux = false
sandbox_image = "k8s.gcr.io/pause:3.1"
stats_collect_period = 10
systemd_cgroup = false
enable_tls_streaming = false
max_container_log_line_size = 16384
[plugins.cri.containerd]
snapshotter = "overlayfs"
no_pivot = true
[plugins.cri.containerd.default_runtime]
runtime_type = "io.containerd.runtime.v1.linux"
runtime_engine = ""
runtime_root = ""
[plugins.cri.containerd.untrusted_workload_runtime]
runtime_type = ""
runtime_engine = ""
runtime_root = ""
[plugins.cri.cni]
bin_dir = "/opt/cni/bin"
conf_dir = "/etc/cni/net.d"
conf_template = ""
[plugins.cri.registry]
[plugins.cri.registry.mirrors]
[plugins.cri.registry.mirrors."docker.io"]
endpoint = ["https://registry-1.docker.io"]
[plugins.diff-service]
default = ["walking"]
[plugins.linux]
shim = "containerd-shim"
runtime = "runc"
runtime_root = ""
no_shim = false
shim_debug = false
[plugins.scheduler]
pause_threshold = 0.02
deletion_threshold = 0
mutation_threshold = 100
schedule_delay = "0s"
startup_delay = "100ms"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sha256 5eecd50a9aee472535d1e5564df72225a9e0447f11d36fb7d72e4a8bd74b065d v1.2.0-beta.0.tar.gz
56 changes: 56 additions & 0 deletions deploy/iso/minikube-iso/package/containerd-bin/containerd-bin.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
################################################################################
#
# containerd
#
################################################################################
CONTAINERD_BIN_VERSION = v1.2.0-beta.0
CONTAINERD_BIN_SITE = https://github.com/containerd/containerd/archive
CONTAINERD_BIN_SOURCE = $(CONTAINERD_BIN_VERSION).tar.gz
CONTAINERD_BIN_DEPENDENCIES = host-go libgpgme
CONTAINERD_BIN_GOPATH = $(@D)/_output
CONTAINERD_BIN_ENV = \
CGO_ENABLED=1 \
GOPATH="$(CONTAINERD_BIN_GOPATH)" \
GOBIN="$(CONTAINERD_BIN_GOPATH)/bin" \
PATH=$(CONTAINERD_BIN_GOPATH)/bin:$(BR_PATH)

CONTAINERD_BIN_COMPILE_SRC = $(CONTAINERD_BIN_GOPATH)/src/github.com/containerd/containerd

define CONTAINERD_BIN_USERS
- -1 containerd-admin -1 - - - - -
- -1 containerd -1 - - - - -
endef

define CONTAINERD_BIN_CONFIGURE_CMDS
mkdir -p $(CONTAINERD_BIN_GOPATH)/src/github.com/containerd
ln -sf $(@D) $(CONTAINERD_BIN_COMPILE_SRC)
endef

define CONTAINERD_BIN_BUILD_CMDS
PWD=$(CONTAINERD_BIN_COMPILE_SRC) $(CONTAINERD_BIN_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) binaries
endef

define CONTAINERD_BIN_INSTALL_TARGET_CMDS
$(INSTALL) -Dm755 \
$(@D)/bin/containerd \
$(TARGET_DIR)/usr/bin
$(INSTALL) -Dm755 \
$(@D)/bin/containerd-shim \
$(TARGET_DIR)/usr/bin
$(INSTALL) -Dm755 \
$(@D)/bin/ctr \
$(TARGET_DIR)/usr/bin
$(INSTALL) -Dm644 \
$(BR2_EXTERNAL_MINIKUBE_PATH)/package/containerd-bin/config.toml \
$(TARGET_DIR)/etc/containerd/config.toml
endef

define CONTAINERD_BIN_INSTALL_INIT_SYSTEMD
$(INSTALL) -Dm755 \
$(BR2_EXTERNAL_MINIKUBE_PATH)/package/containerd-bin/containerd.service \
$(TARGET_DIR)/usr/lib/systemd/system/containerd.service
$(call link-service,containerd.service)
$(call link-service,containerd-shutdown.service)
endef

$(eval $(generic-package))
29 changes: 29 additions & 0 deletions deploy/iso/minikube-iso/package/containerd-bin/containerd.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network-online.target minikube-automount.service
Requires=minikube-automount.service

[Service]
EnvironmentFile=-/etc/sysconfig/containerd
EnvironmentFile=-/etc/sysconfig/containerd.minikube
EnvironmentFile=/var/run/minikube/env
Environment=GOTRACEBACK=crash
ExecStartPre=/sbin/modprobe overlay
ExecStart=/usr/bin/containerd \
$CONTAINERD_OPTIONS \
$CONTAINERD_MINIKUBE_OPTIONS \
--root ${PERSISTENT_DIR}/var/lib/containerd
TasksMax=8192
Delegate=yes
KillMode=process
LimitNOFILE=1048576
# 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
TimeoutStartSec=0
Restart=on-abnormal

[Install]
WantedBy=multi-user.target
22 changes: 22 additions & 0 deletions docs/alternative_runtimes.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,25 @@ $ minikube start \
--extra-config=kubelet.image-service-endpoint=/var/run/crio/crio.sock \
--bootstrapper=kubeadm
```

### Using containerd

To use [containerd](https://github.com/containerd/containerd) as the container runtime, run:

```shell
$ minikube start \
--network-plugin=cni \
--container-runtime=containerd \
--bootstrapper=kubeadm
```

Or you can use the extended version:

```shell
$ minikube start \
--network-plugin=cni \
--extra-config=kubelet.container-runtime=remote \
--extra-config=kubelet.container-runtime-endpoint=unix:///run/containerd/containerd.sock \
--extra-config=kubelet.image-service-endpoint=unix:///run/containerd/containerd.sock \
--bootstrapper=kubeadm
```
5 changes: 5 additions & 0 deletions pkg/minikube/bootstrapper/kubeadm/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ func SetContainerRuntime(cfg map[string]string, runtime string) map[string]strin
cfg["container-runtime-endpoint"] = "/var/run/crio/crio.sock"
cfg["image-service-endpoint"] = "/var/run/crio/crio.sock"
cfg["runtime-request-timeout"] = "15m"
case "containerd":
cfg["container-runtime"] = "remote"
cfg["container-runtime-endpoint"] = "unix:///run/containerd/containerd.sock"
cfg["image-service-endpoint"] = "unix:///run/containerd/containerd.sock"
cfg["runtime-request-timeout"] = "15m"
default:
cfg["container-runtime"] = runtime
}
Expand Down