Whitelist/Filter incoming ips for https load balancer

5/8/2017

I use Google Container Engine with Kubernetes. I have created an https load balancer which terminates ssl and forwards traffic to k8s cluster nodes. The problem is I see no option to whitelist/filter incoming ip addresses. Is there any?

-- Vitamon
gcloud
google-compute-engine
kubernetes
whitelist

2 Answers

5/10/2017

It sounds like you've set up a load balancer outside of Kubernetes. You may want to consider using a Kubernetes Service set to type: LoadBalancer. That type of service will give you an external IP that load balances to all of your Pods and can be easily restricted to whitelist IPs using the loadBalancerSourceRanges setting. Here is the example from the docs at https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/

apiVersion: v1
kind: Service
metadata:
  name: myapp
spec:
ports:
    - port: 8765
      targetPort: 9376
  selector:
    app: example
  type: LoadBalancer
  loadBalancerIP: 79.78.77.76
  loadBalancerSourceRanges:
  - 130.211.204.1/32
  - 130.211.204.2/32  
-- coreypobrien
Source: StackOverflow

5/9/2017
-- Giancarlo Rubio
Source: StackOverflow