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

k8s/docker容器/虚拟机连接方案 #54

Open
Liubsyy opened this issue Nov 23, 2023 · 1 comment
Open

k8s/docker容器/虚拟机连接方案 #54

Liubsyy opened this issue Nov 23, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@Liubsyy
Copy link
Owner

Liubsyy commented Nov 23, 2023

k8s/docker容器/虚拟机连接方案

这个方案适用于 本地和容器ip不能直接连通,但是可以和宿主机暴露的端口连通

本地---->宿主机器:端口1---->容器:端口2,这样一个通信流程

需要满足两个条件

  • 首先需要保证端口1和端口2相同,比如宿主机端口2023映射到容器端口2023
  • 本地和宿主机端口是能正常连通

然后容器添加jvm参数-Djava.rmi.server.hostname=宿主机器,最后本地插件连接宿主机的机器+端口1即可。
这样当有多组容器服务器的时候,相当于是通过不同的端口来区分不同的内网服务器。


这个方案的缺点是每个容器ip都需要宿主机暴露一个端口,如果容器比较多的时候还是很费劲的,还有一种方案就是用代理服务器的方式 : 代理服务器连接

@Liubsyy Liubsyy pinned this issue Nov 23, 2023
@Liubsyy Liubsyy closed this as completed Nov 23, 2023
@Liubsyy Liubsyy added the enhancement New feature or request label Jan 9, 2024
@Liubsyy Liubsyy reopened this Feb 26, 2024
@wangmingwang123
Copy link

我想问下这个代理服务器连接是不是需要保证代理服务器和目标服务器在同一个内网中

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants