Kubernetes 101: Overview of kubernetes Network policies - Ingress and Egress -
Ingress and Egress traffic:
Egress traffic : is the outgoing traffic leaving to initiate a connection.
Network policies:
A network policies are kubernetes resources through which we can define traffic rules. We can then attach these network policies to pods.
Example:
Network policy configuration file:
Below the "network-policy.yaml" file:
When we allow traffic into the web-pod the response going out of the web-pod is allowed too, we don't need an Egress rule for that.
On the other hand, in the above network policy, the database-pod can't initiate a connection to the web-pod, it needs an Egress rule to be a able to do that.
Comments