We're creating a kubernetes deployment for sonar. When using the embedded H2 DB the deployment works fine and SonarQube is available thru the kube Ingress controller.
But when setting JDBC parameters for persistence the SonarQube instance fails to respond to any request and outputs the following error (in logs)
01:31:51.000 (unknown):0 warning: already initialized constant Input
01:31:51.000 WARNING: while creating new bindings for class org.jruby.rack.RackInput,
01:31:51.000 found an existing binding; you may want to run a clean build.
Here's the Kubernetes deployment descriptor:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: sonar-deployment
namespace: jenkins
spec:
replicas: 1
template:
metadata:
labels:
app: sonar
spec:
containers:
- name: sonar
image: sonarqube:latest
imagePullPolicy: Always
ports:
- containerPort: 9000
env:
- name: SONARQUBE_JDBC_USERNAME
value: sonar
- name: SONARQUBE_JDBC_PASSWORD
value: sonar
- name: SONARQUBE_JDBC_URL
value: "jdbc:mysql://xxx.xxx.xxx.xxx/sonar?useUnicode=true&characterEncoding=utf8"
Deployments is experiment feature for the kubernetes. Use replicationcontroller here is my configuration. It's work in production.
apiVersion: v1
kind: ReplicationController
metadata:
labels:
app: sonarqube
name: sonarqube
namespace: services
spec:
replicas: 1
selector:
app: sonarqube
template:
metadata:
labels:
app: sonarqube
spec:
containers:
- env:
- name: SONARQUBE_JDBC_URL
value: jdbc:mysql://mysql:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
- name: SONARQUBE_JDBC_USERNAME
value: sonar
- name: SONARQUBE_JDBC_PASSWORD
value: sonar
image: sonarqube
imagePullPolicy: Always
livenessProbe:
failureThreshold: 20
httpGet:
path: /
port: 9000
scheme: HTTP
initialDelaySeconds: 60
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 60
name: sonarqube
ports:
- containerPort: 9000
protocol: TCP
- containerPort: 9292
protocol: TCP
resources:
limits:
cpu: 500m
memory: 1000Mi