Support external Elasticsearch cluster

Hi folks,

We’re running SonarQube in Kubernetes and would like to use managed services of our Cloud provider as much as possible for stateful data, i. e. a managed PostgreSQL server and a managed Elasticsearch cluster.

Effectively, I’d like to only run stateless parts of SonarQube in Kubernetes and let the Cloud provider take care of “the hard stuff”, i. e. stateful databases.

While SonarQube supports using an external database server out-of-the-box, it doesn’t seem to support using an external Elasticsearch cluster (with proper authentication):
https://docs.sonarqube.org/9.0/setup/environment-variables/#header-6

There have been similar topics before which have been closed:

@Tobias_Trabelsi encouraged me to create this feature request nonetheless after opening a GitHub issue on the SonarQube Helm chart:
https://github.com/SonarSource/helm-chart-sonarqube/issues/67

2 Likes

Hi @joschi,

Thanks for the suggestion.

Are you facing some specific problems with the way Elasticsearch is currently handled by SonarQube in Kubernetes?
Or does your request comes from a wish to rationalize the way you operate all your services?

Hi Christophe,

It’s the latter: We want our pods in the Kubernetes cluster to be stateless and keep all databases out of the Kubernetes cluster (i. e. use the hosted services offered by our cloud platform).

With Elasticsearch “living” inside the same container as SonarQube itself, it could potentially be corrupted if the container is being stopped (for whatever reason). Even if Elasticsearch is not the system of record in this case, it would be one thing less to worry about when using the SonarQube Helm chart and running SonarQube in Kubernetes.

2 Likes

Thanks for sharing @joschi.

Hi @Chris ,

We’re facing a specific problem at the moment.

We would like to run SonarQube on our GCP Autopilot (a managed Kubernetes cluster) cluster. Which does not allow privileged Pods.
However, these are required to change (most) Linux Kernel settings. Elasticsearch requires a change of the vm.max_map_count setting. Which basically blocks running Elasticsearch on a GCP Autopilot cluster. Which in turn blocks running SonarQube on there, since it has Elasticsearch built in.

Some context:

This Elasticsearch issue could be avoided if it would be possible to configure SonarQube to use an external Elasticsearch instance (that is running somewhere else).

4 Likes

Hello guys,

I am wondering if this functionality has not been implemented yet?

It is not possible nowadays to configure an external Elasticsearch cluster for the community/enterprise edition?

Hi Alejandro,

It’s no yet possible to configure an external Elasticsearch.
This is not in the short-term roadmap but we are tracking the requests on this topic and are actively monitoring this thread.

Chris,
Thanks for sharing! Is it still impossible to use the external ES cluster for the community edition? Are there any roadmap documents that we can have a look at?

Thanks

I am also very interested in this for a similar reason to @teleboy_orlando

We are also very interested to run Elasticsearch outside the pod.

The K8s team on my organization doesn’t allow to run any applications with high privileges, so I still need to run Sonarqube with Docker Compose. If I could run ElasticSearch outside, this wouldn’t be a problem anymore.

2 Likes

Plus 1 for running ElasticSearch externally.

At the moment, we face an issue with broken indices.
As a short-term solution, we reindex the affected projects daily.

Setup:

  • Enterprise Edition
  • Version 9.9.4 (build 87374)
  • Docker
  • AWS RDS PostgreSQL