Problem with Lab - SonarQube

Hi,

In one of the exercises I am supposed to deploy SonarQube to K8s. When I do that, the pod is being restared, and when I look at the logs I can see:

2022.09.22 18:37:35 INFO  web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [http://localhost:9001]
2022.09.22 18:37:37 WARN  web[][o.s.a.s.w.WebService$Action] Description is not set on action api/monitoring/metrics
2022.09.22 18:37:37 WARN  web[][o.s.a.s.w.WebService$Action] Since is not set on action api/monitoring/metrics
2022.09.22 18:37:37 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/monitoring/metrics
2022.09.22 18:37:37 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/system/liveness
2022.09.22 18:37:37 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.platform.web.WebServiceFilter@1c6e3ff9 [pattern=UrlPattern{inclusions=[/api/system/migrate_db.*, ...], exclusions=[/api/components/update_key, ...]}]
2022.09.22 18:37:37 INFO  web[][o.s.s.p.DetectPluginChange] Detect plugin changes
2022.09.22 18:37:37 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2022.09.22 18:37:37 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
java.lang.IllegalStateException: org.springframework.context.annotation.AnnotationConfigApplicationContext@584db854 has been closed already
        at org.springframework.context.support.AbstractApplicationContext.assertBeanFactoryActive(AbstractApplicationContext.java:1138)
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1171)
        at org.sonar.core.platform.SpringComponentContainer.getOptionalComponentByType(SpringComponentContainer.java:145)
        at org.sonar.server.platform.platformlevel.PlatformLevel.getOptional(PlatformLevel.java:97)
        at org.sonar.server.platform.platformlevel.PlatformLevel.lambda$getWebServer$0(PlatformLevel.java:149)
        at java.base/java.util.Optional.flatMap(Optional.java:294)
        at org.sonar.server.platform.platformlevel.PlatformLevel.getWebServer(PlatformLevel.java:149)
        at org.sonar.server.platform.platformlevel.PlatformLevel.addIfStartupLeader(PlatformLevel.java:115)
        at org.sonar.server.platform.platformlevel.PlatformLevel4.configureLevel(PlatformLevel4.java:280)
        at org.sonar.server.platform.platformlevel.PlatformLevel.configure(PlatformLevel.java:70)
        at org.sonar.server.platform.PlatformImpl.start(PlatformImpl.java:193)
        at org.sonar.server.platform.PlatformImpl.startLevel34Containers(PlatformImpl.java:177)
        at org.sonar.server.platform.PlatformImpl$1.lambda$doRun$0(PlatformImpl.java:105)
        at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.runIfNotAborted(PlatformImpl.java:344)
        at org.sonar.server.platform.PlatformImpl$1.doRun(PlatformImpl.java:105)
        at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.run(PlatformImpl.java:328)
        at java.base/java.lang.Thread.run(Thread.java:829)
2022.09.22 18:37:38 INFO  web[][o.s.s.p.d.EmbeddedDatabase] Embedded database stopped
2022.09.22 18:37:38 INFO  app[][o.s.a.SchedulerImpl] Process[Web Server] is stopped
2022.09.22 18:37:38 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

Any suggestions ?

Hi @pakulski.maciej

Thank you for your submission, can you please share to us the link the exercise you talking about and the solution you implement

Thank

Here’s the link DevSecOps – Kubernetes DevOps & Security | KodeKloud.

I’ve just followed the instruction :slight_smile:

Deploy `SonarQube` to the Kubernetes cluster using the given template. Once deployed you should be able to access the SonarQube UI using `SonarQube` button on the top bar.

kubectl apply -f /root/sonarqube.yaml

I am having the same issue, 502 Bad Gateway. Sonarqube pod is running fine but cannot open the web browser.

1 Like

Hello All,
Thanks for highlighting this to us.
We have reported that to the team and will try to resolve it on priority.
Appreciate your patience and apologies for the inconvenience caused.

I have the same problem too now and while waiting for the sonarqube UI to be up, the lab gets disconnected several times.

2 Likes

I try again and use kubectl get pod:
root@controlplane ~ ➜ kubectl get pod
NAME READY STATUS RESTARTS AGE
node-app-654b57f4b6-lq9n2 1/1 Running 0 6m41s
sonarqube-77bc869bfd-l7h45 1/1 Running 1 (33s ago) 116s

root@controlplane ~ ➜ kubectl get pod
NAME READY STATUS RESTARTS AGE
node-app-654b57f4b6-lq9n2 1/1 Running 0 7m7s
sonarqube-77bc869bfd-l7h45 0/1 OOMKilled 1 (59s ago) 2m22s

It was running for a while and the sonarqube webpage loads, but it then got offline and the container got killed by itself.

1 Like