Kubernetes 101 : Network security policy of Pods - NetworkPolicy -

If there is no network policy to prevent them from doing so,
pods will accept all the connections, regardless of the source.

To prevent that from happening, we could use network policies to specify which connections pods accept  or reject.

Below is an example of a network policy and its Yaml file:

Ingress rule : allows connections from pods with the "app: nginx" label on port "27019".
Egress rule : allows connections to pods with the "app: nginx" label on port "80".


Leave as a comment: