Skip to content
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

[FEATURE] host pid mode support for k3s-server and k3s-agent #929

Merged
merged 3 commits into from
Jan 25, 2022

Conversation

hlts2
Copy link
Contributor

@hlts2 hlts2 commented Jan 17, 2022

What

To support eBPF profile, I added an option to support host pid mode for k3s-agent and k3s-server.

The following is an example of usage.

k3d cluster create --host-pid-mode=true

Why

In order to enable eBPF in docker environment, the option pid=host is required.

I deployed the manifest(pyroscope) to a k3d cluster, but could not get the eBPF event properly because k3s-server and k3s-agent docker container were not started in host pid mode.

With this PR fix, k3s-server and k3s-agent will be started in host pid mode, so eBPF will be available in the k3d environment.

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
@hlts2
Copy link
Contributor Author

hlts2 commented Jan 17, 2022

The test seems to be failing, but when I executed make e2e on the main branch, I got the same error...:sob:

Try #15: 'kubectl exec testimage -- ping -c1 host.k3d.internal'
ping: bad address 'host.k3d.internal'
command terminated with exit code 1
Command 'ping -c1 host.k3d.internal' in pod 'testimage' did NOT return successfully in 15 tries
2022-01-17 08:54:46 UTC [Test | lifecycle | ] >>> Pinging host.k3d.internal failed
2022-01-17 08:54:46 UTC [Test | lifecycle | ] >>> FATAL: test failed
2022-01-17 08:56:30 UTC [Runner] >>> FINISHED BASIC TESTS
  > Total:	12
  > Run:	12
  > Skipped:	0
  > Passed:	11
  > Failed:	1

cc: @iwilltry42

@hlts2 hlts2 mentioned this pull request Jan 18, 2022
21 tasks
Copy link
Member

@iwilltry42 iwilltry42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @hlts2, thanks for your contribution! :)
Looks simple and good. I just have one comment about structuring the config, as I think this option belongs to the runtime options.

pkg/config/v1alpha3/types.go Outdated Show resolved Hide resolved
@iwilltry42 iwilltry42 added this to the v5.3.0 milestone Jan 25, 2022
@iwilltry42 iwilltry42 added the enhancement New feature or request label Jan 25, 2022
Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
@hlts2 hlts2 requested a review from iwilltry42 January 25, 2022 09:49
@hlts2 hlts2 changed the title feat: host pid mode support for k3s-server and k3s-agent [FEATURE] host pid mode support for k3s-server and k3s-agent Jan 25, 2022
Copy link
Member

@iwilltry42 iwilltry42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@iwilltry42
Copy link
Member

iwilltry42 commented Jan 25, 2022

Tests are passing for me (actually I can't get them to fail like they do in CI, but that's unrelated to this PR anyway).
Note: I may need to refactor this into v1alpha4 config version later, but it won't alter the functionality.

Thank you!

@iwilltry42 iwilltry42 merged commit c16bf6f into k3d-io:main Jan 25, 2022
@hlts2 hlts2 deleted the feature/ebpf-support branch January 25, 2022 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants