gpt4 book ai didi

python - Kubernetes 官方教程 : The web page at http://localhost:6000/might be temporarily down or it may have moved permanently to a new web address

转载 作者:行者123 更新时间:2023-12-04 03:48:13 25 4
gpt4 key购买 nike

我正在尝试完成本教程 https://kubernetes.io/blog/2019/07/23/get-started-with-kubernetes-using-python/在我的本地机器上

我已经完成了所有步骤:

app git:(master) ✗  kubectl get pods

NAME READY STATUS RESTARTS AGE
hello-python-6c7b478cf5-49vdg 1/1 Running 0 2m53s
hello-python-6c7b478cf5-d4tfl 1/1 Running 0 2m53s
hello-python-6c7b478cf5-ltb8r 1/1 Running 0 2m53s
hello-python-6c7b478cf5-qsqvt 1/1 Running 0 2m53s
app git:(master) ✗

但是当我转到 localhost:6000 时,我得到一个错误:

This site can’t be reached. The web page at http://localhost:6000/ might be temporarily down or it may have moved permanently to a new web address.ERR_UNSAFE_PORT

当我执行 lsof -i tcp:6000 时,我得到了这个:


COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
com.docke 98546 <me> 76u IPv6 0xc52e947a7a450f69 0t0 TCP *:6000 (LISTEN)

这是教程中的错误,还是我做错了什么?

最佳答案

Docker 桌面

我检查了它是否有效,我遇到了同样的问题。

编辑

正如@Boris the Spider 在评论中提到的

Port 6000 is blocked by chrome for safety - it’s the X11 port and I think Chrome is trying to prevent certain kinds of XSS attacks. You can disable this protection by passing flags to chrome.

如果您不想更改 Chrome 设置,您可以更改服务的端口。例如从 6000 到 8000。

apiVersion: v1
kind: Service
metadata:
name: hello-python-service
spec:
selector:
app: hello-python
ports:
- protocol: "TCP"
port: 8000 <---
targetPort: 5000
type: LoadBalancer

如果将其更改为 8000,则改用 localhost:8000 即可。

enter image description here


迷你库

Minikube 不支持 LB 外部 IP。

On cloud providers that support load balancers, an external IP address would be provisioned to access the Service. On minikube, the LoadBalancer type makes the Service accessible through the minikube service command.

因此,如果您使用 minikube,请尝试使用 minikube 服务

有相关documentation举个例子。

关于python - Kubernetes 官方教程 : The web page at http://localhost:6000/might be temporarily down or it may have moved permanently to a new web address,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64810921/

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