Firewall at container level in GCP

3/29/2018

I have my jenkins slaves running on gke dynamically. I need to allow those containers to access my nexus server which is running on port 8080 on a different instance but same network. In firewall I have to allow those containers to access nexus-port 8080. But I don't want to keep 0.0.0.0 in source IP ranges. What is the IP range that I should allow to make it work. I tried Internal IPs, Cluster EndPoint in Source IP and targets I allowed all instances in the network. It is not working as expected. I need some help.

-- Ram
google-cloud-platform
google-kubernetes-engine
kubernetes

2 Answers

3/29/2018

In addition to @Radek 'Goblin' Pieczonka answer I think it’s worth to add that traditional firewall rules are no longer sufficient for containerized environments.

Kubernetes Network Policy allows you to specify the connectivity allowed within your cluster, and what should be blocked. This is not based on traditional IP firewall concept but rather on selectors, not IP addresses and ports.

Here you can read foundations of the new philosophy of security. You probably will find interesting for your project.

-- d0bry
Source: StackOverflow

3/29/2018

What you want to use to achieve this is not fiddling directly with firewall, but utilize Kubernetes native way of limiting traffic between pods by use of Network Policies

https://kubernetes.io/docs/concepts/services-networking/network-policies/

-- Radek 'Goblin' Pieczonka
Source: StackOverflow