SonarQube in kubernetes

Hello,

I’m trying to install helm charts sonarqube in my kubernetes cluster
I change *postgrees sql port in values * because the default port in charts values is using by another posgress in my k8

database: bitnami_sonarqube

primary:
service:
ports:
postgresql: 35432

but my container have the default port in SONARQUBE_DATABASE_PORT_NUMBER
i think this is the cause that can not run my sonar installed

i try to include values
extraEnvVars:

  • name: SONARQUBE_DATABASE_PORT_NUMBER
    value: “35432”
    or
    env:
  • name: SONARQUBE_DATABASE_PORT_NUMBER
    value: “35432”
    but still not get correct value in cantainer

any idea how to solve?
thanks

Hey there.

If you want to use Bitnami’s package, you’ll need to reach out to them for support.

You should know that we have our own (supported by SonarSource) Helm chart.

Thank you very much, I didn’t realize it wasn’t your official one

How can I modify the postgrees port without using bitnami?
These are the repo values
In other words, the port changes well from the postgree, the problem is updating the port in the sonarqube

Could you tell me how to change the value of this environment SONARQUBE_DATABASE_PORT_NUMBER in the chart values? please

You should just define the URL using jdbcOverwrite.jdbcUrl , which will include a port number.

in my case i have it enabled but y change the postgress port, in doc i can only set jdbcUrl if it not enable
but in sonar the new port in env is not set correctly SONARQUBE_DATABASE_PORT_NUMBER

Hey there.

Thanks, I understand more clearly now.

My understanding is that the helm chart is looking for the port here (see the last line of this snippet)

postgresql:
  # Enable to deploy the bitnami PostgreSQL chart
  enabled: true
  ## postgresql Chart global settings
  # global:
  #   imageRegistry: ''
  #   imagePullSecrets: ''
  ## bitnami/postgres image tag
  # image:
  #   tag: 11.7.0-debian-10-r9
  # existingSecret Name of existing secret to use for PostgreSQL passwords
  # The secret has to contain the keys postgresql-password which is the password for postgresqlUsername when it is
  # different of postgres, postgresql-postgres-password which will override postgresqlPassword,
  # postgresql-replication-password which will override replication.password and postgresql-ldap-password which will be
  # used to authenticate on LDAP. The value is evaluated as a template.
  # existingSecret: ""
  #
  # The bitnami chart enforces the key to be "postgresql-password". This value is only here for historic purposes
  # existingSecretPasswordKey: "postgresql-password"
  postgresqlUsername: "sonarUser"
  postgresqlPassword: "sonarPass"
  postgresqlDatabase: "sonarDB"
  # Specify the TCP port that PostgreSQL should use
  service:
    port: 5432

Your port number seems to be a different location (postgresql.primary.service.ports.postgresql) instead of postgresql.service.port) Why is that?

Hello, @Alina, thanks a lot for your post and contribution to the community.

I have a few questions regarding your use case.

By default all kubernetes services are separated and you can have many PostgreSQL containers with the same port, they will all be exposed under a different URL and not collide.

I attach a sample screenshot of two sonarqube chart running with the same value but under different namespaces.

Based on this could you clarify why you need to change the port number?

On top of that, we advise users not to use the Sonarqube PostgreSQL dependency for production as data handling is a very sensitive topic.

You can find some more information there