Back to Charts

SonarQube

stable/sonarqube/README.md

latest15.4 KB
Original Source

SonarQube

This chart has been deprecated and moved to Oteemo Charts

SonarQube is an open sourced code quality scanning tool.

Introduction

This chart bootstraps a SonarQube instance with a PostgreSQL database.

Prerequisites

  • Kubernetes 1.10+

Installing the chart

To install the chart:

bash
$ helm install stable/sonarqube

The above command deploys Sonarqube on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.

The default login is admin/admin.

Uninstalling the chart

To uninstall/delete the deployment:

bash
$ helm list
NAME       	REVISION	UPDATED                 	STATUS  	CHART          	NAMESPACE
kindly-newt	1       	Mon Oct  2 15:05:44 2017	DEPLOYED	sonarqube-0.1.0	default
$ helm delete kindly-newt

Configuration

The following table lists the configurable parameters of the Sonarqube chart and their default values.

ParameterDescriptionDefault
replicaCountNumber of replicas deployed1
deploymentStrategyDeployment strategy{}
image.repositoryimage repositorysonarqube
image.tagsonarqube image tag.7.9.2-community
image.pullPolicyImage pull policyIfNotPresent
image.pullSecretimagePullSecret to use for private repository
commandcommand to run in the containernil (need to be set prior to 6.7.6, and 7.4)
elasticsearch.configureNodeModify k8s worker to conform to system requirementstrue
elasticsearch.bootstrapChecksEnables/disables Elasticsearch bootstrap checkstrue
securityContext.fsGroupGroup applied to mounted directories/files999
ingress.enabledFlag for enabling ingressfalse
ingress.labelsIngress additional labels{}
ingress.hosts[0].nameHostname to your SonarQube installationsonar.organization.com
ingress.hosts[0].pathPath within the URL structure/
ingress.tlsIngress secrets for TLS certificates[]
livenessProbe.sonarWebContextSonarQube web context for livenessProbe/
readinessProbe.sonarWebContextSonarQube web context for readinessProbe/
service.typeKubernetes service typeClusterIP
service.externalPortKubernetes service port9000
service.internalPortKubernetes container port9000
service.labelsKubernetes service labelsNone
service.annotationsKubernetes service annotationsNone
service.loadBalancerSourceRangesKubernetes service LB Allowed inbound IP addressesNone
service.loadBalancerIPKubernetes service LB Optional fixed external IPNone
persistence.enabledFlag for enabling persistent storagefalse
persistence.annotationsKubernetes pvc annotations{}
persistence.existingClaimDo not create a new PVC but use this oneNone
persistence.storageClassStorage class to be used""
persistence.accessModeVolumes access mode to be setReadWriteOnce
persistence.sizeSize of the volume10Gi
persistence.volumesSpecify extra volumes. Refer to ".spec.volumes" specification[]
persistence.mountsSpecify extra mounts. Refer to ".spec.containers.volumeMounts" specification[]
sonarPropertiesCustom sonar.properties fileNone
sonarSecretPropertiesAdditional sonar.properties file to load from a secretNone
caCerts.secretName of the secret containing additional CA certificatesnil
jvmOptsValues to add to SONARQUBE_WEB_JVM_OPTS""
envEnvironment variables to attach to the podsnil
sonarSecretKeyName of existing secret used for settings encryptionNone
sonarPropertiesCustom sonar.properties file{}
database.typeSet to "mysql" to use mysql databasepostgresql
postgresql.enabledSet to false to use external server / mysql databasetrue
postgresql.postgresqlServerHostname of the external Postgresql servernull
postgresql.postgresqlPasswordSecretSecret containing the password of the external Postgresql servernull
postgresql.postgresqlUsernamePostgresql database usersonarUser
postgresql.postgresqlPasswordPostgresql database passwordsonarPass
postgresql.postgresqlDatabasePostgresql database namesonarDB
postgresql.service.portPostgresql port5432
mysql.enabledSet to false to use external server / postgresql databasefalse
mysql.mysqlServerHostname of the external Mysql servernull
mysql.mysqlPasswordSecretSecret containing the password of the external Mysql servernull
mysql.mysqlUserMysql database usersonarUser
mysql.mysqlPasswordMysql database passwordsonarPass
mysql.mysqlDatabaseMysql database namesonarDB
mysql.mysqlParamsMysql parameters for JDBC connection string{}
mysql.service.portMysql port3306
annotationsSonarqube Pod annotations{}
resourcesSonarqube Pod resource requests & limits{}
affinityNode / Pod affinities{}
nodeSelectorNode labels for pod assignment{}
hostAliasesAliases for IPs in /etc/hosts[]
tolerationsList of node taints to tolerate[]
plugins.installList of plugins to install[]
plugins.libList of plugins to install to lib/common[]
plugins.resourcesPlugin Pod resource requests & limits{}
plugins.initContainerImageChange init container imagealpine:3.10.3
plugins.initSysctlContainerImageChange init sysctl container imagebusybox:1.31
plugins.deleteDefaultPluginsRemove default plugins and use plugins.install list[]
podLabelsMap of labels to add to the pods{}
sonarqubeFolderDirectory name of Sonarqube/opt/sonarqube

You can also configure values for the PostgreSQL / MySQL database via the Postgresql README.md / MySQL README.md

For overriding variables see: Customizing the chart

Use custom cacerts

In environments with air-gapped setup, especially with internal tooling (repos) and self-signed certificates it is required to provide an adequate cacerts which overrides the default one:

  1. Create a yaml file cacerts.yaml with a secret that contains one or more keys to represent the certificates that you want including

    yaml
    apiVersion: v1
    kind: Secret
    metadata:
      name: my-cacerts
    data:
      cert-1.crt: |
        xxxxxxxxxxxxxxxxxxxxxxx
    
  2. Upload your cacerts.yaml to a secret in the cluster you are installing Sonarqube to.

    shell
    $ kubectl apply -f cacerts.yaml
    
  3. Set the following values of the chart:

    yaml
    caCerts:
      secret: my-cacerts
    

Elasticsearch Settings

Since SonarQube comes bundled with an Elasticsearch instance, some bootstrap checks of the host settings are done at start.

This chart offers the option to use an initContainer in privilaged mode to automatically set certain kernel settings on the kube worker. While this can ensure proper functionality of Elasticsearch, modifying the underlying kernel settings on the Kubernetes node can impact other users. It may be best to work with your cluster administrator to either provide specific nodes with the proper kernel settings, or ensure they are set cluster wide.

To enable auto-configuration of the kube worker node, set elasticsearch.configureNode to true. This is the default behavior, so you do not need to explicitly set this.

This will run sysctl -w vm.max_map_count=262144 on the worker where the sonarqube pod(s) get scheduled. This needs to be set to 262144 but normally defaults to 65530. Other kernel settings are recommended by the docker image, but the defaults work fine in most cases.

To disable worker node configuration, set elasticsearch.configureNode to false. Note that if node configuration is not enabled, then you will likely need to also disable the Elasticsearch bootstrap checks. These can be explicitly disabled by setting elasticsearch.bootstrapChecks to false.