ahmetb / kubernetes-network-policy-recipes

Example recipes for Kubernetes Network Policies that you can just copy paste

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Requirement for accessing external public URL's from pods

saiharshitachava opened this issue · comments

We have a huge cluster and whenever we want the deployment to communicate to the public URL's..We will have to open up proxy for all the nodes in the cluster (as we are behind a proxy)

Whenever we add a new node we need to make sure all of the rules are working as the kubernetes pods can spin anywhere in the cluster..

Can this requirement be achieved using any of the network policies in this project?(Im pretty new to this concept and I guess there can be some egress rules written)

Stackoverflow is a better forum for questions like these.

network policies will not help you with your use case for many reasons:

  • network policies act on L3, so IP's and not URL's
  • the nature of k8s make it such a way that's its impossible to predict where a pod might land, so it's hard to predict it's ip and have a network policy only allowing that pod to reach the external proxy

In order to acheive what you are describing you need a way to assign a specific egress IP to your pods, such a thing can be done with istio https://istio.io/latest/docs/tasks/traffic-management/egress/egress-gateway/

Closing as this is not what the repo is about anyway. Hope the answers give your some good pointers