Run Apache Solr with Prometheus Metrics on Kubernetes
Introduction
Apache Solr is a fast, open source search platform built on Apache Lucene. Where Lucene is a powerful search engine framework, Apache Solr includes an HTTP wrapper around Lucene so it’s ready-to-use out of the box. Features include full-text search, hit highlighting, faceted search, dynamic clustering, database integration, rich document handling, and geospatial search. Apache Solr is used by some of the largest companies in the world to power their public projects.
This guide walks you through the process of deploying an Apache Solr cluster on Kubernetes. Bitnami's Apache Solr Helm chart makes this a quick and error-free process. The best part about using the Bitnami Helm chart is that it uses curated and trusted Bitnami images which makes it very secure. Additionally, the Bitnami Helm chart provides you with production-ready default values, enabling you to deploy Apache Solr in a single command instead of having a multi-step deployment run-book.
This guide also talks about deploying Apache Solr with Prometheus metrics exporters which can be further integrated with Tanzu Observability Service to configure dashboards in Wavefront.
By relying on Kubernetes for the cluster infrastructure, this approach avoids a single point of failure and makes it easier to scale out the cluster as more computing resources become necessary.
Assumptions and prerequisites
This guide makes the following assumptions:
- You have a multi-node Kubernetes cluster (Kubernetes 1.12+) running with Helm (Helm 3.1.0) installed.
- You have the kubectl command line (kubectl CLI) installed and configured to work with your cluster.
- You have a Docker environment installed and configured. Learn more about installing Docker.
- You have PersistentVolume (PV) provisioner support in the underlying infrastructure and support for ReadWriteMany volumes for deployment scaling.
Deploy Apache Solr on Kubernetes
This document will use VMware Tanzu Kubernetes Guest Cluster as the underlying infrastructure for the deployment of Apache Solr. The diagram below depicts the deployment architecture. Since this guide uses a three-node Apache Solr cluster, it would be best to have a three-node Kubernetes cluster for resiliency.

Below is the list of Kubernetes objects that this chart deploys:
- Apache Solr Pods are deployed as a StatefulSet with a headless service to provide Stable Network Identities.
- Zookeeper Pods are deployed as a StatefulSet with a headless service to provide Stable Network Identities.
- PersistentVolumeClaims are deployed for both Apache Solr and Zookeeper StatefulSets.
- A Service is deployed to access the Apache Solr user interface.
Below are some important Helm chart parameters to keep in mind.
- cloudEnabled: Enable Apache Solr cloud mode. By default, this is set to true.
- javaMem: Java memory options to pass to the Apache Solr container.
- heap: Java Heap options to pass to the Apache Solr container.
- zookeeper.enabled: Enable Zookeeper deployment. Needed for Apache Solr cloud mode.
- externalZookeeper.servers: Servers for external Zookeeper in case you need to configure your own. In case you need to use external Zookeeper servers, also set the zookeeper.enabled flag to false.
See the complete list of parameters supported by the Bitnami Apache Solr Helm chart.
Go ahead and deploy Apache Solr on the Kubernetes cluster, as shown below:
# Add Bitnami Helm chart repository
helm repo add bitnami https://charts.bitnami.com/bitnami
# Update the respository in case you already have it in your repository list
helm repo update
# Install the chart in the default namespace
helm install solr bitnami/solr --set service.type=LoadBalancer
Using a load balancer service will typically assign a public IP address for the deployment. Depending on your cloud provider's policies, you may incur additional charges for this IP address.
Once the deployment is complete, check the deployed resources and obtain the Apache Solr credentials, as shown below:
# Check all the Kubernetes resources deployed as part of this deployment
kubectl get all
# Check the PVCs created for both Apache Solr and Zookeeper
kubectl get pvc
# Run the commands provided in the instructions to fetch the Apache Solr UI external IP address
export SERVICE_IP=$(kubectl get svc --namespace default solr --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}")
echo "Go to ${SERVICE_IP}:8983"
# Get the Apache Solr credentials
echo Username: admin
echo Password: $(kubectl get secret --namespace default solr -o jsonpath="{.data.solr-password}" | base64 --decode)
Apache Solr is now up and running on the Kubernetes cluster! Access the Apache Solr UI using the public IP address obtained with the commands above. Log in with the credentials obtained and confirm that you see the Apache Solr dashboard, as shown below:

Deploy Apache Solr on Kubernetes with Prometheus metrics
Prometheus (https://prometheus.io/) is a monitoring solution that has first-class integration with Kubernetes. The Bitnami Apache Solr Helm chart has the option of integrating with Prometheus via the Prometheus exporter that is distributed as part of the Bitnami Apache Solr Docker image. This is turned off by default, but can be enabled via the exporter.enabled chart parameter.
Once you have enabled the Prometheus metrics exporter, you can integrate with Tanzu Observability Service to configure dashboards in Wavefront. You can set up Wavefront using the Bitnami Wavefront Helm chart.
Alternatively you can set up an instance of Prometheus. The easiest way to stand one up is via the Bitnami Prometheus Operator Helm chart.
The diagram below depicts the Apache Solr architecture with the Prometheus metrics exporter.

Apart from the important parameters mentioned in the earlier section, it is necessary to set exporter.enabled to true in order to enable the Prometheus metrics exporter when deploying the Helm chart.
The Solr exporter is not supported when deploying Solr with authentication enabled.
# Install the chart with Apache Solr Prometheus metrics exporter.
# The Solr exporter is not supported when deploying Solr with authentication
# enabled, hence disabling the authentication.
helm install solr bitnami/solr --set service.type=LoadBalancer,exporter.enabled=true,authentication.enabled=false
Once the deployment is complete, check the deployed resources:
# Check for all the Kubernetes objects deployed
kubectl get all
# Check the Apache Solr and Zookeeper PVCs
kubectl get pvc
Confirm that metrics are being exported in Prometheus format:
# Validate if the metrics are being exported
kubectl exec solr-0 -it -- bash
I have no name!@solr-0:/$ curl solr-exporter:9983/metrics
Access the Apache Solr UI using the commands mentioned in the notes:
export SERVICE_IP=$(kubectl get svc --namespace default solr --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}")
$ echo "Go to ${SERVICE_IP}:8983"
Apache Solr with the Prometheus exporter is now up and running on the Kubernetes cluster, with metrics being sent to the Prometheus endpoint (in this example, the endpoint is solr-exporter.default.svc.cluster.local:9983/metrics).
Conclusion
As illustrated, the Bitnami Apache Solr Helm chart makes deploying an Apache Solr cluster along with observability a quick, easy and secure process with Bitnami's curated and trusted artifacts. This allows you to focus your time and efforts on business logic rather than deployment configuration using multi-step runbooks.