如何从 minikube 公开服务以便能够从同一网络中的其他设备访问它?

How to expose a service from minikube to be able to access it from another device in the same network?

我在本地机器上的 minikube (expressjs API) 运行 中创建了一个服务, 所以当我使用 minikube service wedeliverapi --url 启动服务时,我可以使用 localhost:port/api

从我的浏览器访问它

但我也想从另一台设备访问该服务,这样我就可以在 flutter 移动应用程序中使用我的 API。我怎样才能实现这个目标?

由于信息量少,为了澄清一切,我发布了一个通用的社区维基答案。

解决这个问题的方法是使用反向代理服务器。在 this documentation 中定义了 反向代理服务器 .

到底是什么

A proxy server is a go‑between or intermediary server that forwards requests for content from multiple clients to different servers across the Internet. A reverse proxy server is a type of proxy server that typically sits behind the firewall in a private network and directs client requests to the appropriate backend server. A reverse proxy provides an additional level of abstraction and control to ensure the smooth flow of network traffic between clients and servers

reverse proxy server 的常见用途包括:

  • 负载均衡
  • 网页加速
  • 安全和匿名

This 是可以找到代理服务器基本配置的指南。

另见 this article