katacontainer debug

  touch /etc/docker/daemon.json
 dockerd --config-file /etc/docker/daemon.json
cat /etc/docker/daemon.json

 

root@ubuntu:~/kata# cat /etc/docker/daemon.json
{ 
         "debug": true
}
root@ubuntu:~/kata# 

 

 sed -i 's/#enable_debug/enable_debug/g' /usr/share/defaults/kata-containers/configuration.toml

 

root@ubuntu:~/kata# systemctl restart docker
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
root@ubuntu:~/kata#

 

 

调试 kata-runtime
# docker 开启 debug: /etc/docker/daemon.json 添加参数 (需重启服务)
{ "debug": true }
# kata配置文件/etc/kata-containers/configuration.toml,开启 enable_debug

# 查看日志
$ journalctl -ft kata-runtime

 

Enable full debug
Enable full debug as follows:

$ sudo mkdir -p /etc/kata-containers/
$ sudo install -o root -g root -m 0640 /usr/share/defaults/kata-containers/configuration.toml /etc/kata-containers
$ sudo sed -i -e 's/^# *\(enable_debug\).*=.*$/\1 = true/g' /etc/kata-containers/configuration.toml
$ sudo sed -i -e 's/^kernel_params = "\(.*\)"/kernel_params = "\1 agent.log=debug initcall_debug"/g' /etc/kata-containers/configuration.toml
debug logs and shimv2
If you are using containerd and the Kata containerd-shimv2 to launch Kata Containers, and wish to enable Kata debug logging, there are two ways this can be enabled via the containerd configuration file, detailed below.

The Kata logs appear in the containerd log files, along with logs from containerd itself.

For more information about containerd debug, please see the containerd documentation.

Enabling full containerd debug
Enabling full containerd debug also enables the shimv2 debug. Edit the containerd configuration file to include the top level debug option such as:

[debug]
        level = "debug"
Enabling just containerd shim debug
If you only wish to enable debug for the containerd shims themselves, just enable the debug option in the plugins.linux section of the containerd configuration file, such as:

  [plugins.linux]
    shim_debug = true
Enabling CRI-O and shimv2 debug
Depending on the CRI-O version being used one of the following configuration files can be found: /etc/crio/crio.conf or /etc/crio/crio.conf.d/00-default.

If the latter is found, the change must be done there as it'll take precedence, overriding /etc/crio/crio.conf.

# Changes the verbosity of the logs based on the level it is set to. Options
# are fatal, panic, error, warn, info, debug and trace. This option supports
# live configuration reload.
log_level = "info"
Switching the default log_level from info to debug enables shimv2 debug logs. CRI-O logs can be found by using the crio identifier, and Kata specific logs can be found by using the kata identifier.

 

posted on 2020-10-09 10:24  tycoon3  阅读(487)  评论(0编辑  收藏  举报

导航