github.com/sealerio/sealer@v0.11.1-0.20240507115618-f4f89c5853ae/docs/debug/README.md (about) 1 # What is sealer debug 2 3 `sealer debug` can debug nodes, pods and containers with plenty of useful tools. Based on `sealer debug` , SRE can locate the problems of nodes, pods or containers. 4 5 You can use `sealer debug pod mypod -it` to debug the pod named `mypod`. It will create an interactive debugging session in pod `mypod` and immediately attach to it. In this way, you can use plenty of useful tools to debug `mypod` and the first container of `mypod`. 6 7  8 9 ## Use Cases 10 11 Here are some examples of using cases. 12 13 ``` 14 # Debug Node `mynode` and immediately attach to the debug pod. 15 $ sealer debug node mynode -it 16 You don't specify an image, it will use the default image: debug:ubuntu 17 You can use `--image` to specify an image, just like `sealer debug node NODE_NAME --image busybox`. 18 The debug pod or container id: sealer-pod-debugger-khwbl.mynode.default 19 root@mynode:~# ls 20 motd 21 root@mynode:~# 22 23 # In node `mynode`, executing commands without tty. The commands used are debug pod. 24 $ sealer debug node mynode ls / 25 26 # In node `mynode`, executing commands with tty. The commands used are debug pod. 27 $ sealer debug node mynode -it bash 28 29 # Use image `busybox` to debug node `mynode`. 30 $ sealer debug node mynode -it --image busybox 31 32 # It will only a debug pod in node, but will not immediately attach to the debug pod. Users can use the returned debug ID to attach to the debug pod to debug the node. 33 # debug ID format is `container_name.pod_name.namespace`. 34 $ sealer debug node mynode 35 36 # Debug node `mynode` with envionment variables. 37 $ sealer debug node mynode -it --env yyds=sealer,debug=sealer 38 39 # Debug node `mynode` and set some check items. After attaching to the debug pod , it will check the specified check items automatic and show the check results. 40 # Attention: currently, `sealer debug` can only use this with default image. 41 $ sealer debug node mynode -it --check-list=dns,network 42 43 # Debug node `mynode`, and we can specify the container name in debug pod. 44 $ sealer debug node mynode -it --name sealer-demo 45 ``` 46 47 Just like `sealer debug node`, so only list some case 48 49 ``` 50 # Debug pod `mypod` and immediately attach to the debug container. 51 $ sealer debug pod mypod -it 52 53 # Debug pod `mypod`and we can specify the debug container name. 54 $ sealer debug pod mypod -it --name sealer-demo 55 56 # Default it will debug the first container in pod `mypod`. This way, it will debug the container `mypod` in pod `mypod`. 57 $ sealer debug pod mypod -c podaa -it 58 59 # Debug `coredns` pod in namespace kube-system. 60 $ sealer debug pod coredns-b55nb -n kube-system -it 61 ``` 62 63 The `sealer debug` also provides some default images. 64 65 ``` 66 # Show the defautl images provided by sealer. 67 $ sealer debug show-images 68 There are several default images you can useļ¼ 69 RichToolsOnUbuntu: debug:ubuntu 70 RichToolsOnAlpine: debug:apline 71 ``` 72 73 `sealer debug node mynode/pod mypod` will generate a debug pod/container, but it will not be cleaned automatically. So we can use `sealer debug clean [DEBUG_ID]` to clean the generated debug pod or container. 74 75 ``` 76 # Clean generated debug pod/container using debug ID. 77 $ sealer debug clean sealer-pod-debugger-khwbl.mynode.default 78 ``` 79 80 ## Implementation 81 82  83 84 When debug node, `sealer debug node` will create a debug pod on node, and it will attach to the debug pod. So it can debug the node with the tools provided by debug pod. 85 86 Just like debug node, `sealer debug pod` will create a debug container in pod, and it will attach to the debug container to debug pod/container with the tools provided by debug container. 87 88 When the debug is done, the generated debug pods or debug containers will be cleaned automatically. 89 90 Besides, `sealer debug` also provide some default images for debugging. You can use `sealer debug show-images` to look th default images provided.