Kubernetes Official Tutorial: The web page at http://localhost:6000/ might be temporarily down or it may have moved permanently to a new web address

Viewed 624

I am trying to do this tutorial https://kubernetes.io/blog/2019/07/23/get-started-with-kubernetes-using-python/ on my local machine

I have accomplished all of the steps:

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) ✗

But when I go to localhost:6000 I get an error:

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

When I do lsof -i tcp:6000 I get this:


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

Is this a bug in the tutorial, or am I doing something wrong?

1 Answers

Docker Desktop

I checked if it works and I have the same issue.

EDIT

As @Boris the Spider mentioned in comments

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.

If you don't want to change chrome settings you change the port of the service. For example from 6000 to 8000.

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

if you change it to 8000 then use localhost:8000 instead and it works.

enter image description here


Minikube

Minikube doesn't supports LB external 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.

So if you use minikube try with minikube service instead.

There is related documentation with an example.

Related