Skip to content

chore(shell): add bpftrace to shell image #1694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexcastilio
Copy link
Contributor

@alexcastilio alexcastilio commented Jun 18, 2025

Description

Add bpftrace to retina shell.

Related Issue

If this pull request is related to any issue, please mention it here. Additionally, make sure that the issue is assigned to you before submitting this pull request.

Checklist

  • I have read the contributing documentation.
  • I signed and signed-off the commits (git commit -S -s ...). See this documentation on signing commits.
  • I have correctly attributed the author(s) of the code.
  • I have tested the changes locally.
  • I have followed the project's style guidelines.
  • I have updated the documentation, if necessary.
  • I have added tests, if applicable.

Screenshots (if applicable) or Testing Completed

Tests executed:

# 1. Build binary with: make retina-shell-image
# 2. Push image to registry

# 3. Run kubectl retina shell:
$ ./artifacts/kubectl-retina shell aks-nodepool1-42816995-vmss000000 --capabilities=NET_ADMIN,SYS_ADMIN,SYS_RESOURCE,BPF,MKNOD,SYS_CHROOT --retina-shell-image-version=v0.0.36-3006-5 --retina-shell-image-repo=ghcr.io/alexcastilio/retina/retina-shell --apparmor-unconfined --seccomp-unconfined --mount-host-filesystem

# 4. bpftrace commands executed:
root@aks-nodepool1-42816995-vmss000000 [ / ]# bpftrace -e 'kprobe:tcp_v4_rcv { printf("tcp packet received\n"); }'
Attaching 1 probe...
tcp packet received
tcp packet received
tcp packet received
tcp packet received
tcp packet received
^C

root@aks-nodepool1-42816995-vmss000000 [ / ]# bpftrace -e 'tracepoint:syscalls:sys_enter_connect { printf("connect\n"); }'
Attaching 1 probe...
connect
connect
connect
connect
connect
connect
connect
connect
connect
^C

# for this test, open another terminal and run some commands that make dns calls (e.g. curl, wget)
root@aks-nodepool1-42816995-vmss000000 [ / ]# bpftrace -e 'uprobe:/usr/lib/libc.so.6:getaddrinfo { @start[tid] = nsecs; } uretprobe:/usr/lib/libc.so.6:getaddrinfo { @latency = hist((nsecs - @start[tid]) / 1000); delete(@start[tid]); }'
Attaching 2 probes...
^C
root@aks-nodepool1-42816995-vmss000000 [ / ]#

@latency:
[2K, 4K)               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[4K, 8K)               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[8K, 16K)              0 |                                                    |
[16K, 32K)             1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|

Additional Notes

Add any additional notes or context about the pull request here.


Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.

@alexcastilio alexcastilio force-pushed the alexcastilio/add-shell-tools-2 branch from 27874fb to 46fd4e5 Compare June 23, 2025 12:19
@alexcastilio alexcastilio force-pushed the alexcastilio/add-shell-tools-2 branch from 46fd4e5 to b7b7b85 Compare June 30, 2025 14:48
Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
@alexcastilio alexcastilio force-pushed the alexcastilio/add-shell-tools-2 branch from b7b7b85 to 24c4d87 Compare June 30, 2025 14:50
@alexcastilio alexcastilio marked this pull request as ready for review June 30, 2025 15:00
@alexcastilio alexcastilio requested a review from a team as a code owner June 30, 2025 15:00
@alexcastilio alexcastilio added this pull request to the merge queue Jun 30, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jun 30, 2025
@alexcastilio alexcastilio added this pull request to the merge queue Jul 1, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 1, 2025
@alexcastilio alexcastilio added this pull request to the merge queue Jul 1, 2025
@alexcastilio alexcastilio removed this pull request from the merge queue due to a manual request Jul 1, 2025
@alexcastilio alexcastilio marked this pull request as draft July 1, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants