Skip to content

Commit 7a99b70

Browse files
committed
howto: k8s grammar and format changes
Went through and made a few grammar and format updates to make how-to guide easier to follow, as well as add direct links to project Github pages where applicable. Fixes: kata-containers#127 Signed-off-by: trilliams <[email protected]> howto: k8s grammar and format changes Went through and made a few grammar and format updates to make how-to guide easier to follow, as well as add direct links to project Github pages where applicable. Fixes: kata-containers#127 Signed-off-by: trilliams <[email protected]>
1 parent 9664caf commit 7a99b70

File tree

1 file changed

+64
-44
lines changed

1 file changed

+64
-44
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,64 @@
11
# How to use Kata Containers and CRI (containerd plugin) with Kubernetes
22

3-
This document describes how to set up a single-machine Kubernetes cluster.
4-
The Kubernetes cluster will use the CRI containerd plugin and Kata Containers to launch untrusted workloads.
3+
This document describes how to set up a single-machine Kubernetes cluster. The Kubernetes cluster will use the [CRI containerd plugin](https://github.com/containerd/cri) and [Kata Containers](https://katacontainers.io) to launch untrusted workloads.
4+
5+
## Requirements
56

6-
## Requirements
77
- Kubernetes, kubelet, kubeadm
88
- cri-containerd
99
- Kata Containers
1010

11-
For information about the supported version of these components see
12-
Kata Containers [versions.yaml](https://github.com/kata-containers/runtime/blob/master/versions.yaml) file.
11+
Note|
12+
----------------- |
13+
|For information about the supported versions of these components, see the Kata Containers [versions.yaml](https://github.com/kata-containers/runtime/blob/master/versions.yaml) file. |
14+
1315

1416
## Install containerd(with CRI plugin enabled)
1517

1618
Follow the instructions from [CRI installation guide](http://github.com/containerd/cri/blob/master/docs/installation.md)
1719

18-
<!---
1920
```bash
2021
# Check if containerd is installed
2122
$ command -v containerd
2223
```
23-
--->
2424

25-
## Install Kata Containers
25+
## Install Kata Containers
2626

2727
Follow the instructions to [install Kata](https://github.com/kata-containers/documentation/blob/master/install/README.md).
2828

29-
<!---
3029
```bash
3130
# Check if kata-runtime is installed
3231
$ command -v kata-runtime
3332
# Check kata is well configured
3433
$ kata-runtime kata-env
3534
```
36-
--->
3735

3836
## Install Kubernetes
39-
Install Kubernetes in your host. See kubeadm [installation](https://kubernetes.io/docs/tasks/tools/install-kubeadm/)
40-
<!---
37+
Install Kubernetes in your host. See [kubeadm installation](https://kubernetes.io/docs/setup/independent/install-kubeadm/)
38+
4139
```bash
4240
# Check if kubadm is installed
4341
$ command -v kubeadm
4442
```
45-
--->
4643

4744
### Configure containerd to use Kata Containers
4845

49-
The CRI containerd plugin support configuration for two runtime types.
46+
The CRI containerd plugin supports configuration for two runtime types.
5047

51-
- Default runtime: A runtime that is used by default to run workloads.
52-
- Untrusted workload runtime: A runtime that will be used run untrusted workloads.
48+
- **Default runtime:** A runtime that is used by default to run workloads.
49+
- **Untrusted workload runtime:** A runtime that will be used to run untrusted workloads.
5350

54-
#### Define the Kata runtime as `untrusted_workload_runtime`
51+
#### Define the Kata runtime as `untrusted_workload_runtime`
5552

56-
Configure the Kata runtime for untrusted workload with the [config option](https://github.com/containerd/cri/blob/v1.0.0-rc.0/docs/config.md)
57-
`plugins.cri.containerd.untrusted_workload_runtime`.
53+
Configure the Kata runtime for untrusted workloads with the [config option](https://github.com/containerd/cri/blob/v1.0.0-rc.0/docs/config.md) `plugins.cri.containerd.untrusted_workload_runtime`.
5854

5955
Unless configured otherwise, the default runtime is set to `runc`.
56+
6057
```bash
6158
# Configure containerd to use Kata as untrusted_workload_runtime
6259
$ sudo mkdir -p /etc/containerd/
60+
```
61+
```bash
6362
$ cat << EOT | sudo tee /etc/containerd/config.toml
6463
[plugins]
6564
[plugins.cri.containerd]
@@ -71,23 +70,33 @@ EOT
7170

7271
### Configure Kubelet to use containerd
7372

74-
In order to allow kubelet use containerd (using CRI interface) configure the service to
75-
point to containerd socket.
73+
74+
75+
76+
77+
78+
In order to allow kubelet to use containerd (using CRI interface), configure the service to point to the `containerd` socket.
79+
80+
- Configure k8s to use containerd
7681

7782
```bash
78-
# Configure k8s to use containerd
7983
$ sudo mkdir -p /etc/systemd/system/kubelet.service.d/
84+
```
85+
```bash
8086
$ cat << EOF | sudo tee /etc/systemd/system/kubelet.service.d/0-containerd.conf
8187
[Service]
8288
Environment="KUBELET_EXTRA_ARGS=--container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=unix:///run/containerd/containerd.sock"
8389
EOF
90+
```
91+
```bash
8492
$ sudo systemctl daemon-reload
8593
```
8694

8795
### Optional: Configure proxy
8896

89-
If you are behind a proxy this script will configure your proxy for docker
90-
kubelet and containerd.
97+
98+
If you are behind a proxy, use the following script to configure your proxy for docker, kubelet, and containerd:
99+
91100

92101
```bash
93102
# Set proxys
@@ -109,20 +118,30 @@ Environment="HTTPS_PROXY=${https_proxy}"
109118
Environment="NO_PROXY=${no_proxy}"
110119
EOT
111120
done
121+
```
122+
```bash
112123
$ sudo systemctl daemon-reload
113124
```
114125

115-
### Start Kubernetes with kubeadm
126+
### Start Kubernetes with `kubeadm`
127+
128+
129+
- Make sure containerd is up and running
116130

117131
```bash
118-
# Mark sure containerd is up and running
119132
$ sudo systemctl restart containerd
120133
$ sudo systemctl status containerd
134+
```
135+
136+
- Prevent conflicts of docker iptables rules & k8s pod communication
121137

122-
# Prevent docker iptables rules conflict with k8s pod communication
138+
```bash
123139
$ sudo iptables -P FORWARD ACCEPT
140+
```
124141

125-
# Start cluster using kubeadm
142+
- Start cluster using `kubeadm`
143+
144+
```bash
126145
$ sudo kubeadm init --skip-preflight-checks \
127146
--cri-socket /run/containerd/containerd.sock --pod-network-cidr=10.244.0.0/16
128147

@@ -132,22 +151,19 @@ $ sudo -E kubectl get nodes
132151
$ sudo -E kubectl get pods
133152
```
134153

135-
### Install a pod network
136-
Install a pod network plugin is needed to allow pods communicate with each other.
154+
### Install a Pod Network
155+
156+
A pod network plugin is needed to allow pods to communicate with each other.
157+
158+
Install the `flannel` plugin by following the [Using kubeadm to Create a Cluster](https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/#instructions) guide, starting from the **Installing a pod network** section.
137159

138-
Install flannel plugging, by following the instructions in the section *Installing a pod network*
139-
from [Using kubeadm to Create a Cluster ](https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/)
140-
guide.
141160

142-
<!---
143161
```bash
144162
# Install a pod network using flannel
145163
# There is not a programmatic way to know last what flannel commit use
146164
# See https://github.com/coreos/flannel/issues/995
147165
$ sudo -E kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
148166
```
149-
--->
150-
151167

152168
```bash
153169
# wait for pod network
@@ -166,19 +182,18 @@ $ sudo -E kubectl get pods --all-namespaces | grep dns | grep Running && echo "O
166182

167183
### Allow run pods in master node
168184

169-
By default, the cluster will not schedule pods in the master node to allow that run:
185+
By default, the cluster will not schedule pods in the master node. To enable master node scheduling, run:
170186

171187
```bash
172-
# allow master node run pods
188+
# allow master node to run pods
173189
$ sudo -E kubectl taint nodes --all node-role.kubernetes.io/master-
174190
```
175191

176192

177-
### Create a unstrusted pod using Kata Containers
193+
### Create an unstrusted pod using Kata Containers
194+
195+
By default, all pods are created with the default runtime configured in CRI containerd plugin. If a pod has the `io.kubernetes.cri.untrusted-workload` annotation set to `"true"`, the CRI plugin runs the pod with the [Kata Containers runtime](https://github.com/kata-containers/runtime/blob/master/README.md).
178196

179-
By default, all pods are created with the default runtime configured in CRI containerd plugin.
180-
If a pod has the `io.kubernetes.cri.untrusted-workload annotation` set as
181-
`"true"`, the CRI plugin will run the pod with the Kata Containers runtime.
182197

183198
```bash
184199
# Create untrusted pod configuration
@@ -195,19 +210,24 @@ spec:
195210
image: nginx
196211
197212
EOT
213+
```
198214

215+
```bash
199216
# Create untrusted pod
200217
$ sudo -E kubectl apply -f nginx-untrusted.yaml
201-
218+
```
219+
```bash
202220
# Check pod is running
203221
$ sudo -E kubectl get pods
222+
```
204223

224+
```bash
205225
# Check qemu is running
206226
$ ps aux | grep qemu
207227
```
208-
### Delete created pod
209228

210229
```bash
230+
### Delete created pod
211231
# Delete pod
212232
$ sudo -E kubectl delete -f nginx-untrusted.yaml
213233
```

0 commit comments

Comments
 (0)