Skip to content

Use containerd cri plugin from init #79

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
34 changes: 24 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ image_build: &image_build
load kubernetes-docker-image-cache-control-plane
;;
cri-containerd)
load cri-containerd
;;
*)
echo "Unknown $KUBE_RUNTIME"
Expand Down Expand Up @@ -196,8 +195,6 @@ jobs:

pkg-kubelet:
<<: *linuxkit_pkg_build
pkg-cri-containerd:
<<: *linuxkit_pkg_build
pkg-kube-e2e-test:
<<: *linuxkit_pkg_build

Expand All @@ -220,6 +217,13 @@ jobs:
environment:
- KUBE_RUNTIME: docker
- KUBE_NETWORK: bridge
image-docker-calico:
<<: *image_build
# Needs to be configured/enabled by CircleCI person
#resource_class: large
environment:
- KUBE_RUNTIME: docker
- KUBE_NETWORK: calico

image-cri-containerd-weave:
<<: *image_build
Expand All @@ -231,6 +235,11 @@ jobs:
environment:
- KUBE_RUNTIME: cri-containerd
- KUBE_NETWORK: bridge
image-cri-containerd-calico:
<<: *image_build
environment:
- KUBE_RUNTIME: cri-containerd
- KUBE_NETWORK: calico

push-pkgs-to-hub:
docker:
Expand Down Expand Up @@ -275,7 +284,6 @@ jobs:
cp .circleci/content-trust.key ~/.docker/trust/private/b056f84873aa0be205dfe826afa6e7458120c9569dd19a2a84154498fb1165d5.key

linuxkit pkg push --nobuild pkg/kubelet
linuxkit pkg push --nobuild pkg/cri-containerd
linuxkit pkg push --nobuild pkg/kube-e2e-test
linuxkit pkg push --nobuild pkg/kubernetes-docker-image-cache-common
linuxkit pkg push --nobuild pkg/kubernetes-docker-image-cache-control-plane
Expand All @@ -292,9 +300,6 @@ workflows:
- pkg-kubelet:
requires:
- dependencies
- pkg-cri-containerd:
requires:
- dependencies
- pkg-kube-e2e-test:
requires:
- dependencies
Expand All @@ -317,16 +322,24 @@ workflows:
- pkg-kubelet
- pkg-kubernetes-docker-image-cache-common
- pkg-kubernetes-docker-image-cache-control-plane
- image-docker-calilco:
requires:
- dependencies
- pkg-kubelet
- pkg-kubernetes-docker-image-cache-common
- pkg-kubernetes-docker-image-cache-control-plane
- image-cri-containerd-weave:
requires:
- dependencies
- pkg-kubelet
- pkg-cri-containerd
- image-cri-containerd-bridge:
requires:
- dependencies
- pkg-kubelet
- pkg-cri-containerd
- image-cri-containerd-calico:
requires:
- dependencies
- pkg-kubelet

- push-pkgs-to-hub:
# We want everything to have passed, which is a bit
Expand All @@ -335,11 +348,12 @@ workflows:
requires:
- lint
- pkg-kubelet
- pkg-cri-containerd
- pkg-kube-e2e-test
- pkg-kubernetes-docker-image-cache-common
- pkg-kubernetes-docker-image-cache-control-plane
- image-docker-weave
- image-docker-bridge
- image-docker-calico
- image-cri-containerd-weave
- image-cri-containerd-bridge
- image-cri-containerd-calico
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ kube-*-cmdline
kube-*-initrd.img
kube-*-state
kube-weave.yaml
kube-calico.yaml
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ KUBE_RUNTIME ?= docker
KUBE_NETWORK ?= weave

KUBE_NETWORK_WEAVE ?= v2.2.1
KUBE_NETWORK_CALICO ?= v3.1

ifeq ($(shell uname -s),Darwin)
KUBE_FORMATS ?= iso-efi
Expand All @@ -27,10 +28,14 @@ yml/weave.yml: kube-weave.yaml
kube-weave.yaml:
curl -L -o $@ https://cloud.weave.works/k8s/v1.8/net?v=$(KUBE_NETWORK_WEAVE)

yml/calico.yml: kube-calico.yaml

kube-calico.yaml:
curl -L -o $@ https://docs.projectcalico.org/${KUBE_NETWORK_CALICO}/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml

.PHONY: update-hashes
update-hashes:
set -e ; for tag in $$(linuxkit pkg show-tag pkg/kubelet) \
$$(linuxkit pkg show-tag pkg/cri-containerd) \
$$(linuxkit pkg show-tag pkg/kubernetes-docker-image-cache-common) \
$$(linuxkit pkg show-tag pkg/kubernetes-docker-image-cache-control-plane) ; do \
image=$${tag%:*} ; \
Expand All @@ -41,7 +46,7 @@ update-hashes:
clean:
rm -f -r \
kube-*-kernel kube-*-cmdline kube-*-state kube-*-initrd.img *.iso \
kube-weave.yaml
kube-weave.yaml kube-calico.yaml

