kubectl-trace: Missing header error while trying to run a trace

I tried to run a trace on a cluster built with kops, here is what I see in trace logs

# kubectl-trace logs kubectl-trace-c2405ead-a4b3-11e9-890b-0232f65d1adc
if your program has maps to print, send a SIGINT using Ctrl-C, if you want to interrupt the execution send SIGINT two times
/bpftrace/include/asm_goto_workaround.h:14:10: fatal error: 'linux/types.h' file not found

Relevant info

# kubectl version
Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.9", GitCommit:"16236ce91790d4c75b79f6ce96841db1c843e7d2", GitTreeState:"clean", BuildDate:"2019-03-25T06:40:24
Z", GoVersion:"go1.10.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.9", GitCommit:"16236ce91790d4c75b79f6ce96841db1c843e7d2", GitTreeState:"clean", BuildDate:"2019-03-25T06:30:48
Z", GoVersion:"go1.10.8", Compiler:"gc", Platform:"linux/amd64"}
# kubectl-trace version
git commit:
build date: undefined
# uname -a
Linux ip-10-65-134-126 4.9.0-7-amd64 #1 SMP Debian 4.9.110-3+deb9u2 (2018-08-13) x86_64 GNU/Linux

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 21 (4 by maintainers)

Commits related to this issue

Most upvoted comments

For anyone in the future having the same problem on Amazon Linux 2 the solution to run successfully kubectl trace is to have installed on node the kernel-devel package.

sudo  yum install kernel-devel-$(uname -r)

relevant resource

Thanks, @joestringer for the initial advice that help me to find the fix for my use case.

Tks for the fix @fntlnz and @joestringer 😃

Similarly, sudo apt-get install linux-headers-amd64 fixed this on Debian 10.

@joestringer Unfortunately it doesn’t work.

 sudo yum install kernel-headers
Loaded plugins: priorities, update-motd
amzn2-core                                                                                                                                                                           | 3.7 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package kernel-headers.x86_64 0:4.14.181-140.257.amzn2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================
 Package                                           Arch                                      Version                                                    Repository                                     Size
============================================================================================================================================================================================================
Installing:
 kernel-headers                                    x86_64                                    4.14.181-140.257.amzn2                                     amzn2-core                                    1.1 M

Transaction Summary
============================================================================================================================================================================================================
Install  1 Package

Total download size: 1.1 M
Installed size: 4.2 M
Is this ok [y/d/N]: y
Downloading packages:
kernel-headers-4.14.181-140.257.amzn2.x86_64.rpm                                                                                                                                     | 1.1 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : kernel-headers-4.14.181-140.257.amzn2.x86_64                                                                                                                                             1/1 
  Verifying  : kernel-headers-4.14.181-140.257.amzn2.x86_64                                                                                                                                             1/1 

Installed:
  kernel-headers.x86_64 0:4.14.181-140.257.amzn2                                                                                                                                                            

Complete!

And the error remains the same.

@stafot I think you also need to install the kernel-headers package on the node to get this working on Amazon Linux 2.

Same here. Running master and nodes with ubuntu 19.04.

Trying installing the build-essentials in all of them, but the error still happens. The cluster is running with Cilium correctly, so it might be some other thing.

The same happens while running against Node or Pod, as the following:

kubectl trace run -f opensnoop.bt pod/nginx-7c45b84548-9wl6j -a
trace 8b0e3f4d-a66b-11e9-b0f3-000c29cf9885 created

if your program has maps to print, send a SIGINT using Ctrl-C, if you want to interrupt the execution send SIGINT two times
/bpftrace/include/asm_goto_workaround.h:14:10: fatal error: 'linux/types.h' file not found
exit status 1

Tks

I ran this from a master node, so all other nodes in the cluster should have the same kernel and Linux version. We do, however, use our own custom AMI that adds a bunch of other tools on top of Kops’ AMI. I can try this on a vanilla kops cluster.