I need to agree and give more visibility to the comment made by user @dishant makwana:
Most probably you will need to whitelist the IP address of the nodes that your pods are running on
Assuming that you want to send a request from your GKE
Pod
to a service located outside of your project
/organization
/GCP
, you should allow the traffic on your "on-premise" location from your GCP
resources.
The source IP of the traffic that you are creating could be either:
GKE
Nodes External IP addresses - if the cluster is not created private.
Cloud NAT
IP address - if you've configured Cloud NAT
for your private cluster.
A side note!
If you haven't created a Cloud NAT
for your private cluster, you won't be able to reach external sources.
Answering following question:
Do I need to update any firewall rules or add custom IP/Port access inside via Ingress?
If we are speaking about GKE
/GCP
environment then, no. You don't need to modify any firewall rules from GCP
side (assuming that you haven't reconfigured your firewall rules in any way).
Ingress
resource (not rule) in Kubernetes
/GKE
is used to expose your own application to the external access (it's for inbound traffic, not outbound).
Citing the official documentation:
Implied rules
Every VPC network has two implied firewall rules. These rules exist, but are not shown in the Cloud Console:
Implied allow egress rule. An egress rule whose action is allow
, destination is 0.0.0.0/0
, and priority is the lowest possible (65535
) lets any instance send traffic to any destination, except for traffic blocked by Google Cloud. A higher priority firewall rule may restrict outbound access. Internet access is allowed if no other firewall rules deny outbound traffic and if the instance has an external IP address or uses a Cloud NAT instance. For more information, see Internet access requirements.
Implied deny ingress rule. An ingress rule whose action is deny
, source is 0.0.0.0/0
, and priority is the lowest possible (65535
) protects all instances by blocking incoming connections to them. A higher priority rule might allow incoming access. The default network includes some additional rules that override this one, allowing certain types of incoming connections.
-- Cloud.google.com: VPC: Docs: Firewall: Default firewall rules
Additional resources: