Nginx - Not able to connect to External IP of a VM in GCP from a browser

Hi,

I have created 1 MAster and 1 Worker node on GCP with below config.

Master - E2 Small(2 vCPU, 2GB Memory), CentOS7, Standard Persistent Disk - 20GB, Allow http,https traffic

Worker - E2 Micro(2 vCPU, 1GB Memory), CentOS7, Standard Persistent Disk - 20GB, Allow http,https traffic

I have created an nginx POD and exposed it to outside internet using NodePort service.

But I am not able to access from broswer. I used below

http://34.67.102.11:30084/

IP is the Master Node VM External IP which i got from GCP Console

NodePort i have got describing the service.

Kindly let me know if i am missing anything.

Thanks,

Amarnath.

Hi Amarnath,

Given that you have exposed your NGINX service as NodePort service, you need to access your NGINX service using the Public IP address of your worker node (because that’s where your pod also runs) and not using the Public IP address of the master node.

Thanks,
Ganesh

Thanks Ganesh for replying.

I have tried using the EXTERNAL_IP of “worker node” as well, but it’s not working. Below is the error.

ERR_CONNECTION_TIMED_OUT

I am trying to find out the issue from 3 days but not able, it will be really kindful if you can help me out.

I can give any details if needed.

I am using Google VMs with CentOS7

Thanks,
Amarnath.

Two things to check:

  1. Ping the worker node public IP address from your windows command or linux shell prompt.
  2. You need to open up the NodePort 30084 of your CentOS VM nodes in the GCP Firewall settings, so that connections from the internet to NodePort 30084 will be permitted and will eventually reach your pod’s target port 80 (I assume you run nginx on port 80 inside the pod)

If none of these options work for you and if you are desperately looking for alternate secure ways to expose your NGINX or any app to the internet, refer to this sidecar solution to publicly access your app without any need to expose your worker or master nodes to the public internet. This is a great option for private cloud solutions.

https://www.socketxp.com/docs/guide/kubernetes-cluster-remote-access.html#standalone-container