TL; DR: Inspektor Gadget is now available as an addon in Minikube .

When creating a tool for Kubernetes, it’s crucial to be able to test it with various cluster configurations. In the case of Inspektor Gadget, we wanted to:

  • Run it against a cluster of multiple Kubernetes nodes .
  • Test it against different container runtimes . (docker, containerd and cri-o).
  • Validate our changes locally without pushing the image to a container registry.
  • Cover the above scenarios both in the development and in the Continuous Integration (CI) pipeline quickly.

With minikube we can start a cluster locally using minikube start and combining it with flags like --container-runtime or --nodes as needed. We use the same flow to test our changes in GitHub Actions as:

test-integration-minikube: 
    name: Integration Tests 
    runs-on: ubuntu-latest 
    strategy: 
      fail-fast: false 
      matrix: 
        runtime: [docker, containerd, cri-o] 
    steps: 
    - name: Setup minikube 
      uses: ./.github/actions/setup-minikube 
      with: 
        runtime: ${{ matrix.runtime }} 
        multi-node: true 
    - name: Run integration tests 
      uses: ./.github/actions/run-integration-tests 
    . . .
    . . .

So minikube works great when developing and testing cloud-native applications. On the other hand, having a deeper understanding of the applications when running in a minikube cluster would be fantastic and Inspektor Gadget might just be the right tool for it. To facilitate this, now you can use the inspektor-gadget addon in minikube v1.31.0 :

$ minikube addons enable inspektor-gadget
šŸŒŸ  The 'inspektor-gadget' addon is enabled
$ kubectl get pods -n gadget
NAME           READY   STATUS    RESTARTS   AGE
gadget-zwln9   1/1     Running   0          19s

Afterward, you can interact with the cluster using kubectl-gadget . Here is an example using the tcp top gadget:

$ kubectl gadget top tcp --all-namespaces 
NODE       NAMESPACE       POD                      CONTAINER        PID      COMM          IP REMOTE  LOCAL  SENT          RECV  
minikube   kube-system     kube-apiserver-minikube  kube-apiserver   762760   kube-apiservā€¦ 6  :0      :0     68.29KiB      541B  
minikube   kube-system     etcd-minikube            etcd             762749   etcd          4  :0      :0     47.61KiB      331B  
minikube   kube-system     kube-apiserver-minikube  kube-apiserver   762760   kube-apiservā€¦ 6  :0      :0     15.39KiB      117B  
minikube   kube-system     kube-scheduler-minikube  kube-scheduler   762764   kube-schedulā€¦ 4  :0      :0     2.49KiB       564B  

The list of gadgets is available here . Feel free to try the addon and share your valuable feedback. We would like to thank the minikube maintainers for their reviews and Santhosh Nagaraj (@yolossn) for making it happen!

Happy Inspekting!

Related Articles