I have a kubernetes cluster running on GCE. Someone is using bots to create a lot of requests on my server and I don't know how to block him. I could do it from within the application but that will eat a lot more resources as compared to a more elegant solution such as a firewall rule.
I tried adding such a firewall rule without any positive results:
I would probably drop it if I was using the Nginx loadbalancer but I'm using their own loadbalancer and I can't mangle with that.
So...how does one ban a request based on source ip address in GCE/kubernetes?
You can run nginx behind the GCE ingress and reject IPs based on the X-Forwarded-FOR header [github] (https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx/examples/whitelist)