Deploy Apache Solr 8.11.2 on Azure Kubernetes Service (AKS)

Overview

Apache Solr is a highly reliable, scalable, and fault-tolerant search platform used in many large-scale enterprise applications. Running Solr on Azure Kubernetes Service (AKS) offers flexibility, high availability, and integrated cloud-native features like persistent storage and load balancing.

This post shows how to deploy Solr 8.11.2 and a ZooKeeper ensemble into an AKS cluster using PowerShell scripts, adapted from the freedev/solrcloud-zookeeper-kubernetes repository. The deployment is automated through two scripts:

  • deploy.ps1: provisions the AKS cluster
  • start-aks-solr-cluster.ps1: deploys Solr and ZooKeeper using Kubernetes YAML manifests

Prerequisites

  • Azure subscription
  • Azure CLI installed (Install Guide)
  • PowerShell environment
  • kubectl installed
  • (Optional) git to clone the base project repo

Project Structure

We cloned from the GitHub repo: freedev/solrcloud-zookeeper-kubernetes and retained only the relevant YAML files for AKS deployment. We create new two Powershell files named deploy.ps1 and start-aks-solr-cluster.ps1.

.
├── aks
│   ├── service-solr-cluster.yml
│   ├── service-zookeeper-ensemble.yml
│   ├── storageclass-solrcluster.yml
│   ├── storageclass-zkensemble.yml
├── configmap
│   ├── solr-cluster-config.properties
│   ├── zookeeper-ensemble-config.properties
├── statefulsets
│   ├── statefulset-solr-cluster.yml
│   ├── statefulset-zookeeper-ensemble.yml
├── deploy.ps1
├── start-aks-solr-cluster.ps1

Provision AKS Cluster

The deploy.ps1 file contains the following PowerShell commands. They should be executed by below order.

# Updated Variables for Solr on AKS
$RESOURCE_GROUP="SolrResourceGroup"
$LOCATION="southeastasia"
$AKS_NAME="SolrAKSCluster"
$NODE_COUNT=3
$NODE_SIZE="Standard_DS2_v2"
$K8S_VERSION="1.30.0"

# Create resource group
az group create `
  --name $RESOURCE_GROUP `
  --location $LOCATION

# (Optional) View available versions
az aks get-versions --location $LOCATION --output table

# Create AKS cluster
az aks create `
  --resource-group $RESOURCE_GROUP `
  --name $AKS_NAME `
  --node-count $NODE_COUNT `
  --node-vm-size $NODE_SIZE `
  --kubernetes-version $K8S_VERSION `
  --generate-ssh-keys `
  --enable-managed-identity

Deploy Solr + ZooKeeper

The start-aks-solr-cluster.ps1 file contains the following PowerShell commands. They should be executed by below order.

Connect to AKS (via Azure Portal)

  1. Open the Azure Portal
  2. Go to Kubernetes services
  3. Select your cluster (e.g., SolrAKSCluster)
  4. On the left menu, choose Overview
  5. Click Connect at the top
  6. Copy the CLI command under Azure CLI to get AKS credentials:
az aks get-credentials --resource-group SolrResourceGroup --name SolrAKSCluster

Run the Deployment Script

az login
az account set --subscription d0d0556e-3015-4cc6-b281-80a8ea247429
az aks get-credentials --resource-group SolrResourceGroup --name SolrAKSCluster --overwrite-existing

# ZooKeeper Setup
kubectl create configmap zookeeper-ensemble-config --from-env-file=configmap/zookeeper-ensemble-config.properties
kubectl apply -f aks/storageclass-zkensemble.yml
kubectl apply -f aks/service-zookeeper-ensemble.yml
kubectl apply -f statefulsets/statefulset-zookeeper-ensemble.yml

# Wait until ZooKeeper pods are Ready

# Solr Setup
kubectl create configmap solr-cluster-config --from-env-file=configmap/solr-cluster-config.properties
kubectl apply -f aks/storageclass-solrcluster.yml
kubectl apply -f aks/service-solr-cluster.yml
kubectl apply -f statefulsets/statefulset-solr-cluster.yml

Access Solr Service in AKS

The service-solr-cluster.yml defines a LoadBalancer-type service. After deployment, you can retrieve the external IP:

kubectl get service solr-cloud-cluster -o wide

Once the external IP is assigned, access Solr UI at:

http://<EXTERNAL-IP>:8983/solr

For example:

http://20.187.110.123:8983/solr

Make sure your firewall/NAT rules allow public access to that port.

Cleanup

az group delete --name SolrResourceGroup --yes --no-wait

References

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top