How to expose a API that is running in a Pod and limit access?

8/20/2019

I have an API running in a service in my GKE Cluster and it needs to be accessible for some other developers in my team. They are using a VPN so they have a static IP they can provide to me.

My idea was to just expose the service using a static external IP and restricting access to this IP using a Firewall rule so just the IP of my colleagues.

Unfortunately this just seems to be possible for Compute-VMs because only they can have tags.

Is there a way how I can simply deny all traffic to my service except for traffic from the specific IP?

I appreciate any hints to features, thank you

-- flo3719
google-cloud-platform
google-kubernetes-engine

2 Answers

8/20/2019

Well, you don't need tags, you can create your firewall rule to only allow access to the IP your developers provide you, just when you're creating your firewall rule, select all instances in the network for Targets and for source IP ranges specify the IP with the prefix /32 at the end.

-- AdolfoOG
Source: StackOverflow

8/20/2019

You could provide them RBAC access to the pods in the required namespace and allow them to port forward. Assuming you don't want to set up a public end point and try secure it. This does require kubectl to be installed and cluster access and this will give access to all pods in the namespace.

https://medium.com/@ManagedKube/kubernetes-rbac-port-forward-4c7eb3951e28

Depends what level of security and permanency you need I guess.

-- Jaboy
Source: StackOverflow