locust icon indicating copy to clipboard operation
locust copied to clipboard

locust k8s operator

Open AbdelrhmanHamouda opened this issue 2 years ago • 8 comments

Is your feature request related to a problem? Please describe.

Need for flexible, secure and easy to use distributed performance testing solution while enabling keeping in mind points like; cloud governance, k8s resource management, CI compatibility.

Describe the solution you'd like

A k8s operator

Describe alternatives you've considered

HELM. However, this is not optimal as it requires a lot of manipulation and dealing with a lot of different k8s resource types not to mention lack of governance when deployed in an organisation.

Additional context

In my company, we were interested in cloud based distributed performance testing. We ended up choosing “locust” as a tool and I wrote a kubernetes operator for it. As far as I know and searched, this simply doesn’t exist for locust today.The operator have been running on AWS EKS for months now and it is very stable and performant.

The project was created to provide:

  • A friendly user interface "A simple k8s custom resource based on a CRD"
  • Ability to run a distributed performance testing
  • Only ask for needed cluster permissions (security)
  • Exposing a Prometheus endpoint for test metrics
  • Maintain cloud infrastructure governance i.e. when used in an organisation, it is possible to maintain the governance over the allocated / created resources.
  • Cloud native by design
  • Enablement of performance testing in CI / CD pipelines

The project was inspired after doing an industry study / survey. The project was influenced in functionality by the k6 k8s operator.

As the code really doesn't include anything exclusive to the company, Open sourcing it is not a problem and it is something that I would happily do.

What is the "catch"? The only "catch" is that the project is written in Java. That being said, from a user perspective, the interface purely through k8s and users are not exposed to any java code. This is similar to how k8s and most operators are written in Go but non of k8s users need to know anything about Go.

Looking forward to your feedback.

AbdelrhmanHamouda avatar Sep 08 '22 09:09 AbdelrhmanHamouda

Sounds like a great thing! If you publish it in your own repo, I’ll happily link it from the documentation, like with the helm stuff. https://docs.locust.io/en/stable/running-in-docker.html

cyberw avatar Sep 08 '22 10:09 cyberw

I see you listed Helm as an alternative, but that doesn't really address other solutions to run distributed load tests such as k6 on k8s

EDIT: Which I do see you listed as an inspiration.

OneCricketeer avatar Sep 08 '22 23:09 OneCricketeer

Before selecting Locust, we actually did a market study to see which tool would best fit our needs. K6 was on the table and it almost made the cut if i'm being honest. However "and this is a big one", when it came down to distributed performance testing, locust was much better with supporting functionality that come out of the box. k6 "at least at the time of the study" was really focused on single instance tests.

AbdelrhmanHamouda avatar Sep 09 '22 19:09 AbdelrhmanHamouda

@cyberw, I'm gonna be working on Open sourcing the project in the coming period. It might take me a minute as i'm doing this alone but should be possible.

AbdelrhmanHamouda avatar Sep 09 '22 19:09 AbdelrhmanHamouda

Awesome!

cyberw avatar Sep 10 '22 06:09 cyberw

Hello @cyberw, The work is ongoing for the operator. One of my aims and goals are to have this operator act & "feel" like a natural extension of locust. So users of the tool can feel right at home when extending their usage to the cloud with the operator. To that extent, would it be possible to have you for a short call (or any other form of your preferred communication method) to share the methodology and approach with you and see if they are indeed aligned.

AbdelrhmanHamouda avatar Sep 19 '22 10:09 AbdelrhmanHamouda

Maybe you can show me what you have right now and we'll have a chat then? My colleague @DennisKrone is looking at running our stuff in k8s right now. At the moment we use locust-swarm (plain servers, no k8s/docker stuff), but he's looking at the helm chart right now, and I think we'd both be interested in seeing what you've done.

cyberw avatar Sep 19 '22 11:09 cyberw

The full docs are still work in progress.. However, i can put together a short "how does it work".md + short demo video. would that be enough to get things started?

AbdelrhmanHamouda avatar Sep 19 '22 11:09 AbdelrhmanHamouda

@cyberw , @DennisKrone, I have put together most parts of the essential documentation needed. The project is available at: locust-k8s-operator How does it work; demo available here

As i mentioned earlier "One of my aims and goals is to have the operator act & "feel" like a natural extension of locust. So users of the tool can feel right at home".

looking forward to hear your take on it.

AbdelrhmanHamouda avatar Sep 26 '22 21:09 AbdelrhmanHamouda

Sorry for the delay. I'll take a look!

DennisKrone avatar Oct 03 '22 14:10 DennisKrone

Hi @AbdelrhmanHamouda ! This looks amazing! I checked the docs and would like to give it a try. How do I open the UI when a test is running?

vitobotta avatar Oct 29 '22 19:10 vitobotta

Hello @vitobotta, Thank you for taking interest in the project. Your question have 2 answers one for getting started and another for doing things "properly";

  • The proper way to see the results is to setup a Prometheus server and a metric visualisation tool e.g. grafana and build a dashboard (i will be pushing some documentation around this in the near future)
  • The easiest way to get to the UI and see Locust running is to simply port-forward the UI port of the locust-master container/pod then you can access the UI on localhost

AbdelrhmanHamouda avatar Nov 01 '22 17:11 AbdelrhmanHamouda

@DennisKrone I am planning to push the v1.0.0 release in the near future and I would like to have your insights to consider before pushing that version.

@cyberw As i just mentioned, I am planning to push the 1.0.0 in the near future and I would like to add a reference to the operator in the locust documentation. Would this contribution be welcomed?

I would like to add that the Operator is been actively and reliably utilised in AWS based k8s cluster/s for over 7 month by this point.

AbdelrhmanHamouda avatar Nov 01 '22 17:11 AbdelrhmanHamouda

Hi!

@DennisKrone is actively working on adding this to our own workflow, and from what I've heard so far he's happy with it (I'm sure he'll have some feedback too)

I would very much welcome adding this to the documentation!

cyberw avatar Nov 01 '22 18:11 cyberw

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 10 days.

github-actions[bot] avatar Jan 01 '23 02:01 github-actions[bot]

Done!

cyberw avatar Feb 28 '23 16:02 cyberw

Hi for info, I had developed for a project something similar: https://github.com/treussart/locust-operator

treussart avatar Mar 08 '23 05:03 treussart