0

我们正在为声纳创建一个 Kubernetes 部署。使用嵌入式 H2 DB 时,部署工作正常,SonarQube 可通过 kube Ingress 控制器使用。

但是在为持久性设置 JDBC 参数时,SonarQube 实例无法响应任何请求并输出以下错误(在日志中)

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.

这是 Kubernetes 部署描述符:

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"
4

1 回答 1

0

部署是 Kubernetes 的实验功能。这里使用replicationcontroller 是我的配置。这是生产中的工作。

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
于 2016-06-29T16:34:14.210 回答