gpt4 book ai didi

kubernetes - minikube ip 无法访问

转载 作者:行者123 更新时间:2023-12-02 12:01:44 28 4
gpt4 key购买 nike

我创建了一项名为 的服务舰队人-webapp :

apiVersion: v1
kind: Service
metadata:
name: fleetman-webapp

spec:
selector:
app: webapp

ports:
- name: http
port: 80
nodePort: 30080

type: NodePort

还有一个名为 的 pod网络应用 :
apiVersion: v1
kind: Pod
metadata:
name: webapp
labels:
app: webapp
spec:
containers:
- name: webapp
image: richardchesterwood/k8s-fleetman-webapp-angular:release0

我检查了 minikube ip :

192.168.99.102

但是当我在浏览器中输入 192.168.99.102:30080 ,webapp 无法访问: enter image description here

请注意,我使用的是 Ubuntu 最新版本。我进一步验证了代理和防火墙是否处于事件状态:

猫/etc/环境 :
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"

iptables -L :
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy DROP)
target prot opt source destination
DOCKER-USER all -- anywhere anywhere
DOCKER-ISOLATION-STAGE-1 all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain DOCKER (1 references)
target prot opt source destination

Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target prot opt source destination
DOCKER-ISOLATION-STAGE-2 all -- anywhere anywhere
RETURN all -- anywhere anywhere

Chain DOCKER-ISOLATION-STAGE-2 (1 references)
target prot opt source destination
DROP all -- anywhere anywhere
RETURN all -- anywhere anywhere

Chain DOCKER-USER (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere

我也禁用了 ufw 在 Ubuntu 中,但没有成功,URL 192.168.99.102:30080 .

你能帮帮我吗?提前感谢您的回答。

最佳答案

即使您在 minikube 中通过 NodePort 公开端口 30080,minikube 仍然不会公开它,因为它将使用自己的外部端口来监听此服务。 Minikube 通过隧道将服务暴露给外部世界。要找出暴露的端口:

minikube service $SERVICE_NAME
所以,在你的情况下
minikube service fleetman-webapp

关于kubernetes - minikube ip 无法访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60710171/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com