Quick Start
Inspektor Gadget can be used either on a Linux machine or on Kubernetes. It supports both ephemeral commands and permanent installation.
| Permanent installation | Ephemeral run | |
|---|---|---|
| On Kubernetes | Long-running deployment on all worker nodes $ kubectl gadget deploy ... Other installation methods | One-shot command on one worker node $ kubectl debug node ... |
| On Linux systems | Download the official ig binary $ ig run ... Other installation methods | Run ig in a container $ docker run ... |
The following examples use the trace_open Gadget which shows the files being opened.
Kubernetes
To use Inspektor Gadget on Kubernetes, choose one of the following methods.
Long-running deployment on all worker nodes
krew is the recommended way to install
kubectl gadget. You can follow the
krew's quickstart
to install it and then install kubectl gadget by executing the following
commands.
kubectl krew install gadget
kubectl gadget deploy
kubectl gadget run trace_open:v0.45.0 -n default -c myapp
For more details, check Installing on Kubernetes and the run command for filtering and exporting.
One-shot command on one worker node
We can use kubectl debug node to run ig on a Kubernetes node:
kubectl debug --profile=sysadmin node/minikube-docker -ti \
--image=ghcr.io/inspektor-gadget/ig:v0.45.0 -- \
ig run trace_open:v0.45.0 \
--filter k8s.namespace==default,k8s.containerName==myapp
For more information on how to use ig without installation on Kubernetes, please refer to the ig documentation.
Linux
To use Inspektor Gadget on a Linux machine, choose one of the following methods.
Download the official ig binary
Install the ig binary locally on Linux and run a Gadget:
IG_ARCH=amd64
IG_VERSION=$(curl -s https://api.github.com/repos/inspektor-gadget/inspektor-gadget/releases/latest | jq -r .tag_name)
curl -sL https://github.com/inspektor-gadget/inspektor-gadget/releases/download/${IG_VERSION}/ig-linux-${IG_ARCH}-${IG_VERSION}.tar.gz | sudo tar -C /usr/local/bin -xzf - ig
sudo ig run trace_open:v0.45.0 -c mycontainer
For more details, check Installing on Linux and the run command for filtering and exporting.
Run ig in a container
docker run -ti --rm --privileged -v /:/host --pid=host ghcr.io/inspektor-gadget/ig:v0.45.0 run trace_open:v0.45.0 -c mycontainer
For more information on how to use ig without installation on Linux, please check Using ig in a container.
MacOS or Windows
It's possible to control an ig running in Linux from different operating systems by using the gadgetctl binary.
Run the following on a Linux machine to make ig available to clients.
sudo ig daemon --host=tcp://0.0.0.0:1234
Download the gadgetctl tools for MacOS
(amd64,
arm64) or windows and run the Gadget specifying the IP address of the Linux machine:
gadgetctl run trace_open:v0.45.0 --remote-address=tcp://$IP:1234 -c mycontainer