kubernetes - Access web server inside a pod in a vm from outside the VM
问题描述
I have a kubernetes cluster running on a vagrant VM. I am running a webserver listening on port 8181 on a pod inside the cluster. I activated pod port forwarding through kubectl port-forward 8180:8181 so that i can access the web-server from inside the vm. Now i'm trying to access the pod from outside the vagrant vm, that is the host machine. In the vagratfile i put config.vm.network "private_network", ip: "192.168.56.17", :adapter => 2
so taht i can access the vm through is IP(192.168.56.17). The problem is that if i try to do a curl to the webserver from the host machine i get this error: Connecting to 192.168.56.17:8180... failed: Connection refused.
I tried to run the web-server directely on the guest machine and not in the k8s pod, and i'm able to reach the web-server from the host machine, so i think it is not a problem of vagrant configuration. I tried also to activate port forwarding in Vagrant through: config.vm.network :forwarded_port, guest: 8181, host: 8181, :adapter => 2 but the problem is still here.
Thank you every one for helping me.
解决方案
推荐阅读
- python - Pandas:查找数据框中每一列的最大最小行数
- powerbi - 对一列求和的快速度量,按另一列分组,如果选择过滤器则不会更改 (DAX)
- java - 如何在 Spring Boot 应用程序中将 int Mongodb 类型转换为布尔值
- python - 如何将新字段添加到 drf 查询输出中?
- html - 滚动时div越过标题栏
- javascript - 在一个下拉列表中选择选项禁用另一个选项?
- c# - c# winforms多行文本框到mailto:body
- javascript - 如何获取 WordPress 网站标志
- c++ - 使用 -v 查看调用在 Xcode 中似乎不起作用
- json - 过滤 For Each 循环 - swiftui