cube-studio icon indicating copy to clipboard operation
cube-studio copied to clipboard

网络模式为IPVS时创建NOTEBOOK触发SVC创建失败

Open BorisPolonsky opened this issue 1 year ago • 4 comments

当网络模式为IPVS时创建NOTEBOOK时,按照下述配置创建类型为NodePort的Service https://github.com/data-infra/cube-studio/blob/5f1788def51e37b86bf5efbb91f92d3ef894a3a5/myapp/views/view_notebook.py#L495 其中NodePort参数填写逻辑如下 https://github.com/data-infra/cube-studio/blob/5f1d6a85243253b4b89a7053927be39283436b86/myapp/utils/py/py_k8s.py#L1459-L1462 该逻辑不保证NodePort符合30000端口限制,导致用户创建Notebook(e.g. VSCODE(gpu))时平台SVC创建失败并在前端显示报错

BorisPolonsky avatar Dec 24 '24 08:12 BorisPolonsky

meet_ports = core.get_not_black_port(10000 + 10 * notebook.id)

notebook的端口范围是10000以上

data-infra avatar Dec 27 '24 08:12 data-infra

meet_ports = core.get_not_black_port(10000 + 10 * notebook.id)

notebook的端口范围是10000以上

https://github.com/data-infra/cube-studio/blob/3a7c6fc38e387fd8948708254ae7f18a21051adf/myapp/views/view_notebook.py#L775-L776

如果在创建-external的Service时NodePort和ExternalIP是互斥的(i.e. conf.get('K8S_NETWORK_MODE','iptables')!='ipvs'),是否可以针对NodePort分支更新端口匹配逻辑保证符合NodePort分支的端口范围30000-32767的约束

BorisPolonsky avatar Nov 18 '25 03:11 BorisPolonsky

notebook web界面,不需要这个端口,端口是为了给ssh 登录使用,端口不开放,可以使用跳板机登录容器的端口。这样就不使用-external的Service

data-infra avatar Nov 18 '25 04:11 data-infra

notebook web界面,不需要这个端口,端口是为了给ssh 登录使用,端口不开放,可以使用跳板机登录容器的端口。这样就不使用-external的Service

目前-external Service的创建触发条件未考虑web界面使用,不依赖ssh的场景: https://github.com/data-infra/cube-studio/blob/3a7c6fc38e387fd8948708254ae7f18a21051adf/myapp/views/view_notebook.py#L757 当用户以域名的形式从集群外通过访问平台并创建notebook时,会同时满足上述SERVICE_EXTERNAL_IPmeet_ports[0]<20000的判定条件并创建-external的服务,不需要用户配置SSH访问。在IPVS的集群上,该行为会因为nodePort不符合端口范围限制触发Service创建失败需要用户重启Notebook的系统提示。

BorisPolonsky avatar Nov 18 '25 07:11 BorisPolonsky