Skip to content

Latest commit

 

History

History
 
 

examples

examples

This folder contains some examples showing the usage of the Golang packages provided by Inspektor Gadget. These examples are designed for developers that want to use the Golang packages exposed by Inspektor Gadget directly. End-users do not need this and can use kubectl-gadget or ig directly.

  • runc-hook: Use of the runcfanotify package to
    • receive notifications when a container starts or terminates
    • execute PreStart and PostStop hooks
  • container-collection: Use the container-collection package ("github.com/inspektor-gadget/inspektor-gadget/pkg/container-collection") to print a message when a container is created or removed.
  • kube-container-collection: Use the container-collection package ("github.com/inspektor-gadget/inspektor-gadget/pkg/container-collection") in order to be notified when a new container is started and to attach the OCI config.json as a Kubernetes event.
  • built-in gadgets:
    • basic: Examples showing how to create a tracer without any filtering capabilities.
    • withfilter: Examples showing how to create a tracer that uses the container collection and trace collection packages to filter events by container.
      • trace/exec: traces creation of new processes inside a particular container.
      • trace/network: traces network connections inside containers.
    • formatter: Examples showing how to use a formatter to print events in a column format.
      • trace/exec: traces creation of new processes inside a particular container.