Skip to content

Commit

Permalink
docs: add doc about cri-annotation-support
Browse files Browse the repository at this point in the history
Signed-off-by: Starnop <starnop@163.com>
  • Loading branch information
starnop committed Sep 10, 2018
1 parent 4f73e55 commit ffb3a2d
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- run:
name: use markdownlint v0.4.0 to lint markdown file (https://github.com/markdownlint/markdownlint)
command: |
find ./ -name "*.md" | grep -v vendor | grep -v commandline | grep -v .github | grep -v swagger | grep -v api | xargs mdl -r ~MD010,~MD013,~MD024,~MD029,~MD033,~MD036
find ./ -name "*.md" | grep -v vendor | grep -v commandline | grep -v .github | grep -v swagger | grep -v api | xargs mdl -r ~MD009, ~MD010,~MD013,~MD022,~MD024,~MD029,~MD031,~MD033,~MD036
- run:
name: use opensource tool client9/misspell to correct commonly misspelled English words
command: |
Expand Down
154 changes: 154 additions & 0 deletions docs/kubernetes/pouch_cri_annotation_support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# CRI ANNOTATIONS SUPPORTED CHANGELOG

* [Overview](#overview "Overview")
* [The Annotations Supported](#the-annotations-supported "The Annotations Supported")
* [Make runtime choosing supported](#make-runtime-choosing-supported "Make runtime choosing supported")
* [Make lxcfs configurable supported](#make-lxcfs-configurable-supported "Make lxcfs configurable supported")
* [Pull Request](#pull-request "Pull Request")

## Overview

Currently, PouchContainer has lots of advantages over other container runtimes, such as:

* resource review isolation via lxcfs
* runtime choosing for runc-based container or runv-based containers
* and so on

While actually in kubernetes, there is no related API to support these feature.

While for these extended features in Kubernetes, Kubernetes has a hiden way to support this: make user-defined parameters in annotations field in pod's definition.
When CRI manager deals the annotation details, it could pass these parameters to container manager, and container manager definitely implement these features very well.

So, we need to accomplish the following things:

* define the specific naming in annotations for each feature;
* implement the transformation in CRI manager and pass them to container manager.

Kubernetes Version: V1.10.0+

## The Annotations Supported

| Requirement | Field definition | Pull Request |
|-----------------------------------|----------------------------------------------|--------------------------------------------|
| make runtime choosing supported | KubernetesRuntime = "io.kubernetes.runtime" | https://github.com/alibaba/pouch/pull/1593 |
| make lxcfs configurable supported | LxcfsEnabled = "io.kubernetes.lxcfs.enabled" | https://github.com/alibaba/pouch/pull/2210 |

### Make runtime choosing supported

#### What To Solve

1. Support choosing the runtime for a container by making runtime choosing supported.

#### How to verify it

1. Prerequisites Installation, the runtime binaries you will use is necessary.

2. You should start pouchd with the configuration like this:

```
pouchd --enable-cri --cri-version v1alpha2 --add-runtime runv=runv >pouchd.log 2>&1 &
```

3. After setting up your kubernetes cluster, you can create a deployment like this :

```
# cat pouch.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: pouch
labels:
pouch: pouch
spec:
selector:
matchLabels:
pouch: pouch
template:
metadata:
labels:
pouch: pouch
annotations:
io.kubernetes.lxcfs.enabled: "true"
spec:
containers:
- name: pouch
image: docker.io/library/busybox:latest
command:
- top
resources:
requests:
memory: "256Mi"
limits:
memory: "256Mi"
# kubectl create -f pouch.yaml
```

4. Use command `pouch ps` to observe the runtime of the container.

### Make lxcfs configurable supported

#### What To Solve

1. Support resource review isolation via lxcfs in CRI Manager by making lxcfs configurable supported.

#### How to verify it

1. Prerequisites Installation and make sure your lxcfs service is running.

2. Enable pouchd lxcfs (with --enable-lxcfs flag).

3. After setting up your kubernetes cluster, you can create a deployment like this :

```
# cat pouch.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: pouch
labels:
pouch: pouch
spec:
selector:
matchLabels:
pouch: pouch
template:
metadata:
labels:
pouch: pouch
annotations:
io.kubernetes.lxcfs.enabled: "true"
spec:
containers:
- name: pouch
image: docker.io/library/busybox:latest
command:
- top
resources:
requests:
memory: "256Mi"
limits:
memory: "256Mi"
# kubectl create -f pouch.yaml
```

4. View the results.

```
# pouch ps
Name ID Status Created Image Runtime
k8s_pouch_pouch-5ddd8fc467-rmtcw_default_bc4b7972-b181-11e8-adae-42010a8c0003_0 5391a9 Up 8 hours 8 hours ago docker.io/library/busybox:latest runc
k8s_POD_pouch-5ddd8fc467-rmtcw_default_bc4b7972-b181-11e8-adae-42010a8c0003_0 60a833 Up 8 hours 8 hours ago registry.cn-hangzhou.aliyuncs.com/google-containers/pause-amd64:3.0 runc
# pouch exec k8s_pouch_pouch-5ddd8fc467-rmtcw_default_bc4b7972-b181-11e8-adae-42010a8c0003_0 cat /proc/meminfo
MemTotal: 262144 kB
MemFree: 261368 kB
MemAvailable: 261368 kB
......
```

## Pull Request

* feature: make runtime choosing supported [#1593](https://github.com/alibaba/pouch/pull/1593)
* feature: make lxcfs configurable supportd in CRI [#2210](https://github.com/alibaba/pouch/pull/2210)
2 changes: 1 addition & 1 deletion docs/kubernetes/pouch_cri_api_changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,4 @@ message Mount {
+ feature: extend cri apis for special needs [#1617](https://github.com/alibaba/pouch/pull/1617)
+ feature: extend cri apis for remove volume [#2124](https://github.com/alibaba/pouch/pull/2124)
+ feature: extend cri apis for support quotaID [#2138](https://github.com/alibaba/pouch/pull/2138)

+ feature: extend cri apis for get envs [#2163](https://github.com/alibaba/pouch/pull/2163)

0 comments on commit ffb3a2d

Please sign in to comment.