.PHONY: refresh-image-caches
refresh-image-caches:
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ To build the default OS images:
make all
```

By default this will build images using Docker Engine for execution. To instead use cri-containerd use:
By default this will build images using Docker Engine for execution and weave for networking. To instead use cri-containerd and calico use:
```
make all KUBE_RUNTIME=cri-containerd
make all KUBE_RUNTIME=cri-containerd KUBE_NETWORK=calico
```

## Booting and initialising OS images
Expand All @@ -44,6 +44,11 @@ or, to automatically initialise the cluster upon boot with no additional options
KUBE_MASTER_AUTOINIT="" ./boot.sh
```

If using calico for networking:
```
KUBE_MASTER_AUTOINIT="--pod-network-cidr=192.168.0.0/16" ./boot.sh
```

Get IP address of the master:
```
ip addr show dev eth0
Expand Down
54 changes: 0 additions & 54 deletions pkg/cri-containerd/Dockerfile

This file was deleted.

32 changes: 0 additions & 32 deletions pkg/cri-containerd/build.yml

This file was deleted.

4 changes: 2 additions & 2 deletions pkg/kubelet/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ FROM linuxkit/alpine:f3cd219615428b2bd943411723eb28875275fae7 AS build
# When changing kubernetes_version remember to also update:
# - scripts/mk-image-cache-lst and run `make refresh-image-caches` from top-level
# - pkg/e2e-test/Dockerfile
ENV kubernetes_version v1.10.0
ENV kubernetes_version v1.10.2
ENV cni_version v0.7.1
ENV critools_version v1.0.0-alpha.0
ENV critools_version v1.0.0-beta.0

RUN apk add -U --no-cache \
bash \
Expand Down
9 changes: 9 additions & 0 deletions test/cases/000_smoke/005_cri-calico/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
# SUMMARY: build and boot using cri-containerd runtime and Calico networking
# LABELS:

runtime=cri-containerd
network=calico

# Doesn't return
. ../common.sh
9 changes: 9 additions & 0 deletions test/cases/000_smoke/006_docker-calico/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
# SUMMARY: build and boot using Docker runtime and Calico networking
# LABELS:

runtime=docker
network=calico

# Doesn't return
. ../common.sh
3 changes: 3 additions & 0 deletions yml/calico.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
files:
- path: /etc/kubeadm/kube-system.init/50-calico.yaml
source: kube-calico.yaml
25 changes: 20 additions & 5 deletions yml/cri-containerd.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
services:
- name: cri-containerd
image: linuxkit/cri-containerd:474d704f6dcb173b10768ab1d1bd61674468c7f9
cgroupsPath: podruntime/cri-containerd
files:
- path: /etc/crictl.yaml
contents: |
runtime-endpoint: unix:///run/containerd/containerd.sock
image-endpoint: unix:///run/containerd/containerd.sock
timeout: 10
- path: /etc/containerd/config.toml
contents: |
state = "/run/containerd"
root = "/var/lib/containerd"
snapshotter = "io.containerd.snapshotter.v1.overlayfs"
[grpc]
address = "/run/containerd/containerd.sock"
uid = 0
gid = 0
[debug]
address = "/run/containerd/debug.sock"
level = "info"
[metrics]
address = ""
- path: /etc/kubelet.sh.conf
contents: |
KUBELET_ARGS="--container-runtime=remote --container-runtime-endpoint=unix:///var/run/cri-containerd.sock"
KUBELET_ARGS="--container-runtime=remote --container-runtime-endpoint=unix:///run/containerd/containerd.sock"
15 changes: 10 additions & 5 deletions yml/kube.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
kernel:
image: linuxkit/kernel:4.14.32
image: linuxkit/kernel:4.14.39
cmdline: "console=tty0 console=ttyS0"
init:
- linuxkit/init:be60dd1cb15ad39225512b6753304571d8c2fb17
- linuxkit/runc:1b67e997c720301c62052c8f29f5629ad751199b
- linuxkit/containerd:87ea9b027267b26bf5cc2d10a50c3eb9b5017df4
- linuxkit/init:11929b0007b87384f7372e9265067479c4616586
- linuxkit/runc:acba8886e4b1318457c711700f695a02fef9493d
- linuxkit/containerd:f197e7cbb2ede4370b75127c76de6f7b2e3d9873
- linuxkit/ca-certificates:fb5c7bf842a330f5b47cdf71f950fe0c85f4a772
onboot:
- name: sysctl
Expand All @@ -24,6 +24,11 @@ onboot:
- name: mounts
image: linuxkit/mount:0eba853dfa99f01166831c30f37f6bb818b61f2f
command: ["/usr/bin/mountie", "/var/lib/"]
- name: dir-hack
image: busybox:latest
command: ["mkdir", "-p", "/var/lib/cni/conf", "/var/lib/cni/bin"]
binds:
- /var:/var:rshared,rbind
services:
- name: getty
image: linuxkit/getty:32247863cace34f3b441b4c5d9d3f5cb5f64d189
Expand All @@ -40,7 +45,7 @@ services:
image: linuxkit/sshd:39d6bdc9a7489ceffa761ad5cb96c87b50d6732d
cgroupsPath: systemreserved/sshd
- name: kubelet
image: linuxkit/kubelet:ddd2e094e44aae9bab3eb3b8d378d2383d6cda01
image: linuxkit/kubelet:1775276ba903b90615d91f0bd034a527163ffbd4
cgroupsPath: podruntime/kubelet
files:
- path: etc/linuxkit.yml
Expand Down