Start Free
Latest | Server installation and setup | Data Center Edition | On Kubernetes or Openshift | Setting up disaster recovery | Step 2: Set up primary/replica clusters

Step 2: Set up the primary and replica clusters on AKS

On this page

This page explains the second step of the disaster recovery setup for the Data Center Edition (DCE) on Kubernetes. The setup instructions are based on an architecture example with Azure Kubernetes Service.

In this step, you set up a primary cluster and a replica cluster on AKS.

Requirements on AKS clusters

The only requirement for the AKS clusters creation step is to create the primary and replica clusters in different geographical regions. 

Default networking (Azure CNI Overlay) and storage settings are supported and capable of hosting a SonarQube DCE instance using the Helm chart provided by Sonar. 

Sizing of the clusters is outside the scope of this section. 

Step 1: Deploy your DCE on AKS

You must set in the Helm chart the access to the PostgreSQL Virtual Writer endpoint as follows: 

1. Modify the Helm chart for each cluster to add the JDBC URL with the Database Virtual Writer Endpoint as follows:

jdbcOverwrite:
 enabled: true
 jdbcPassword: <somepassword>
 jdbcUrl: jdbc:postgresql://yourVirtualWriterEndpoint:5432/yourDB
 jdbcUsername: <dbUserName>

2. Deploy the two clusters following the instructions on the Installing Data Center Edition from the Helm repository page.

3. Once the clusters are deployed, keep only the primary cluster up and stop the replica cluster as it could create conflicts. 

Step 2: Set up the Azure managed NGINX ingress controllers

You must create an ingress for each one of your clusters, primary and replica. These ingresses will be configured as origins for the Azure Front Door’s origin group. 

For each cluster:

1. Enable Application Routing using Azure CLI on your AKS cluster as follows.

az aks approuting enable --resource-group <ResourceGroupName> --name <ClusterName>

2. Configure Kubectl to connect to your AKS cluster as follows.

az aks get-credentials --resource-group <ResourceGroupName> --name <ClusterName>

3. Create the Ingress object. Copy the following YAML file into a new file named ingress.yaml and save it to your computer. If you used a namespace when deploying your SonarQube Server, it should be added to the metadata section.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: sonarqube-dce
  namespace: sonarqube-dce
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: 120m
spec:
  ingressClassName: webapprouting.kubernetes.azure.com
  rules:
  - http:
      paths:
      - backend:
          service:
            name: sonarqube-dce-sonarqube-dce
            port:
              number: 9000
        path: /
        pathType: Prefix

4. Create the ingress with the kubectl apply command (using a namespace is optional) as follows.

kubectl apply -f ingress.yaml -n <yourNameSpace>

5. Verify the Ingress was created as follows.

kubectl get ingress -n <yourNameSpace>

Was this page helpful?

© 2008-2025 SonarSource SA. All rights reserved.

Creative Commons License