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

Preserve background process from initContainers to runner #394

Open
robooo opened this issue Apr 16, 2024 · 5 comments
Open

Preserve background process from initContainers to runner #394

robooo opened this issue Apr 16, 2024 · 5 comments
Labels
enhancement New feature or request evaluation needed

Comments

@robooo
Copy link

robooo commented Apr 16, 2024

Feature Description

My current deployment requires to do vpn connections which are done by executing a process in the background e.g. ./scripts/vpn &. If I don't execute it in background then k6 pod is waiting forever. I'm not able to change the connection approach/logic.

I hoped initContainers can help me, like I can setup the interface and other commands but can't keep alive the background process for k6 execution.

Suggested Solution (optional)

I'm not sure if allowing shareProcessNamespace: true would solve this?
Based on this https://stackoverflow.com/questions/65576193/how-to-keep-a-process-running-throughout-pod-lifecycle

If there is some easier way please let me know.

Already existing or connected issues / PRs (optional)

No response

@robooo robooo added the enhancement New feature or request label Apr 16, 2024
@yorugac
Copy link
Collaborator

yorugac commented Apr 19, 2024

Hi @robooo, thanks for opening the issue!

This is an interesting case. AFAIS, shareProcessNamespace is more meant to help with debugging. So IMHO, your case sounds like it requires another regular container instead of initContainer (docs).

This never came up before and there is an argument to be made that k6 container in the runner pod shouldn't have any other containers in order to avoid skewing results of the test.

I'm not able to change the connection approach/logic.

Out of curiosity, why is it not possible? I.e. "normally", Kubernetes access can be set up so that one won't need to run custom VPN scripts inside.

@robooo
Copy link
Author

robooo commented Apr 19, 2024

Thanks @yorugac! I understand, but I don't want to create some new "proxy pod" with installed binaries and running vpn and then route k6 via it, since it can be a bottleneck. Or are there some recommended deployment examples in case of using vpn + k6?

I just really want to execute the binaries before k6 run to be able to access the backend and route the traffic via it. The init container was the first approach which I've tried and yesterday I found another way with xk6-exec which allowed me to execute the vpn binary right from the test case (in the k6 container) after few tweaks I'm able to run it in the background too. But wouldn't it be easier to allow command for k6 runner or something similar?

@yorugac
Copy link
Collaborator

yorugac commented Apr 25, 2024

I found another way with xk6-exec which allowed me to execute the vpn binary right from the test case (in the k6 container) after few tweaks I'm able to run it in the background too

This is a good workaround 👍 Thanks for sharing, @robooo!

Or are there some recommended deployment examples in case of using vpn + k6?

Not really, AFAIK... In your use case, there's a restriction that you have to run this script "manually" before k6 execution. I imagine usually people make their Kubernetes setup for k6-operator without such internal restrictions. Why do you need VPN inside Kubernetes cluster? Or is it that you're trying to test some service outside of Kubernetes cluster that is reachable only via VPN? Some details would really help here.

@yorugac
Copy link
Collaborator

yorugac commented Apr 25, 2024

This topic actually reminded of multi-cluster problem and related projects, like this one.

@robooo
Copy link
Author

robooo commented Apr 26, 2024

@yorugac exactly! I'm trying to test/reach webserver from outside of Kubernetes cluster that is reachable only via VPN. It is no openvpn or something opensourced but more internal. The next step will be execute it from a different cluster in cloud not from local private server but I think the approach needs to be the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request evaluation needed
Projects
None yet
Development

No branches or pull requests

2 participants