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

The second step of the disaster recovery setup for the Data Center Edition (DCE) on Kubernetes consists in setting up the primary and replica clusters.

The setup instructions are based on a Disaster recovery architecture example with Azure resources.

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 (see Customizing the DCE Helm chart):

jdbcOverwrite:
 enabled: true
 jdbcPassword: <somepassword>
 jdbcUrl: jdbc:postgresql://yourVirtualWriterEndpoint:5432/yourDB
 jdbcUsername: <dbUserName>
  1. Deploy the two clusters following the instructions on the Installing the DCE Helm chart page.

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

Do not enable the Nginx dependencies in the Helm chart since an Azure mechanism is used (see below).

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 production environments, Azure Front Door requires FQDNs with a CA-signed certificate (self-signed certificates are not supported). IP addresses can be used for testing purposes only.

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>
  1. Configure Kubectl to connect to your AKS cluster as follows.

az aks get-credentials --resource-group <ResourceGroupName> --name <ClusterName>
  1. 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
  1. Create the ingress with the kubectl apply command (using a namespace is optional) as follows.

kubectl apply -f ingress.yaml -n <yourNameSpace>
  1. Verify the Ingress was created as follows.

kubectl get ingress -n <yourNameSpace>

Last updated

Was this helpful?