Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample under ingress minikube not works #544

Open
masalinas opened this issue Oct 30, 2023 · 0 comments
Open

Sample under ingress minikube not works #544

masalinas opened this issue Oct 30, 2023 · 0 comments

Comments

@masalinas
Copy link

masalinas commented Oct 30, 2023

Right now I have this solution deployed in kubernetes (minikube with ingress activated and configured):

  • Backend service springboot (spring-boot-starter-websocket 3) implementing stomp over websockets deployed in minikube under a nginx ingress activated and configured
  • Frontend in Angular 16 deployed outside kubernetes to debug

These are my end-to-end tests and results

  • If I start the two services native everything works OK
  • If I deployed the backend service under minikube and expose the service under a proxy port-forward and the frontend native everithing works OK
  • If I deployed the backend service under minikube and expose the service under a nginx ingress and open a websocker connection using postman everithing works OK
  • If I deployed the backend service under minikube and expose the service under a nginx ingress and open the frontend native the client NOT connect with a WebSocketError like this:
client.js:285 WebSocket connection to 'ws://minikube.io/poc-backend/ws' failed: 
_createWebSocket @ client.js:285
(anonymous) @ client.js:218
asyncGeneratorStep @ asyncToGenerator.js:3
_next @ asyncToGenerator.js:22
invoke @ zone.js:368
onInvoke @ core.mjs:11061
invoke @ zone.js:367
run @ zone.js:129
(anonymous) @ zone.js:1257
invokeTask @ zone.js:402
(anonymous) @ core.mjs:10735
onInvokeTask @ core.mjs:10735
invokeTask @ zone.js:401
onInvokeTask @ core.mjs:11048
invokeTask @ zone.js:401
runTask @ zone.js:173
drainMicroTaskQueue @ zone.js:581
invokeTask @ zone.js:487
ZoneTask.invoke @ zone.js:472
data.args.<computed> @ zone.js:2347
Show 20 more frames
rx-stomp.config.ts:33 Mon Oct 30 2023 12:36:51 GMT+0100 (hora estándar de Europa central) 'Connection closed to ws://minikube.io/poc-backend/ws'
rx-stomp.config.ts:33 Mon Oct 30 2023 12:36:51 GMT+0100 (hora estándar de Europa central) 'STOMP: scheduling reconnection in 500ms'
rx-stomp.config.ts:33 Mon Oct 30 2023 12:37:42 GMT+0100 (hora estándar de Europa central) 'Opening Web Socket...'

As you see only when the ingress is in the middle the back and front the connection is not established, but however using postman it works. Also I don't have any detail error to discover the origin of the error, so my question is:

This is my log from ingress controller when I can't connect to backend throw ingress

172.23.0.1 - - [30/Oct/2023:13:06:36 +0000] "GET /poc-backend/ws HTTP/1.1" 308 164 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" 554 0.000 [default-poc-uniovi-avib-data-projection-backend-8080] [] - - - - e48ee5984470f7686e8aabf47b3e5877

And this log is when connect from Postman correctly:

172.23.0.1 - - [30/Oct/2023:13:35:19 +0000] "GET /poc-backend/ws HTTP/1.1" 101 4 "-" "-" 234 26.471 [default-poc-uniovi-avib-data-projection-backend-8080] [] 172.17.0.4:8080 0 26.468 101 9f7600aae958e6e940767f3159a74bff

Also logs from my Springboot backend service:


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.1.4)

2023-10-30T09:31:13.363Z  INFO 1 --- [           main] ioviAvibDataProjectionBackendApplication : Starting PocUnioviAvibDataProjectionBackendApplication v0.0.1-SNAPSHOT using Java 17-ea with PID 1 (/opt/app/app.jar started by root in /opt/app)
2023-10-30T09:31:13.366Z  INFO 1 --- [           main] ioviAvibDataProjectionBackendApplication : The following 1 profile is active: "avib"
2023-10-30T09:31:18.050Z  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Elasticsearch repositories in DEFAULT mode.
2023-10-30T09:31:18.144Z  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 82 ms. Found 0 Elasticsearch repository interfaces.
2023-10-30T09:31:18.159Z  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Reactive Elasticsearch repositories in DEFAULT mode.
2023-10-30T09:31:18.160Z  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 1 ms. Found 0 Reactive Elasticsearch repository interfaces.
2023-10-30T09:31:20.627Z  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2023-10-30T09:31:20.651Z  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-10-30T09:31:20.652Z  INFO 1 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.13]
2023-10-30T09:31:21.234Z  INFO 1 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-10-30T09:31:21.240Z  INFO 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 7606 ms
2023-10-30T09:31:26.293Z  INFO 1 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 1 endpoint(s) beneath base path '/actuator'
2023-10-30T09:31:26.497Z  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2023-10-30T09:31:26.499Z  INFO 1 --- [           main] o.s.m.s.b.SimpleBrokerMessageHandler     : Starting...
2023-10-30T09:31:26.527Z  INFO 1 --- [           main] o.s.m.s.b.SimpleBrokerMessageHandler     : BrokerAvailabilityEvent[available=true, SimpleBrokerMessageHandler [org.springframework.messaging.simp.broker.DefaultSubscriptionRegistry@62b969c4]]
2023-10-30T09:31:26.529Z  INFO 1 --- [           main] o.s.m.s.b.SimpleBrokerMessageHandler     : Started.
2023-10-30T09:31:26.588Z  INFO 1 --- [           main] ioviAvibDataProjectionBackendApplication : Started PocUnioviAvibDataProjectionBackendApplication in 14.356 seconds (process running for 15.833)
2023-10-30T09:31:28.965Z  INFO 1 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2023-10-30T09:31:28.965Z  INFO 1 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2023-10-30T09:31:28.967Z  INFO 1 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : Completed initialization in 2 ms
2023-10-30T09:32:24.752Z  INFO 1 --- [MessageBroker-1] o.s.w.s.c.WebSocketMessageBrokerStats    : WebSocketSession[0 current WS(0)-HttpStream(0)-HttpPoll(0), 0 total, 0 closed abnormally (0 connect failure, 0 send limit, 0 transport error)], stompSubProtocol[processed CONNECT(0)-CONNECTED(0)-DISCONNECT(0)], stompBrokerRelay[null], inboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0], outboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0], sockJsScheduler[pool size = 1, active threads = 1, queued tasks = 0, completed tasks = 0]
2023-10-30T10:02:24.826Z  INFO 1 --- [MessageBroker-1] o.s.w.s.c.WebSocketMessageBrokerStats    : WebSocketSession[0 current WS(0)-HttpStream(0)-HttpPoll(0), 1 total, 0 closed abnormally (0 connect failure, 0 send limit, 0 transport error)], stompSubProtocol[processed CONNECT(0)-CONNECTED(0)-DISCONNECT(0)], stompBrokerRelay[null], inboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 3], outboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 1], sockJsScheduler[pool size = 1, active threads = 1, queued tasks = 0, completed tasks = 1]
2023-10-30T10:32:24.827Z  INFO 1 --- [MessageBroker-1] o.s.w.s.c.WebSocketMessageBrokerStats    : WebSocketSession[0 current WS(0)-HttpStream(0)-HttpPoll(0), 1 total, 0 closed abnormally (0 connect failure, 0 send limit, 0 transport error)], stompSubProtocol[processed CONNECT(0)-CONNECTED(0)-DISCONNECT(0)], stompBrokerRelay[null], inboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 3], outboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 1], sockJsScheduler[pool size = 1, active threads = 1, queued tasks = 0, completed tasks = 2]
2023-10-30T11:02:24.828Z  INFO 1 --- [MessageBroker-1] o.s.w.s.c.WebSocketMessageBrokerStats    : WebSocketSession[0 current WS(0)-HttpStream(0)-HttpPoll(0), 1 total, 0 closed abnormally (0 connect failure, 0 send limit, 0 transport error)], stompSubProtocol[processed CONNECT(0)-CONNECTED(0)-DISCONNECT(0)], stompBrokerRelay[null], inboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 3], outboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 1], sockJsScheduler[pool size = 1, active threads = 1, queued tasks = 0, completed tasks = 3]
2023-10-30T11:32:24.829Z  INFO 1 --- [MessageBroker-1] o.s.w.s.c.WebSocketMessageBrokerStats    : WebSocketSession[0 current WS(0)-HttpStream(0)-HttpPoll(0), 1 total, 0 closed abnormally (0 connect failure, 0 send limit, 0 transport error)], stompSubProtocol[processed CONNECT(0)-CONNECTED(0)-DISCONNECT(0)], stompBrokerRelay[null], inboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 3], outboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 1], sockJsScheduler[pool size = 1, active threads = 1, queued tasks = 0, completed tasks = 4]
2023-10-30T12:02:24.830Z  INFO 1 --- [MessageBroker-1] o.s.w.s.c.WebSocketMessageBrokerStats    : WebSocketSession[0 current WS(0)-HttpStream(0)-HttpPoll(0), 1 total, 0 closed abnormally (0 connect failure, 0 send limit, 0 transport error)], stompSubProtocol[processed CONNECT(0)-CONNECTED(0)-DISCONNECT(0)], stompBrokerRelay[null], inboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 3], outboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 1], sockJsScheduler[pool size = 1, active threads = 1, queued tasks = 0, completed tasks = 5]
2023-10-30T12:32:24.834Z  INFO 1 --- [MessageBroker-1] o.s.w.s.c.WebSocketMessageBrokerStats    : WebSocketSession[0 current WS(0)-HttpStream(0)-HttpPoll(0), 1 total, 0 closed abnormally (0 connect failure, 0 send limit, 0 transport error)], stompSubProtocol[processed CONNECT(0)-CONNECTED(0)-DISCONNECT(0)], stompBrokerRelay[null], inboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 3], outboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 1], sockJsScheduler[pool size = 1, active threads = 1, queued tasks = 0, completed tasks = 6]
2023-10-30T13:02:24.834Z  INFO 1 --- [MessageBroker-1] o.s.w.s.c.WebSocketMessageBrokerStats    : WebSocketSession[0 current WS(0)-HttpStream(0)-HttpPoll(0), 5 total, 0 closed abnormally (0 connect failure, 0 send limit, 0 transport error)], stompSubProtocol[processed CONNECT(4)-CONNECTED(4)-DISCONNECT(0)], stompBrokerRelay[null], inboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 39], outboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 9], sockJsScheduler[pool size = 1, active threads = 1, queued tasks = 0, completed tasks = 7]

How Can I obtain more errors details (follow your sample) to know exactly what happend using the kubernetes ingress controller?.

@masalinas masalinas changed the title Sample under minikube not works Sample under ingress minikube not works Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant