Skip to content

Commit

Permalink
docs: update the doc of CRI
Browse files Browse the repository at this point in the history
Signed-off-by: Starnop <[email protected]>
  • Loading branch information
starnop committed Sep 30, 2018
1 parent 52a63c9 commit 757b6a7
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 40 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
- [Features](#features)
- [Architecture](#architecture)
- [Getting Started](#getting-started)
- [Deploying Kubernetes with PouchContainer](#deploying-kubernetes-with-pouch)
- [Deploying Kubernetes with PouchContainer](#deploying-kubernetes-with-pouchcontainer)
- User Manual
- [CLI Manual](docs/commandline)
- [API Manual](docs/api)
Expand Down
19 changes: 14 additions & 5 deletions docs/kubernetes/pouch_with_kubernetes_deploying.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,22 @@ PouchContainer installation could be quite easy by following document [INSTALLAT

After installing PouchContainer, it will be running by default. However, to make PouchContainer support Kubernetes, configuration of PouchContainer must be updated. In details, only by switching on flag `--enbale-cri` can PouchContainer provide CRI service for kubelet in Kubernetes. So, a sed command can be used to udpate PouchContainer's configuration.

NOTE:

+ If you'd like to use Kubernetes 1.11+, CONTAINERD_ADDR should be "/run/containerd/containerd.sock".

For Ubuntu 16.04+, the command is as below:

``` shell
sudo sed -i 's/ExecStart=\/usr\/local\/bin\/pouchd/ExecStart=\/usr\/local\/bin\/pouchd --enable-cri=true --cri-version=v1alpha2/g' /lib/systemd/system/pouch.service
CONTAINERD_ADDR="/var/run/containerd/containerd.sock"
sudo sed -i 's/ExecStart=\/usr\/local\/bin\/pouchd/ExecStart=\/usr\/local\/bin\/pouchd --enable-cri=true --cri-version=v1alpha2 --containerd=${CONTAINERD_ADDR}/g' /lib/systemd/system/pouch.service
```

For CentOS 7.0+, the command is as below:

``` shell
sudo sed -i 's/ExecStart=\/usr\/local\/bin\/pouchd/ExecStart=\/usr\/local\/bin\/pouchd --enable-cri=true --cri-version=v1alpha2/g' /lib/systemd/system/pouch.service
CONTAINERD_ADDR="/var/run/containerd/containerd.sock"
sudo sed -i 's/ExecStart=\/usr\/local\/bin\/pouchd/ExecStart=\/usr\/local\/bin\/pouchd --enable-cri=true --cri-version=v1alpha2 --containerd=${CONTAINERD_ADDR}/g' /lib/systemd/system/pouch.service
```

### Restart PouchContainer
Expand Down Expand Up @@ -161,8 +167,11 @@ $ sudo yum install -y kubelet-${RELEASE} kubeadm-${RELEASE} kubectl-${RELEASE}
After downloading all essential packages, there are some configurations which needs update. For kubelet, configure it to choose PouchContainer as its container runtime. Since PouchContainer makes use of a UNIX socket `unix:///var/run/pouchcri.sock`, this socket path must be delivered to kubelet. Update command is exactly the following one:

``` shell
sudo sed -i '2 i\Environment="KUBELET_EXTRA_ARGS=--container-runtime=remote --container-runtime-endpoint=unix:///var/run/pouchcri.sock --image-service-endpoint=unix:///var/run/pouchcri.sock"' /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
sudo systemctl daemon-reload
$ sudo cat <<EOF > /etc/systemd/system/kubelet.service.d/0-pouch.conf
[Service]
Environment="KUBELET_EXTRA_ARGS=--container-runtime=remote --container-runtime-endpoint=unix:///var/run/pouchcri.sock --image-service-endpoint=unix:///var/run/pouchcri.sock"
EOF
$ sudo systemctl daemon-reload
```

### Setup Kubernetes Cluster
Expand All @@ -177,7 +186,7 @@ sudo kubeadm init --pod-network-cidr 10.244.0.0/16 --ignore-preflight-errors=all

After executing the command above, Kubernetes master and kubelet are both running on this node. As a result, **a complete Kubernetes cluster on a singe node has been setup.**

Before experiencing service provided by Kubernetes, user must execute three commands **on master node** to make it:
To make kubectl work for your non-root user, run these commands, which are also part of the kubeadm init output:

``` shell
mkdir -p ~/.kube
Expand Down
70 changes: 36 additions & 34 deletions docs/kubernetes/pouch_with_kubernetes_deploying_aliyun.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@

Updated: 2018.6.1

- [PouchContainer deploying](#pouch-with-kubernetes-deploying)
- [PouchContainer deploying](#pouchcontainer-deploying)
- [Overview](#overview)
- [Restriction](#restriction)
- [Install and Configure](#install-and-configure)
- [Install PouchContainer](#install-pouch)
- [Install PouchContainer](#install-pouchcontainer)
- [Setup Repo](#setup-repo)
- [Install Kubernetes Components](#install-kubernetes-components)
- [Install CNI](#install-cni)
- [Using custom configurations](#using-custom-configurations)
- [Setting up the master node](#setting-up-the-master-node)
- [Setting up ImageRepository](#setting-up-imagerepository)
- [Setting up the minion nodes](#setting-up-the-minion-nodes)
- [Run and Verify](#run-and-verify)
- [Troubleshooting](#troubleshooting)

## Overview

Expand Down Expand Up @@ -44,24 +43,27 @@ You can easily setup a basic PouchContainer environment, see [INSTALLATION.md](.

### Configure PouchContainer

On Ubuntu 16.04+:
NOTE:

+ If you'd like to use Kubernetes 1.10+, CRI_VERSION should be "v1alpha2".
+ If you'd like to use Kubernetes 1.11+, CONTAINERD_ADDR should be "/run/containerd/containerd.sock".

NOTE: If you'd like to use Kubernetes 1.10+, CRI_VERSION should be "v1alpha2"
On Ubuntu 16.04+:

```
CRI_VERSION="v1alpha1"
sed -i 's/ExecStart=\/usr\/bin\/pouchd/ExecStart=\/usr\/bin\/pouchd --enable-cri=true --cri-version=${CRI_VERSION}/g' /usr/lib/systemd/system/pouch.service
CONTAINERD_ADDR="/var/run/containerd/containerd.sock"
sed -i 's/ExecStart=\/usr\/bin\/pouchd/ExecStart=\/usr\/bin\/pouchd --enable-cri=true --cri-version=${CRI_VERSION} --containerd=${CONTAINERD_ADDR}/g' /usr/lib/systemd/system/pouch.service
systemctl daemon-reload
systemctl restart pouch
```

On CentOS 7:

NOTE: If you'd like to use Kubernetes 1.10+, CRI_VERSION should be "v1alpha2"

```
CRI_VERSION="v1alpha1"
sed -i 's/ExecStart=\/usr\/local\/bin\/pouchd/ExecStart=\/usr\/local\/bin\/pouchd --enable-cri=true --cri-version=${CRI_VERSION}/g' /lib/systemd/system/pouch.service
CONTAINERD_ADDR="/var/run/containerd/containerd.sock"
sed -i 's/ExecStart=\/usr\/local\/bin\/pouchd/ExecStart=\/usr\/local\/bin\/pouchd --enable-cri=true --cri-version=${CRI_VERSION} --containerd=${CONTAINERD_ADDR}/g' /lib/systemd/system/pouch.service
systemctl daemon-reload
systemctl restart pouch
```
Expand Down Expand Up @@ -108,13 +110,6 @@ RELEASE="1.9.4-0.x86_64"
yum -y install kubelet-${RELEASE} kubeadm-${RELEASE} kubectl-${RELEASE}
```

Configure kubelet with PouchContainer as its runtime:

```sh
sed -i '2 i\Environment="KUBELET_EXTRA_ARGS=--container-runtime=remote --container-runtime-endpoint=unix:///var/run/pouchcri.sock --image-service-endpoint=unix:///var/run/pouchcri.sock"' /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
systemctl daemon-reload
```

For more details, please check [install kubelet](https://kubernetes.io/docs/setup/independent/install-kubeadm/#installing-kubeadm-kubelet-and-kubectl).

### Install CNI
Expand All @@ -134,18 +129,35 @@ setenforce 0
yum install -y kubernetes-cni
```

### Setting up ImageRepository
### Using custom configurations

Configure kubelet with PouchContainer as its runtime:

``` shell
cat <<EOF > /etc/systemd/system/kubelet.service.d/0-pouch.conf
[Service]
Environment="KUBELET_EXTRA_ARGS=--container-runtime=remote --container-runtime-endpoint=unix:///var/run/pouchcri.sock --image-service-endpoint=unix:///var/run/pouchcri.sock"
EOF

sudo systemctl daemon-reload
```

Using custom ImageRepository

Note: If you'd like to use Kubernetes 1.11+, `apiVersion` should be `kubeadm.k8s.io/v1alpha2`.

```
# cat kubeadm.conf
apiVersion: kubeadm.k8s.io/v1alpha1
kind: MasterConfiguration
imageRepository: registry.cn-hangzhou.aliyuncs.com/google_containers
kubernetes-version: stable-1.9
kubernetesVersion: stable-1.9
networking:
podSubnet: 10.244.0.0/16
```

For more details, please check [kubeadm init](https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-init/).

### Setting up the master node

For more detailed Kubernetes cluster installation, please check [Using kubeadm to Create a Cluster](https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/)
Expand All @@ -154,10 +166,12 @@ For more detailed Kubernetes cluster installation, please check [Using kubeadm t
kubeadm init --config kubeadm.conf --ignore-preflight-errors=all
```

Set the KUBECONFIG environment variable
To make kubectl work for your non-root user, run these commands, which are also part of the kubeadm init output:

```sh
export KUBECONFIG=/etc/kubernetes/admin.conf
``` shell
mkdir -p ~/.kube
sudo cp -i /etc/kubernetes/admin.conf ~/.kube/config
sudo chown $(id -u):$(id -g) ~/.kube/config
```

Configure CNI network plugin with [flannel](https://github.com/coreos/flannel)
Expand Down Expand Up @@ -253,15 +267,3 @@ Commercial support is available at
</body>
</html>
```

## Troubleshooting

- Because `kubeadm` still assumes docker as the only container runtime which can be used with kubernetes. When you use `kubeadm` to initialize the master node or join the minion node to the cluster, you may encounter the following error message:`[ERROR SystemVerification]: failed to get docker info: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?`. Use the flag `--ignore-preflight-errors=all` to skip the check, like `kubeadm init --ignore-preflight-errors=all`.

- By default PouchContainer will support CRI v1alpha2,which means that using a version of Kubernetes prior to 1.10 will not work. As the NOTE mentioned above, we could start pouchd with the configuration like `pouchd --cri-version v1alpha1` to specify the version of CRI to support the version of Kubernetes below 1.10.

- By default PouchContainer will not enable the CRI. If you'd like to deploy Kubernetes with PouchContainer, you should start pouchd with the configuration like `pouchd --enable-cri`.

- By default PouchContainer will use `registry.cn-hangzhou.aliyuncs.com/google-containers/pause-amd64:3.0` as the image of infra container. If you'd like use image other than that, you could start pouchd with the configuration like `pouchd --enable-cri --sandbox-image XXX`.

- Any other troubles? Make an issue to connect with us!

0 comments on commit 757b6a7

Please sign in to comment.