The Issue Hi, I am deploying Sonarqube onto an AKS cluster using the Helm chart: https://github.com/SonarSource/helm-chart-sonarqube/tree/master/charts/sonarqube
I am using the kubernetes ingress-nginx (not nginx-ingress) controller on the cluster: https://github.com/kubernetes/ingress-nginx/tree/main/charts/ingress-nginx
if I deploy everything with a standard ingress just on ‘/’ of my host, it appears to all work fine. if I deploy the ingress using the target-rewrite, when I browse to Sonarqube it just sits on a loading page. Because gets for things inside the app are failing.... there must be either missing config for the ingress (that I cant find).. or something is wrong with the target-rewrite mechanism.
Config here is my ingress config:
ingress:
enabled: true
ingressClassName: nginx
hosts:
- name: myapp.co.uk
path: /sonarqube(/|$)(.*)
pathType: Prefix
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
nginx.ingress.kubernetes.io/protocol: http
nginx.ingress.kubernetes.io/proxy-body-size: "64m"
logs the ingress controller logs show: [04/Aug/2023:12:09:45 +0000] “GET /api/features/list HTTP/2.0” 404 548 “https:/myapp.co.uk/sonarqube/” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36” 32 0.001 [upstream-default-backend] 127.0.0.1:8181 548 0.001 404
the logs from sonarqube pod show:
2023.08.04 12:08:53 INFO web[][o.s.s.n.NotificationDaemon] Notification service started (delay 60 sec.)
2023.08.04 12:08:54 INFO web[][o.s.s.t.TelemetryDaemon] Sharing of SonarQube statistics is enabled.
2023.08.04 12:08:54 INFO web[][o.s.w.s.DispatcherServlet] Initializing Servlet 'app'
2023.08.04 12:08:55 INFO web[][o.s.w.s.DispatcherServlet] Completed initialization in 1439 ms
2023.08.04 12:08:55 INFO web[][o.s.s.s.GeneratePluginIndex] Generate scanner plugin index
2023.08.04 12:08:55 INFO web[][o.s.s.s.RegisterPermissionTemplates] Register permission templates
2023.08.04 12:08:55 INFO web[][o.s.s.s.RenameDeprecatedPropertyKeys] Rename deprecated property keys
2023.08.04 12:08:56 INFO web[][o.s.s.s.RegisterPlugins] Register plugins
2023.08.04 12:08:56 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.platform.web.SonarLintConnectionFilter@53a50f2a [pattern=UrlPattern{inclusions=[/api/], exclusions=[/api/v2/]}]
2023.08.04 12:08:56 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.platform.web.WebServiceFilter@59caeb7c [pattern=UrlPattern{inclusions=[/api/issues/delete_comment., ...], exclusions=[/api/authentication/login., ...]}]
2023.08.04 12:08:56 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.platform.web.WebServiceReroutingFilter@7e81148f [pattern=UrlPattern{inclusions=[/api/components/update_key, ...], exclusions=[]}]
2023.08.04 12:08:56 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.DefaultAdminCredentialsVerifierFilter@5835b4c7 [pattern=UrlPattern{inclusions=[/], exclusions=[.css, ...]}]
2023.08.04 12:08:56 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.InitFilter@23922cb4 [pattern=UrlPattern{inclusions=[/sessions/init/], exclusions=[]}]
2023.08.04 12:08:56 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.SamlValidationRedirectionFilter@2d8da2b1 [pattern=UrlPattern{inclusions=[/oauth2/callback/saml],
exclusions=[]}]
2023.08.04 12:08:56 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.OAuth2CallbackFilter@5b5eeee3 [pattern=UrlPattern{inclusions=[/oauth2/callback/], exclusions=[]}]
2023.08.04 12:08:56 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.ResetPasswordFilter@2eb8eac3 [pattern=UrlPattern{inclusions=[/], exclusions=[.css, ...]}]
2023.08.04 12:08:56 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.ws.LoginAction@4409e520 [pattern=UrlPattern{inclusions=[/api/authentication/login], exclusions=[]}]
2023.08.04 12:08:56 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.ws.LogoutAction@3305e1d2 [pattern=UrlPattern{inclusions=[/api/authentication/logout], exclusions=[]}]
2023.08.04 12:08:56 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.ws.ValidateAction@47e44873 [pattern=UrlPattern{inclusions=[/api/authentication/validate], exclusions=[]}]
2023.08.04 12:08:56 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.saml.ws.ValidationInitAction@627b4891 [pattern=UrlPattern{inclusions=[/saml/validation_init], exclusions=[]}]
2023.08.04 12:08:56 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.saml.ws.ValidationAction@7a8c45d5 [pattern=UrlPattern{inclusions=[/saml/validation], exclusions=[]}]
2023.08.04 12:08:56 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.user.ws.ChangePasswordAction@1c7d842c [pattern=UrlPattern{inclusions=[/api/users/change_password], exclusions=[]}]
2023.08.04 12:08:56 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.plugins.PluginsRiskConsentFilter@5ca52538 [pattern=UrlPattern{inclusions=[/], exclusions=[.css, ...]}]
2023.08.04 12:08:56 INFO web[][o.s.s.q.ProjectsInWarningDaemon] Counting number of projects in warning is not started as there are no projects in this situation.
2023.08.04 12:08:56 INFO web[][o.s.s.p.p.PlatformLevelStartup] Running Community Edition
2023.08.04 12:08:56 INFO app[][o.s.a.SchedulerImpl] Process[web] is up
2023.08.04 12:08:56 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[COMPUTE_ENGINE] from [/opt/sonarqube]: /opt/java/openjdk/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED -Dcom.redhat.fips=false -javaagent:/opt/sonarqube/data/jmx_prometheus_javaagent.jar=8001:/opt/sonarqube/conf/prometheus-ce-config.yaml -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/sonar-application-10.1.0.73491.jar:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.6.0.jar org.sonar.ce.app.CeServer /opt/sonarqube/temp/sq-process15876344161872477242properties
2023.08.04 12:08:58 INFO web[][o.s.s.p.Platform] Web Server is operational
screenshots This is the loading screen...
and Argo thinks everything is fine with the sonarqube deployment:
Environment
- Version of the Ingress Controller - v1.8.1
- Version of Kubernetes - v1.25.6
- Kubernetes platform - AKS
- Using NGINX
Expected behavior when I browse to myapp.co.uk/sonarqube I would expect the app to work as all pods are running fine on the cluster, and if I change the ingress to just be on '/' of the host, by changing 'path:' to '/', and removing the target-rewrite annotation, everything works fine.