Cannot reach exposed external ip on google cloud

2/25/2018

I followed the kubernetes-engine tutorial, used local gloud in terminal. Looks everything is working, but I can't reach exposed external-ip http://104.197.4.162/ in my browser, as the tutorial said. Thank you!

$ kubectl get service

NAME         TYPE           CLUSTER-IP      EXTERNAL-IP     PORT(S)        AGE
hello-web    LoadBalancer   10.11.245.151   104.197.4.162   80:30135/TCP   1m

$ kubectl get pods

NAME                         READY     STATUS    RESTARTS   AGE
hello-web-7d4f9779bf-lw9st   1/1       Running   0          1m

$ kubectl describe svc hello-web

Name:                     hello-web
Namespace:                default
Labels:                   run=hello-web
Annotations:              <none>
Selector:                 run=hello-web
Type:                     LoadBalancer
IP:                       10.11.245.151
LoadBalancer Ingress:     104.197.4.162
Port:                     <unset>  80/TCP
TargetPort:               8080/TCP
NodePort:                 <unset>  30135/TCP
Endpoints:                10.8.0.6:8080
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>

$ curl 104.197.4.162:80

curl: (7) Failed to connect to 104.197.4.162 port 80: Connection refused

https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app

-- Denly
google-cloud-platform
google-kubernetes-engine
kubernetes

2 Answers

2/25/2018

As per the tutorial says, and I quote it:

Note: Kubernetes Engine assigns the external IP address to the Service resource—not the Deployment. If you want to find out the external IP that Kubernetes Engine provisioned for your application, you can inspect the Service with the kubectl get service command

$ kubectl get service
NAME         CLUSTER-IP      EXTERNAL-IP     PORT(S)          AGE
hello-web    10.3.251.122    203.0.113.0     80:30877/TCP     3d

Once you've determined the external IP address for your application, copy the IP address. Point your browser to this URL (such as http://203.0.113.0) to check if your application is accessible.

So, you'll need to run $ kubectl get service hello-web to know the IP address.

-- Shibboleet
Source: StackOverflow

2/25/2018

I think you need opening firewall and access your deployments in compute engine instance by instance external ip address and port. You can use curl ip:port in for check it.

-- trigun117
Source: StackOverflow