Startup probe failed: connect: connection refused

Friends of the SonarQube community, I need your help, I deployed SonarQube community version in a Kubernetes cluster, the deployment is done through ArgoCD, it works correctly, until after a few hours the pod recreates itself in the namespace and never comes up. When I check the logs it shows me the following:

2022.06.22 14:07:41 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://sonarqube-preprod-postgresql:5432/sonarDB
2022.06.22 14:07:42 WARN  web[][o.s.c.a.AnnotationConfigApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@5c8da962-org.sonar.db.DefaultDatabase': Initialization of bean failed; nested exception is java.lang.IllegalStateException: Fail to connect to database

When I describe the pod, it shows me the following events:

Events:
  Type     Reason     Age                   From               Message
  ----     ------     ----                  ----               -------
  Normal   Scheduled  23m                   default-scheduler  Successfully assigned sonarqube/sonarqube-preprod-sonarqube-0 to ip-10-70-201-10.ec2.internal
  Normal   Pulled     23m                   kubelet            Container image "busybox:1.32" already present on machine
  Normal   Started    23m                   kubelet            Started container wait-for-db
  Normal   Created    23m                   kubelet            Created container wait-for-db
  Normal   Started    23m                   kubelet            Started container init-sysctl
  Normal   Pulled     23m                   kubelet            Container image "busybox:1.32" already present on machine
  Normal   Created    23m                   kubelet            Created container init-sysctl
  Normal   Started    23m                   kubelet            Started container inject-prometheus-exporter
  Normal   Pulled     23m                   kubelet            Container image "curlimages/curl:7.76.1" already present on machine
  Normal   Created    23m                   kubelet            Created container inject-prometheus-exporter
  Normal   Created    22m (x2 over 23m)     kubelet            Created container sonarqube
  Normal   Started    22m (x2 over 23m)     kubelet            Started container sonarqube
  Normal   Pulled     21m (x3 over 23m)     kubelet            Container image "sonarqube:9.5.0-community" already present on machine
  Warning  Unhealthy  18m (x13 over 23m)    kubelet            Startup probe failed: Get "http://10.70.206.9:9000/api/system/status": dial tcp 10.70.206.9:9000: connect: connection refused
  Warning  BackOff    8m44s (x35 over 21m)  kubelet            Back-off restarting failed container
  Warning  Unhealthy  3m40s (x4 over 21m)   kubelet            Startup probe failed: Get "http://10.70.206.9:9000/api/system/status": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

I appreciate your help on this issue, thank you very much.

Hi,

Welcome to the community!

Here’s the heart of the matter:

 
HTH,
Ann

A post was split to a new topic: Container restarts after 2min

The problem was on our side, I had not created correctly the secret where I was passing the database password.
Thank you very much and sorry for the inconvenience.

1 Like