Kubernetes NetworkPolicy allow loadbalancer

前端 未结 2 1147
时光取名叫无心
时光取名叫无心 2021-01-03 02:08

I have a Kubernetes cluster running on Google Kubernetes Engine (GKE) with network policy support enabled. I created an nginx deployment and load balancer for it:

         


        
2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-03 02:50

    I talked about this in my Network Policy recipes repository.

    "Allowing EXTERNAL load balancers while DENYING local traffic" is not a use case that makes sense, therefore it's not possible to using network policy.

    For Service type=LoadBalancer and Ingress resources to work, you must allow ALL traffic to the pods selected by these resources.

    If you REALLY want you can use the from.ipBlock.cidr and from.ipBlock.cidr.except resources to allow traffic from 0.0.0.0/0 (all IPv4) and then excluding 10.0.0.0/8 (or whatever private IP range GKE uses).

提交回复
热议问题