Skip to content

Commit 96e6aed

Browse files
committed
Apply markdown linting on the tutorials folder cri-o#6890
Signed-off-by: Oscar Wieman <[email protected]>
1 parent 2ead241 commit 96e6aed

File tree

9 files changed

+314
-152
lines changed

9 files changed

+314
-152
lines changed

tutorials/crictl.md

Lines changed: 56 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
11
# CRI-O crictl Tutorial
22

3-
This tutorial will walk you through the creation of [Redis](https://redis.io/) server running in a [Pod](http://kubernetes.io/docs/user-guide/pods/) using [crictl](https://github.com/kubernetes-sigs/cri-tools/blob/master/docs/crictl.md)
3+
This tutorial will walk you through the creation of [Redis](https://redis.io/)
4+
server running in a [Pod](http://kubernetes.io/docs/user-guide/pods/) using
5+
[crictl](https://github.com/kubernetes-sigs/cri-tools/blob/master/docs/crictl.md)
46

5-
It assumes you've already downloaded and configured `CRI-O`. If not, see [here for CRI-O](/install.md).
6-
It also assumes you've set up CNI, and are using the default plugins as described [here](/contrib/cni/README.md). If you are using a different configuration, results may vary.
7+
It assumes you've already downloaded and configured `CRI-O`. If not, see
8+
[here for CRI-O](/install.md).
9+
It also assumes you've set up CNI, and are using the default plugins as described
10+
[here](/contrib/cni/README.md). If you are using a different configuration,
11+
results may vary.
712

813
## Installation
914

1015
This section will walk you through installing the following components:
1116

1217
* crictl - The CRI client for testing.
1318

14-
#### Get crictl
19+
### Get crictl
1520

16-
```
21+
```shell
1722
go get github.com/kubernetes-sigs/cri-tools/cmd/crictl
1823
```
1924

20-
#### Ensure the CRI-O service is running
25+
### Ensure the CRI-O service is running
2126

22-
```
27+
```shell
2328
sudo crictl --runtime-endpoint unix:///var/run/crio/crio.sock version
2429
```
25-
```
30+
31+
```text
2632
Version: 0.1.0
2733
RuntimeName: cri-o
2834
RuntimeVersion: 1.20.0-dev
@@ -33,43 +39,47 @@ RuntimeApiVersion: v1alpha1
3339
> you can run `export CONTAINER_RUNTIME_ENDPOINT=unix:///var/run/crio/crio.sock`
3440
> or `cp crictl.yaml /etc/crictl.yaml` from this repo
3541
36-
3742
## Pod Tutorial
3843

39-
Now that the `CRI-O` components have been installed and configured we are ready to create a Pod. This section will walk you through launching a Redis server in a Pod. Once the Redis server is running we'll use telnet to verify it's working, then we'll stop the Redis server and clean up the Pod.
44+
Now that the `CRI-O` components have been installed and configured you are ready
45+
to create a Pod. This section will walk you through launching a Redis server
46+
in a Pod. Once the Redis server is running we'll use telnet to verify it's working,
47+
then we'll stop the Redis server and clean up the Pod.
4048

4149
### Creating a Pod
4250

43-
First we need to setup a Pod sandbox using a Pod configuration, which can be found in the `CRI-O` source tree:
51+
First we need to setup a Pod sandbox using a Pod configuration, which can be found
52+
in the `CRI-O` source tree:
4453

45-
```
54+
```shell
4655
cd $GOPATH/src/github.com/cri-o/cri-o
4756
```
4857

49-
In case the file `/etc/containers/policy.json` does not exist on your filesystem, make sure that skopeo has been installed correctly. You can use a policy template provided in the CRI-O source tree, but it is insecure and it is not to be used on production machines:
58+
In case the file `/etc/containers/policy.json` does not exist on your filesystem,
59+
make sure that Skopeo has been installed correctly. You can use a policy template
60+
provided in the CRI-O source tree, but it is insecure and it is not to be used
61+
on production machines:
5062

51-
```
63+
```shell
5264
sudo mkdir /etc/containers/
5365
sudo cp test/policy.json /etc/containers
5466
```
5567

56-
5768
Next create the Pod and capture the Pod ID for later use:
5869

59-
```
70+
```shell
6071
POD_ID=$(sudo crictl runp test/testdata/sandbox_config.json)
6172
```
6273

63-
6474
Use the `crictl` command to get the status of the Pod:
6575

66-
```
76+
```shell
6777
sudo crictl inspectp --output table $POD_ID
6878
```
6979

7080
Output:
7181

72-
```
82+
```text
7383
ID: 3cf919ba84af36642e6cdb55e157a62407dec99d3cd319f46dd8883163048330
7484
Name: podsandbox1
7585
UID: redhat-test-crio
@@ -79,101 +89,107 @@ Status: SANDBOX_READY
7989
Created: 2020-11-12 12:53:41.345961219 +0100 CET
8090
IP Addresses: 10.85.0.7
8191
Labels:
82-
group -> test
83-
io.kubernetes.container.name -> POD
92+
group -> test
93+
io.kubernetes.container.name -> POD
8494
Annotations:
85-
owner -> hmeng
86-
security.alpha.kubernetes.io/seccomp/pod -> unconfined
95+
owner -> hmeng
96+
security.alpha.kubernetes.io/seccomp/pod -> unconfined
8797
Info: # Redacted
8898
```
8999

90100
### Create a Redis container inside the Pod
91101

92-
Use the `crictl` command to pull the Redis image, create a Redis container from a container configuration and attach it to the Pod created earlier, while capturing the container ID:
102+
Use the `crictl` command to pull the Redis image, create a Redis container from
103+
a container configuration and attach it to the Pod created earlier,
104+
while capturing the container ID:
93105

94-
```
106+
```shell
95107
CONTAINER_ID=$(sudo crictl create $POD_ID test/testdata/container_redis.json test/testdata/sandbox_config.json)
96108
```
97109

98-
The `crictl create` command will take a few seconds to return because the Redis container needs to be pulled.
110+
The `crictl create` command will take a few seconds to return because the Redis
111+
container needs to be pulled.
99112

100113
Start the Redis container:
101114

102-
```
115+
```shell
103116
sudo crictl start $CONTAINER_ID
104117
```
105118

106119
Get the status for the Redis container:
107120

108-
```
121+
```shell
109122
sudo crictl inspect $CONTAINER_ID
110123
```
111124

112125
Output:
113126

114-
```
127+
```text
115128
ID: f70e2a71239c6724a897da98ffafdfa4ad850944098680b82d381d757f4bcbe1
116129
Name: podsandbox1-redis
117130
State: CONTAINER_RUNNING
118131
Created: 32 seconds ago
119132
Started: 16 seconds ago
120133
Labels:
121-
tier -> backend
134+
tier -> backend
122135
Annotations:
123-
pod -> podsandbox1
136+
pod -> podsandbox1
124137
Info: # Redacted
125138
```
126139

127140
### Test the Redis container
128141

129142
Fetch the Pod IP (can also be obtained via the `inspectp` output above):
130143

131-
```
144+
<!-- markdownlint-disable MD013 -->
145+
```shell
132146
POD_IP=$(sudo crictl inspectp --output go-template --template '{{.status.network.ip}}' $POD_ID)
133147
```
148+
<!-- markdownlint-enable MD013 -->
134149

135150
Verify the Redis server is responding to `MONITOR` commands:
136151

137-
```
152+
```shell
138153
echo MONITOR | ncat $POD_IP 6379
139154
```
140155

141156
Output:
142157

143-
```
158+
```text
144159
+OK
145160
```
146161

147162
#### Viewing the Redis logs
148163

149-
The Redis logs are logged to the stderr of the crio service, which can be viewed using `journalctl`:
164+
The Redis logs are logged to the stderr of the crio service,
165+
which can be viewed using `journalctl`:
150166

151-
```
167+
```shell
152168
sudo journalctl -u crio --no-pager
153169
```
154170

155171
### Stop and delete the Redis container
156172

157-
```
173+
```shell
158174
sudo crictl stop $CONTAINER_ID
159175
sudo crictl rm $CONTAINER_ID
160176
```
161177

162178
Verify the container is gone via:
163179

164-
```
180+
```shell
165181
sudo crictl ps
166182
```
167183

168184
### Stop and delete the Pod
169185

170-
```
186+
```shell
171187
sudo crictl stopp $POD_ID
172188
sudo crictl rmp $POD_ID
173189
```
174190

175191
Verify the pod is gone via:
176192

177-
```
193+
```shell
178194
sudo crictl pods
179195
```

tutorials/debugging.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
# Debugging CRI-O
22

3-
Below is a non-comprehensive document on some tips and tricks for troubleshooting/debugging/inspecting the behavior of CRI-O.
3+
Below is a non-comprehensive document on some tips and tricks for
4+
troubleshooting/debugging/inspecting the behavior of CRI-O.
45

5-
### Printing go routines
6-
Often with a long-running process, it can be useful to know what that process is up to.
6+
## Printing go routines
7+
8+
Often with a long-running process, it can be useful to know what that
9+
process is up to.
710
CRI-O has built-in functionality to print the go routine stacks to provide such information.
8-
All one has to do is send SIGUSR1 to CRI-O, either with `kill` or `systemctl` (if running CRI-O as a systemd unit):
9-
```bash
11+
All one has to do is send SIGUSR1 to CRI-O, either with `kill` or `systemctl`
12+
(if running CRI-O as a systemd unit):
13+
14+
```shell
1015
kill -USR1 $crio-pid
1116
systemctl kill -s USR1 crio.service
1217
```
@@ -15,9 +20,11 @@ CRI-O will catch the signal, and write the routine stacks to `/tmp/crio-goroutin
1520

1621
### Forcing Go Garbage Collection
1722

18-
You may have a need to manually run Go garbage collection for CRI-O. To force garbage collection, send CRI-O SIGUSR2 using `kill` or `systemctl` (if running CRI-O as a systemd unit).
23+
You may have a need to manually run Go garbage collection for CRI-O.
24+
To force garbage collection, send CRI-O SIGUSR2 using `kill` or `systemctl`
25+
(if running CRI-O as a systemd unit).
1926

20-
```bash
27+
```shell
2128
kill -s SIGUSR2 $crio-pid
2229

2330
systemctl kill -s USR2 crio.service

0 commit comments

Comments
 (0)