Skip to main content

More Info:

Verifies each application namespace has a default-deny ingress NetworkPolicy. Without one, every pod is reachable from every other pod.

Risk Level

High

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. List non-system namespaces that need a default-deny NetworkPolicy (run on any machine with kubectl access):
  2. For each application namespace that should be isolated (replace my-namespace with the actual namespace), create a default-deny ingress NetworkPolicy (run on any machine with kubectl access):
  3. (Optional but recommended) In each namespace where you created the default-deny policy, define explicit allow NetworkPolicies for the traffic that should be permitted (for example, allowing ingress from a specific namespace; run on any machine with kubectl access and adjust selectors as needed):
  4. Verify that each non-system namespace now has at least one default-deny ingress NetworkPolicy (run on any machine with kubectl access):
    Confirm that is_compliant=true is reported for the cluster and that each application namespace shows defaultDenyPolicies greater than 0.
On any machine with kubectl access:
  1. List non-system namespaces that need a default-deny NetworkPolicy
  1. For each application namespace that is missing a default-deny ingress NetworkPolicy, create one. Example manifest (save as default-deny-ingress.yaml and apply per namespace):
Apply it:
Or create it directly with kubectl (replace example-namespace each time):
  1. Verification
Re-run the check (same logic as the audit) from any machine with kubectl access: