Apicurio-studio: Kubernetes 上的 API 编辑丢失连接

创建于 2020-06-07  ·  29评论  ·  资料来源: Apicurio/apicurio-studio

您好,当尝试在 Kubernetes 上运行通过 Ingress 暴露 WS 时,我遇到了与 #813 中解释的问题类似的困难。

WebSocket connection to 'ws://apicurio-ws.192.168.1.5.nip.io/ws/designs/2?uuid=68064b1e-f839-4973-b65e-89660d4a07d9&user=admin&secret=eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJxRV9
COWQ4NFZS' failed: Error during WebSocket handshake: Unexpected response code: 404

我正在使用 distro/kubernetes 中的 kubernetes 清单文件。 我只是为每项服务更改主机。

最有用的评论

好消息! 我认为我们需要单独的 PR 来进行这些更改? 你觉得@t-rap 和@jsenko怎么样?

所有29条评论

我假设#813 中的信息对您没有帮助? 这看起来像同样的问题。 也许@0x218可以详细说明适用于他们安装的更改? 或者@t-rap 有什么想法? 我的 Kubernetes 专业知识非常有限。

是的,我尝试在建议的 Nginx Ingress @ 0x218 中应用版本、升级和连接标头。 然而,我无法连接到网络套接字。

我可以提供任何日志以进一步了解问题吗?

如果您可以从 -ws pod 提供“完整”浏览器控制台输出和服务器日志,那可能会有所帮助。

浏览器日志:

[ApiEditorPageComponent] Attempting to reconnect to the server.
main.a117148be57ecc117ff5.js:1 [ApisService] Getting an API Design: http://apicurio.192.168.1.5.nip.io/studio-api/designs/2
main.a117148be57ecc117ff5.js:1 [ApisService] Editing API Design: http://apicurio.192.168.1.5.nip.io/studio-api/designs/2/session
main.a117148be57ecc117ff5.js:1 [ApisService] Editing Session UUID: 0d50ffc8-1f69-41b0-b1f0-6c80a1771e00
main.a117148be57ecc117ff5.js:1 [ApisService] Content Version: 3
main.a117148be57ecc117ff5.js:1 [ApiEditorPageComponent] Definition loaded.  Opening editing session.
main.a117148be57ecc117ff5.js:1 [ApisService] Opening editing session on URL: ws://apicurio-ws.192.168.1.5.nip.io/ws/designs/2?uuid=0d50ffc8-1f69-41b0-b1f0-6c80a1771e00&user=admin&secret=eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJCNlRDTFAxdkIz
main.a117148be57ecc117ff5.js:1 WebSocket connection to 'ws://apicurio-ws.192.168.1.5.nip.io/ws/designs/2?uuid=0d50ffc8-1f69-41b0-b1f0-6c80a1771e00&user=admin&secret=eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJCNlRDTFAxdkIz' failed: Error during WebSocket handshake: Unexpected response code: 404
t.openEditingSession @ main.a117148be57ecc117ff5.js:1
(anonymous) @ main.a117148be57ecc117ff5.js:1
e.invoke @ polyfills.9c67d1be23abf75fea1a.js:1
onInvoke @ main.a117148be57ecc117ff5.js:1
e.invoke @ polyfills.9c67d1be23abf75fea1a.js:1
t.run @ polyfills.9c67d1be23abf75fea1a.js:1
(anonymous) @ polyfills.9c67d1be23abf75fea1a.js:1
e.invokeTask @ polyfills.9c67d1be23abf75fea1a.js:1
onInvokeTask @ main.a117148be57ecc117ff5.js:1
e.invokeTask @ polyfills.9c67d1be23abf75fea1a.js:1
t.runTask @ polyfills.9c67d1be23abf75fea1a.js:1
y @ polyfills.9c67d1be23abf75fea1a.js:1
t.invokeTask @ polyfills.9c67d1be23abf75fea1a.js:1
_ @ polyfills.9c67d1be23abf75fea1a.js:1
m @ polyfills.9c67d1be23abf75fea1a.js:1
main.a117148be57ecc117ff5.js:1 [ApiEditingSession] WS connection to server CLOSED: CloseEvent {isTrusted: true, wasClean: false, code: 1006, reason: "", type: "close", …}
main.a117148be57ecc117ff5.js:1 [ApiEditorPageComponent] **Notice** editing session DROPPED!  Reason code: 1006
main.a117148be57ecc117ff5.js:1 [ApiEditorPageComponent] Attempting to reconnect to the server.
main.a117148be57ecc117ff5.js:1 [ApisService] Getting an API Design: http://apicurio.192.168.1.5.nip.io/studio-api/designs/2
main.a117148be57ecc117ff5.js:1 [ApisService] Editing API Design: http://apicurio.192.168.1.5.nip.io/studio-api/designs/2/session
main.a117148be57ecc117ff5.js:1 [ApisService] Editing Session UUID: 5eecf1e6-2a83-4940-bdb0-110240374093
main.a117148be57ecc117ff5.js:1 [ApisService] Content Version: 3
main.a117148be57ecc117ff5.js:1 [ApiEditorPageComponent] Definition loaded.  Opening editing session.
main.a117148be57ecc117ff5.js:1 [ApisService] Opening editing session on URL: ws://apicurio-ws.192.168.1.5.nip.io/ws/designs/2?uuid=5eecf1e6-2a83-4940-bdb0-110240374093&user=admin&secret=eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJCNlRDTFAxdkIz
main.a117148be57ecc117ff5.js:1 WebSocket connection to 'ws://apicurio-ws.192.168.1.5.nip.io/ws/designs/2?uuid=5eecf1e6-2a83-4940-bdb0-110240374093&user=admin&secret=eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJCNlRDTFAxdkIz' failed: Error during WebSocket handshake: Unexpected response code: 404
t.openEditingSession @ main.a117148be57ecc117ff5.js:1
(anonymous) @ main.a117148be57ecc117ff5.js:1
e.invoke @ polyfills.9c67d1be23abf75fea1a.js:1
onInvoke @ main.a117148be57ecc117ff5.js:1
e.invoke @ polyfills.9c67d1be23abf75fea1a.js:1
t.run @ polyfills.9c67d1be23abf75fea1a.js:1
(anonymous) @ polyfills.9c67d1be23abf75fea1a.js:1
e.invokeTask @ polyfills.9c67d1be23abf75fea1a.js:1
onInvokeTask @ main.a117148be57ecc117ff5.js:1
e.invokeTask @ polyfills.9c67d1be23abf75fea1a.js:1
t.runTask @ polyfills.9c67d1be23abf75fea1a.js:1
y @ polyfills.9c67d1be23abf75fea1a.js:1
t.invokeTask @ polyfills.9c67d1be23abf75fea1a.js:1
_ @ polyfills.9c67d1be23abf75fea1a.js:1
m @ polyfills.9c67d1be23abf75fea1a.js:1
main.a117148be57ecc117ff5.js:1 [ApiEditingSession] WS connection to server CLOSED: CloseEvent {isTrusted: true, wasClean: false, code: 1006, reason: "", type: "close", …}
main.a117148be57ecc117ff5.js:1 [ApiEditorPageComponent] **Notice** editing session DROPPED!  Reason code: 1006

ws pod 完整日志:

06-10 14:46:08,780 DEBUG [io.undertow.request.security] (default task-1) Authentication result was ATTEMPTED for /ws/designs/2
2020-06-10 14:46:08,781 DEBUG [io.undertow.request] (default task-1) Matched default handler path /ws/designs/2
2020-06-10 14:46:11,291 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) PeriodicRecovery: background thread Status <== SCANNING
2020-06-10 14:46:11,291 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) PeriodicRecovery: background thread scanning
2020-06-10 14:46:11,291 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Periodic recovery first pass at Wed, 10 Jun 2020 14:46:11
2020-06-10 14:46:11,291 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) processing /StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction transactions
2020-06-10 14:46:11,291 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Recovery module 'com.arjuna.ats.internal.jta.recovery.arjunacore.CommitMarkableResourceRecordRecoveryModule<strong i="6">@7e04aa62</strong>' first pass processed
2020-06-10 14:46:11,291 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) AtomicActionRecoveryModule first pass
2020-06-10 14:46:11,291 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) processing /StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction transactions
2020-06-10 14:46:11,291 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Recovery module 'com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule<strong i="7">@3b062bc6</strong>' first pass processed
2020-06-10 14:46:11,291 DEBUG [com.arjuna.ats.txoj] (Periodic Recovery) TORecoveryModule - first pass
2020-06-10 14:46:11,291 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Recovery module 'com.arjuna.ats.internal.txoj.recovery.TORecoveryModule<strong i="8">@29e089e5</strong>' first pass processed
2020-06-10 14:46:11,291 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Recovery module 'com.arjuna.ats.internal.jta.recovery.arjunacore.SubordinateAtomicActionRecoveryModule<strong i="9">@5f676b11</strong>' first pass processed
2020-06-10 14:46:11,291 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) XARecoveryModule state change IDLE->FIRST_PASS

2020-06-10 14:46:11,291 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) Local XARecoveryModule - first pass
2020-06-10 14:46:11,291 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) XARecoveryModule state change FIRST_PASS->BETWEEN_PASSES

2020-06-10 14:46:11,291 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Recovery module 'com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule<strong i="10">@5ad9faef</strong>' first pass processed
2020-06-10 14:46:20,674 DEBUG [io.undertow.request] (default I/O-2) Matched default handler path /ws/designs/2
2020-06-10 14:46:20,675 DEBUG [io.undertow.request.security] (default task-1) Attempting to authenticate /ws/designs/2, authentication required: false
2020-06-10 14:46:20,675 DEBUG [io.undertow.request.security] (default task-1) Authentication outcome was NOT_ATTEMPTED with method io.undertow.security.impl.CachedAuthenticatedSessionMechanism<strong i="11">@59a16760</strong> for /ws/designs/2
2020-06-10 14:46:20,675 DEBUG [io.undertow.request.security] (default task-1) Authentication result was ATTEMPTED for /ws/designs/2
2020-06-10 14:46:20,675 DEBUG [io.undertow.request] (default task-1) Matched default handler path /ws/designs/2
2020-06-10 14:46:21,291 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Periodic recovery second pass at Wed, 10 Jun 2020 14:46:21
2020-06-10 14:46:21,291 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Recovery module 'com.arjuna.ats.internal.jta.recovery.arjunacore.CommitMarkableResourceRecordRecoveryModule<strong i="12">@7e04aa62</strong>' second pass processed
2020-06-10 14:46:21,291 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) AtomicActionRecoveryModule second pass
2020-06-10 14:46:21,291 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Recovery module 'com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule<strong i="13">@3b062bc6</strong>' second pass processed
2020-06-10 14:46:21,291 DEBUG [com.arjuna.ats.txoj] (Periodic Recovery) TORecoveryModule - second pass
2020-06-10 14:46:21,291 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Recovery module 'com.arjuna.ats.internal.txoj.recovery.TORecoveryModule<strong i="14">@29e089e5</strong>' second pass processed
2020-06-10 14:46:21,292 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Recovery module 'com.arjuna.ats.internal.jta.recovery.arjunacore.SubordinateAtomicActionRecoveryModule<strong i="15">@5f676b11</strong>' second pass processed
2020-06-10 14:46:21,292 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) XARecoveryModule state change BETWEEN_PASSES->SECOND_PASS

2020-06-10 14:46:21,292 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) Local XARecoveryModule - second pass
2020-06-10 14:46:21,292 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) Local XARecoveryModule.transactionInitiatedRecovery completed
2020-06-10 14:46:21,292 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) Local XARecoveryModule.resourceInitiatedRecovery completed
2020-06-10 14:46:21,292 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) XARecoveryModule state change SECOND_PASS->IDLE

2020-06-10 14:46:21,292 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Recovery module 'com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule<strong i="16">@5ad9faef</strong>' second pass processed
2020-06-10 14:46:21,292 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) PeriodicRecovery: background thread Status <== INACTIVE
2020-06-10 14:46:21,292 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) PeriodicRecovery: background thread backing off

伙计,我不知道可能出了什么问题。 我要请您确保 -ws 和 -api pod 连接到同一个数据库。 如果不是,您会收到连接错误,但在这种情况下,-ws pod 日志会显示错误,并且您不会收到 404 我不认为。

看来这一定是某种 Ingress 问题,我对 k8s 的了解还不够,无法提供帮助! :(

我还尝试通过 NodePort 直接公开 ws pod。 然而我仍然没有成功。

我要再试一次。 增加日志级别有帮助吗?

它不会受伤。 -ws 日志中有一些关于身份验证的内容我不太了解,因为 -ws 组件没有启用任何身份验证。 也许增加日志级别会更清楚地说明这一点。

您认为我应该将日志级别提高到什么级别?

可能从 DEBUG 开始,看看会发生什么。 :)

我增加了日志级别以进行调试。 然而,没有有益的日志。

ws

cloak.adapters.OAuthRequestAuthenticator] (default task-2) there was no code
2020-06-13 22:20:10,628 DEBUG [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-2) redirecting to auth server
2020-06-13 22:20:10,628 DEBUG [org.keycloak.adapters.undertow.ServletSessionTokenStore] (default task-3) session was null, returning null
2020-06-13 22:20:10,628 DEBUG [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-3) there was no code
2020-06-13 22:20:10,628 DEBUG [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-3) redirecting to auth server
2020-06-13 22:20:10,628 DEBUG [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-2) callback uri: http://apicurio-studio-ui.192.168.1.5.nip.io/version.js
2020-06-13 22:20:10,628 DEBUG [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-3) callback uri: http://apicurio-studio-ui.192.168.1.5.nip.io/config.js
2020-06-13 22:20:10,628 DEBUG [io.undertow.request.security] (default task-2) Authentication outcome was NOT_ATTEMPTED with method org.keycloak.adapters.wildfly.WildflyAuthenticationMechanism<strong i="7">@26c8577b</strong> for /version.js
2020-06-13 22:20:10,628 DEBUG [io.undertow.request.security] (default task-2) Authentication result was ATTEMPTED for /version.js
2020-06-13 22:20:10,628 DEBUG [io.undertow.request.security] (default task-3) Authentication outcome was NOT_ATTEMPTED with method org.keycloak.adapters.wildfly.WildflyAuthenticationMechanism<strong i="8">@26c8577b</strong> for /config.js
2020-06-13 22:20:10,628 DEBUG [io.undertow.request.security] (default task-3) Sending authentication challenge for HttpServerExchange{ GET /config.js}
2020-06-13 22:20:10,628 DEBUG [io.undertow.request] (default task-2) Matched default handler path /version.js
2020-06-13 22:20:10,628 DEBUG [org.keycloak.adapters.AuthenticatedActionsHandler] (default task-2) AuthenticatedActionsValve.invoke http://apicurio-studio-ui.192.168.1.5.nip.io/version.js
2020-06-13 22:20:10,629 DEBUG [org.keycloak.adapters.AuthenticatedActionsHandler] (default task-2) Policy enforcement is disabled.
2020-06-13 22:20:10,629 DEBUG [io.undertow.session] (default task-3) Created session with id oIOfXf1RPvC2PBpI4dTuVZKYk7f8BDg0XUAFHWrC for exchange HttpServerExchange{ GET /config.js}
2020-06-13 22:20:10,629 DEBUG [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-3) Sending redirect to login page: http://keycloak-microcks.192.168.1.5.nip.io/auth/realms/Apicurio/protocol/openid-connect/auth?response_type=code&client_id=apicurio-studio&redirect_uri=http%3A%2F%2Fapicurio-studio-ui.192.168.1.5.nip.io%2Fconfig.js&state=3e4e092e-bc54-4802-a517-d3462de6f343&login=true&scope=openid
2020-06-13 22:20:10,629 DEBUG [io.undertow.request.security] (default task-3) Authentication result was CHALLENGE_SENT for /config.js
2020-06-13 22:21:00,918 DEBUG [io.undertow.request] (default I/O-2) Timing out idle connection from /10.1.94.1:41180
2020-06-13 22:21:00,918 DEBUG [io.undertow.request] (default I/O-2) Timing out idle connection from /10.1.94.1:41178
2020-06-13 22:21:48,749 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) PeriodicRecovery: background thread Status <== SCANNING
2020-06-13 22:21:48,749 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) PeriodicRecovery: background thread scanning
2020-06-13 22:21:48,749 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Periodic recovery first pass at Sat, 13 Jun 2020 22:21:48
2020-06-13 22:21:48,750 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) processing /StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction transactions
2020-06-13 22:21:48,750 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Recovery module 'com.arjuna.ats.internal.jta.recovery.arjunacore.CommitMarkableResourceRecordRecoveryModule<strong i="9">@3bc2db45</strong>' first pass processed
2020-06-13 22:21:48,750 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) AtomicActionRecoveryModule first pass
2020-06-13 22:21:48,750 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) processing /StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction transactions
2020-06-13 22:21:48,750 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Recovery module 'com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule<strong i="10">@7ec04259</strong>' first pass processed
2020-06-13 22:21:48,750 DEBUG [com.arjuna.ats.txoj] (Periodic Recovery) TORecoveryModule - first pass
2020-06-13 22:21:48,750 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Recovery module 'com.arjuna.ats.internal.txoj.recovery.TORecoveryModule<strong i="11">@1a9ffeac</strong>' first pass processed
2020-06-13 22:21:48,751 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Recovery module 'com.arjuna.ats.internal.jta.recovery.arjunacore.SubordinateAtomicActionRecoveryModule<strong i="12">@1aa1c748</strong>' first pass processed
2020-06-13 22:21:48,751 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) XARecoveryModule state change IDLE->FIRST_PASS

2020-06-13 22:21:48,751 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) Local XARecoveryModule - first pass
2020-06-13 22:21:48,751 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) XARecoveryModule state change FIRST_PASS->BETWEEN_PASSES

2020-06-13 22:21:48,751 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Recovery module 'com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule<strong i="13">@5b07f3c7</strong>' first pass processed

然而,我注意到一个浏览器日志可以解释这个问题。

main.a117148….js:1 [ApiEditingSession] WS connection to server CLOSED: 
CloseEvent {isTrusted: true, wasClean: false, code: 1006, reason: "", type: "close", …}
bubbles: false
cancelBubble: false
cancelable: false
code: 1006
composed: false
currentTarget: WebSocket {__zone_symbol__openfalse: Array(1), __zone_symbol__messagefalse: Array(1), __zone_symbol__ON_PROPERTYopen: ƒ, __zone_symbol__ON_PROPERTYmessage: ƒ, __zone_symbol__ON_PROPERTYclose: ƒ, …}
defaultPrevented: false
eventPhase: 0
isTrusted: true
path: []
reason: ""
returnValue: true
srcElement: WebSocket {__zone_symbol__openfalse: Array(1), __zone_symbol__messagefalse: Array(1), __zone_symbol__ON_PROPERTYopen: ƒ, __zone_symbol__ON_PROPERTYmessage: ƒ, __zone_symbol__ON_PROPERTYclose: ƒ, …}
target: WebSocket {__zone_symbol__openfalse: Array(1), __zone_symbol__messagefalse: Array(1), __zone_symbol__ON_PROPERTYopen: ƒ, __zone_symbol__ON_PROPERTYmessage: ƒ, __zone_symbol__ON_PROPERTYclose: ƒ, …}
timeStamp: 1177278.1400000094
type: "close"
wasClean: false
__proto__: CloseEvent

网络套接字季节正在关闭,错误代码为 1006

您包含的服务器日志实际上是-ui pod 的日志,而不是-ws pod 的日志。

错误码1006表示浏览器异常关闭了web socket。 :( 遗憾的是,浏览器很可能不会给你一个理由。这里有一些信息:

https://stackoverflow.com/questions/19304157/getting-the-reason-why-websockets-closed-with-close-code-1006

您也许可以尝试找到某种 websocket 测试工具并尝试使用它。 它可能会为您提供一些我们可以使用的诊断信息。

使用以下命令检索的日志

kubectl logs apicurio-studio-ws-7c458cf8d8-cgscc

是否有我可以搜索的特定日志?

您对测试 Web 套接字有什么建议吗?

我找到了一种通过https://websocket.org/echo.html测试网络套接字的方法。

我将 ws 连接代码复制到我的计算机上。 我应该发送什么信息?

这真的很奇怪,因为您在上面发布的输出清楚地显示了 keycloak auth redirect 和其他与 keycloak 相关的输出,以及对config.jsversion.js的请求——这些都是 UI 所做的事情。 websocket 组件根本不包含 Keycloak。 您能否从所有三个pod 中获取日志输出? 那会很有趣。 也许实际上是吊舱有问题!

至于测试网络套接字。 只需尝试连接,看看会发生什么。 如果它工作正常,你应该得到这样的东西:

image

如果您的连接在“连接”阶段被破坏,那么初始连接可能会失败。

我通过复制 websocket.org 上提供的代码来测试 websocket,并将其作为 websocket.html 保存在我的硬盘上,以测试我本地网络上的 ws pod。 不幸的是,我无法连接到本地网络中的 ws。 但是,我能够连接公共 websocket
wss://studio-ws.apicur.io/designs 。 因此,我认为 websocket 测试是可行的。

我提供了附件中的所有日志

kubectl 记录 apicurio-studio-ui-5c6f5df485-lcdxp > apicurio-studio-ui.log
kubectl 记录 apicurio-studio-ws-77dc7f7b87-57dcs > apicurio-studio-ws.log
kubectl 记录 apicurio-studio-api-79d9d799cb-mgsmx > apicurio-studio-api.log

apicurio-studio-api.log
apicurio-studio-ui.log
apicurio-studio-ws.log

我终于让它工作了! 我直接通过 NodePort 暴露了ws pod。 我现在确定问题出在入口配置上。

惊人的!! 感谢您推动这一点(不放弃)。 很抱歉,我无法提供更多帮助。 我的kubernetes知识水平低。 您可以发布您需要添加的任何 YAML 配置以使其正常工作吗? 我们最终将为 Apicurio Studio 创建一个运算符,但我不知道具体何时会发生。

老实说,我没有进行特定的 yaml 配置。

我创建了一个 NodePort 服务,这意味着 ws pods 8080 端口在随机端口上的机器 IP 上公开。

这就是我创建 NodePort 的方式
kubectl expose deployment apicurio-studio-ws --type NodePort --name test

这给了我一个随机端口 32204,可以通过机器 IP:32204 访问。

kubectl 获取 svc

NAME                           TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
test                           NodePort    10.152.183.2     <none>        8080:32204/TCP   10h

我仍然认为入口 nginx 应该是暴露 websocket 的首选方式,因为 NodePort 端口是随机的,不能在apicurio-configmap.yaml中预先配置。

在我的情况下是

apicurio-configmap.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: apicurio-configmap
data:
  apicurio-db-connection-url: jdbc:mysql://apicuriodb:3306/apicuriodb
  apicurio-kc-client-id: apicurio-studio
  apicurio-kc-realm: Apicurio
  apicurio-microcks-api-url: http://microcks-microcks.192.168.1.5.nip.io/api
  apicurio-microcks-client-id: microcks-serviceaccount
  apicurio-ui-editing-url: ws://192.168.1.5:32204/
  apicurio-ui-feature-microcks: "true"
  apicurio-ui-feature-share-with-everyone: "true"
  apicurio-ui-hub-api-url: http://apicurio.192.168.1.5.nip.io/studio-api
  apicurio-ui-logout-redirect-uri: /
  keycloak-url: http://keycloak-microcks.192.168.1.5.nip.io/auth

好的很有趣。 不知道为什么 nginx 方法不适合你。 :(但很高兴你有一些工作!

我找到了一种通过入口暴露 ws pod 的方法。 此解决方案更具可配置性。

Screen Shot 2020-06-19 at 1 40 21 AM

在这个解决方案中,我通过入口为 WS pod 创建了一个单独的 URL。

我会提供一个 PR 进行评估。

嘿,很抱歉迟到了。

@cemnura您使用的是什么入口,在哪个版本中?

nginx-ingress-controller 已经有很多修复和更改,如果你使用它的话。

奇怪的一件事是 websocket 行为,尤其是当您尝试在 http/https 之间切换时。

@EricWittmann如果您愿意,我可以测试补丁版本是否有效(nginx-ingress-version 更新到最新版本)

您可以提供的任何帮助将不胜感激,@t-rap

你好@t-rap 我正在运行一个 microk8s Kubernetes,据我所知,它使用nginx-ingress-controller-amd64

Name:         nginx-ingress-microk8s-controller-nd8vb
Namespace:    ingress
Priority:     0
Node:         mccloud/192.168.1.5
Start Time:   Tue, 02 Jun 2020 23:12:28 +0300
Labels:       controller-revision-hash=59cb5dd586
              name=nginx-ingress-microk8s
              pod-template-generation=1
Annotations:  <none>
Status:       Running
IP:           192.168.1.5
IPs:
  IP:           192.168.1.5
Controlled By:  DaemonSet/nginx-ingress-microk8s-controller
Containers:
  nginx-ingress-microk8s:
    Container ID:  containerd://3219d168e8fbb190acd214ab651f781f6adf51adcc2302891636a5ff250ef15f
    Image:         quay.io/kubernetes-ingress-controller/nginx-ingress-controller-amd64:0.25.1
    Image ID:      sha256:2b8ed1f2046d4b37c18cca2ecc4f435b6618d2d198c0c8bf617954e863cc5832
    Ports:         80/TCP, 443/TCP
    Host Ports:    80/TCP, 443/TCP
    Args:
      /nginx-ingress-controller
      --configmap=$(POD_NAMESPACE)/nginx-load-balancer-microk8s-conf
      --publish-status-address=127.0.0.1
    State:          Running
      Started:      Fri, 12 Jun 2020 15:08:07 +0300
    Last State:     Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Wed, 10 Jun 2020 23:37:02 +0300
      Finished:     Fri, 12 Jun 2020 15:08:03 +0300
    Ready:          True
    Restart Count:  187
    Liveness:       http-get http://:10254/healthz delay=30s timeout=5s period=10s #success=1 #failure=3
    Environment:
      POD_NAME:       nginx-ingress-microk8s-controller-nd8vb (v1:metadata.name)
      POD_NAMESPACE:  ingress (v1:metadata.namespace)
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from nginx-ingress-microk8s-serviceaccount-token-r6md6 (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  nginx-ingress-microk8s-serviceaccount-token-r6md6:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  nginx-ingress-microk8s-serviceaccount-token-r6md6
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/disk-pressure:NoSchedule
                 node.kubernetes.io/memory-pressure:NoSchedule
                 node.kubernetes.io/network-unavailable:NoSchedule
                 node.kubernetes.io/not-ready:NoExecute
                 node.kubernetes.io/pid-pressure:NoSchedule
                 node.kubernetes.io/unreachable:NoExecute
                 node.kubernetes.io/unschedulable:NoSchedule
Events:          <none>

非常感谢@cemnura
你能测试一下我做的叉子(见下文)吗? 提前(再次)感谢:)

我使用 ingress-nginx-controller 版本 0.24.1 和 apicurio-studio 0.2.44.Final 在https://github.com/t-rap/apicurio-studio-981/上测试了配置
我将子路径“/designs”添加到入口 apicurio-studio-ws,因为这是一个需要由 ws 处理的子路径。

我将在 ingress-controller 0.25.1 和 apicurio-studio 0.2.46 上运行一些测试。Final 可能在周末。
由于入口控制器由 kubernetes 维护,因此需要识别大量更改。

我还删除了配置片段,因为它不再需要了(我的错,duh)

完成后我会提供更新。

我会试一试@t-rap 👍

我能够使用提供的 Kubernetes 清单 @t-rap 在与ui pod 相同的 url 上公开ws pod。

但是,有一些小的变化。

我将 ws pod 入口名称更改为apicurio-studio-ws

https://github.com/Apicurio/apicurio-studio/blob/17a8e6bc21cae5a90aebb1a7a0e64350aeb30f57/distro/kubernetes/apicurio-studio-ingresses.yaml#L38 -L41

删除了 $ apicurio-configmap.yamlapicurio-ui-editing-url键的/ws后缀

https://github.com/Apicurio/apicurio-studio/blob/17a8e6bc21cae5a90aebb1a7a0e64350aeb30f57/distro/kubernetes/apicurio-configmap.yaml#L9

删除了 apicurio-studio-ingresses.yaml 中 ingress 配置中的apicurio-studio-ingresses.yaml /ws路径

这是我的配置

apicurio-configmap.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: apicurio-configmap
data:
  apicurio-db-connection-url: jdbc:mysql://apicuriodb:3306/apicuriodb
  apicurio-kc-client-id: apicurio-studio
  apicurio-kc-realm: Apicurio
  apicurio-microcks-api-url: http://microcks-microcks.192.168.1.5.nip.io/api
  apicurio-microcks-client-id: microcks-serviceaccount
  apicurio-ui-editing-url: ws://apicurio.192.168.1.5.nip.io
  apicurio-ui-feature-microcks: "true"
  apicurio-ui-feature-share-with-everyone: "true"
  apicurio-ui-hub-api-url: http://apicurio.192.168.1.5.nip.io/studio-api
  apicurio-ui-logout-redirect-uri: /
  keycloak-url: http://keycloak-microcks.192.168.1.5.nip.io/auth

apicurio-studio-ingresses.yaml

kind: Ingress
apiVersion: extensions/v1beta1
metadata:
  name: apicurio-studio-api
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
  labels:
    module: apicurio-studio-api
spec:
  rules:
  - host: apicurio.192.168.1.5.nip.io
    http:
      paths:
      - backend:
          serviceName: "apicurio-studio-api"
          servicePort: 8091
        path: /studio-api/?(.*)
---
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
  name: apicurio-studio-ui
  labels:
    module: apicurio-studio-ui
spec:
  rules:
    - host: apicurio.192.168.1.5.nip.io
      http:
        paths:
          - backend:
              serviceName: "apicurio-studio-ui"
              servicePort: 8093
            path: /
---
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
  name: apicurio-studio-ws
  annotations:
  labels:
    module: apicurio-studio-ws
spec:
  rules:
    - host: apicurio.192.168.1.5.nip.io
      http:
        paths:
          - backend:
              serviceName: "apicurio-studio-ws"
              servicePort: 8092
            path: /designs

好消息! 我认为我们需要单独的 PR 来进行这些更改? 你觉得@t-rap 和@jsenko怎么样?

此页面是否有帮助?
0 / 5 - 0 等级