@@ -72,12 +72,6 @@ documentation](https://github.com/kubernetes-sigs/cri-tools/blob/master/docs/cri
72
72
73
73
The following examples show some ` crictl ` commands and example output.
74
74
75
- {{< warning >}}
76
- If you use ` crictl ` to create pod sandboxes or containers on a running
77
- Kubernetes cluster, the Kubelet will eventually delete them. ` crictl ` is not a
78
- general purpose workflow tool, but a tool that is useful for debugging.
79
- {{< /warning >}}
80
-
81
75
### List pods
82
76
83
77
List all pods:
@@ -241,136 +235,6 @@ The output is similar to this:
241
235
10.240.0.96 - - [06/Jun/2018:02:45:51 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.47.0" "-"
242
236
```
243
237
244
- ### Run a pod sandbox
245
-
246
- Using ` crictl ` to run a pod sandbox is useful for debugging container runtimes.
247
- On a running Kubernetes cluster, the sandbox will eventually be stopped and
248
- deleted by the Kubelet.
249
-
250
- 1 . Create a JSON file like the following:
251
-
252
- ``` json
253
- {
254
- "metadata" : {
255
- "name" : " nginx-sandbox" ,
256
- "namespace" : " default" ,
257
- "attempt" : 1 ,
258
- "uid" : " hdishd83djaidwnduwk28bcsb"
259
- },
260
- "log_directory" : " /tmp" ,
261
- "linux" : {
262
- }
263
- }
264
- ```
265
-
266
- 2 . Use the ` crictl runp ` command to apply the JSON and run the sandbox.
267
-
268
- ``` shell
269
- crictl runp pod-config.json
270
- ```
271
-
272
- The ID of the sandbox is returned.
273
-
274
- ### Create a container
275
-
276
- Using ` crictl ` to create a container is useful for debugging container runtimes.
277
- On a running Kubernetes cluster, the container will eventually be stopped and
278
- deleted by the Kubelet.
279
-
280
- 1 . Pull a busybox image
281
-
282
- ``` shell
283
- crictl pull busybox
284
- ```
285
- ``` none
286
- Image is up to date for busybox@sha256:141c253bc4c3fd0a201d32dc1f493bcf3fff003b6df416dea4f41046e0f37d47
287
- ```
288
-
289
- 2 . Create configs for the pod and the container:
290
-
291
- ** Pod config** :
292
-
293
- ``` json
294
- {
295
- "metadata" : {
296
- "name" : " busybox-sandbox" ,
297
- "namespace" : " default" ,
298
- "attempt" : 1 ,
299
- "uid" : " aewi4aeThua7ooShohbo1phoj"
300
- },
301
- "log_directory" : " /tmp" ,
302
- "linux" : {
303
- }
304
- }
305
- ```
306
-
307
- ** Container config** :
308
-
309
- ``` json
310
- {
311
- "metadata" : {
312
- "name" : " busybox"
313
- },
314
- "image" :{
315
- "image" : " busybox"
316
- },
317
- "command" : [
318
- " top"
319
- ],
320
- "log_path" :" busybox.log" ,
321
- "linux" : {
322
- }
323
- }
324
- ```
325
-
326
- 3 . Create the container, passing the ID of the previously-created pod, the
327
- container config file, and the pod config file. The ID of the container is
328
- returned.
329
-
330
- ``` shell
331
- crictl create f84dd361f8dc51518ed291fbadd6db537b0496536c1d2d6c05ff943ce8c9a54f container-config.json pod-config.json
332
- ```
333
-
334
- 4 . List all containers and verify that the newly-created container has its
335
- state set to ` Created ` .
336
-
337
- ``` shell
338
- crictl ps -a
339
- ```
340
-
341
- The output is similar to this:
342
-
343
- ```
344
- CONTAINER ID IMAGE CREATED STATE NAME ATTEMPT
345
- 3e025dd50a72d busybox 32 seconds ago Created busybox 0
346
- ```
347
-
348
- ### Start a container
349
-
350
- To start a container, pass its ID to ` crictl start ` :
351
-
352
- ``` shell
353
- crictl start 3e025dd50a72d956c4f14881fbb5b1080c9275674e95fb67f965f6478a957d60
354
- ```
355
-
356
- The output is similar to this:
357
-
358
- ```
359
- 3e025dd50a72d956c4f14881fbb5b1080c9275674e95fb67f965f6478a957d60
360
- ```
361
-
362
- Check the container has its state set to ` Running ` .
363
-
364
- ``` shell
365
- crictl ps
366
- ```
367
- The output is similar to this:
368
-
369
- ```
370
- CONTAINER ID IMAGE CREATED STATE NAME ATTEMPT
371
- 3e025dd50a72d busybox About a minute ago Running busybox 0
372
- ```
373
-
374
238
## {{% heading "whatsnext" %}}
375
239
376
240
* [ Learn more about ` crictl ` ] ( https://github.com/kubernetes-sigs/cri-tools ) .
0 commit comments