SonarQube in AKS - Docker or Helm

Hi everyone,

I’m working on installing SonarQube LTS Community 9.9.4 in AKS. We have an existing SonarQube 9.9.4 environment with an external SQL database that we’re trying to move to AKS. I have a new SQL database that I’ve copied from the previous one to retain scan history.

I’ve been trying to install SonarQube by using two different methods but running into different issues on each.

  1. Installing via Helm chart. Everything appears to be working as expected. I can login with the admin credentials that we specified before the database migration and the scan history is there. However, when I try to install the sonarqube-community-branch-plugin, I always get an error in the install-plugins contains that reads “/tmp/scripts/install_plugins.sh: 3: curl: not found”. If I remove the plug-in from values.yaml, SonarQube starts successfully.

  2. Installing via a Docker image. I created an image on my workstation that has SonarQube working successfully. SonarQube connects to my SQL database and the plug-in installs correctly and works as expected. However, when I try to use this image in AKS, SonarQube always tries to use the default H2 database.

On my workstation, it pulls the values from docker-compose.yaml which works.

To use the Docker image in AKS, we are using a deployment.yaml file and specifying the database connection in it but it is still using the default H2 database. Other than that, SonarQube starts successfully and the plug-in is there.
Is there a proper way to specify an external database connection when deploying a docker image to AKS?

apiVersion: apps/v1
kind: Deployment
metadata:
  name: sonarqube
  labels:
    app: sonarqube
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sonarqube
  template:
    metadata:
      labels:
        app: sonarqube
    spec:
      containers:
      - name: sonarqube
        image: acr.azurecr.io/sonarqube-np:9.9.4-community
        env:
        - name: SONARQUBE_JDBC_URL  
          value: jdbc:sqlserver://connectionstring
        - name: SONARQUBE_JDBC_USERNAME  
          value: username
        - name: SONARQUBE_JDBC_PASSWORD  #
          value: password

TL;DR: One method is working with everything except being able to load a plug-in. The other method is working except it won’t use my SQL database.

You’re using the wrong environment variables.

You can find the right ones (SONAR_ as opposed to SONARQUBE_) documented here.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.