Skip to main content
Version: v0.55.0

trace signal

trace signal

Requirements

  • Minimum Kernel Version : 5.4

Getting started

Running the gadget:

$ kubectl gadget run ghcr.io/inspektor-gadget/gadget/trace_signal:v0.55.0 [flags]

Flags

--failed

Show only failed events

Default value: "false"

--pid

Show only events generated by processes with this pid

Default value: ""

--kill-only

Show only events generated by kill family syscalls

Default value: "false"

--signal

Show only events generated by this signal

Default value: ""

Guide

In this example, we will use the trace_signal gadget to observe signals sent between processes inside a container.

First, we need to run an application.

$ kubectl run --restart=Never --image=busybox mypod -- sh -c 'while true; do sleep 60 & wait $!; done'
pod/mypod created

Then, let's run the gadget:

$ kubectl gadget run trace_signal:v0.55.0 --podname mypod
K8S.NODE K8S.NAMESPACE K8S.PODNAME K8S.CONTAINE… COMM PID TID TCOMM TPID SIG ERROR

In another terminal, send a signal to the sleeping process:

$ kubectl exec mypod -- sh -c 'kill -SIGTERM $(pgrep sleep)'

Back in the gadget terminal, we can observe the signal being sent:

minikube-docker    default       mypod       mypod         sh  522100  522100 sleep            522105 SIGTERM
^C

The COMM and PID columns show the process that sent the signal, while TCOMM and TPID show the target process. We can stop the gadget by hitting Ctrl-C.

Finally, clean the system:

$ kubectl delete pod mypod