Difficulty: Intermediate
Estimated Time: 5 minutes


We'll learn how to use OPA Gatekeeper to restrict Ingress/Egress ports in NetworkPolicies.

In this scenario, we have seen how to prevent any kind of Ingress/Egress access based on the port or a range of ports provided.

For more info on this scenario - Enforce Ingress/Egress Port restrictions.

For more OPA Gatekeeper use-cases - Mastering OPA Policies

Restrict Ingress/Egress Ports in NetworkPolicies

Step 1 of 4


This allows us to implement finer controls for the cluster by following the principle of least privilege and making sure that access is given to a particular resource only if it is needed.