sysdiglabs / kubectl-capture

A kubectl plugin which triggers a Sysdig capture
https://sysdig.com/opensource/inspect/
Apache License 2.0
99 stars 9 forks source link

Add more verbose output #5

Open ferrandinand opened 5 years ago

ferrandinand commented 5 years ago

I found kubectl-capture really useful but sometimes I had some difficulties to get some information about why it doesn´t create the capture file.

This PR creates:

@nestorsalceda Let me know how do you feel about this option.

Example:

kubectl capture net-exporter-4p7ls -ns kube-system --ebpf -v -M 10 --snaplen 256

pod/capture-net-exporter-4p7ls-1558943294 created
Sysdig is starting to capture system calls:

Node: master-qomd3-84d58bd6fb-vsfsm
Pod: net-exporter-4p7ls
Duration: 10 seconds
Parameters for Sysdig: -S -M 10 -pk -z -w /capture-net-exporter-4p7ls-1558943294.scap.gz  --snaplen 256

* Setting up /usr/src links from host
ls: cannot access '/host/usr/src': No such file or directory
* Mounting debugfs
Found kernel config at /proc/config.gz
* Trying to compile BPF probe sysdig-probe-bpf (sysdig-probe-bpf-0.26.0-x86_64-4.19.23-coreos-r1-03bf994bd8b87756106f34511fc1aadb.o)
* BPF probe located, it's now possible to start sysdig
* Capturing system calls
* Mounting debugfs
Found kernel config at /proc/config.gz
* BPF probe located, it's now possible to start sysdig
mmap (2): Cannot allocate memory
----------------------
Event           #Calls
----------------------
tar: Removing leading `/' from member names
tar: /capture-net-exporter-4p7ls-1558943294.scap.gz: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
error: capture-net-exporter-4p7ls-1558943294.scap.gz no such file or directory
pod "capture-net-exporter-4p7ls-1558943294" deleted
Error capturing, file not created. Try with the verbose option(-v) to have get more info.