liveBook · Manning

Policy type

As explained in Acing the Certified Kubernetes Administrator Exam, Second Edition

A NetworkPolicy policy type specifies whether the policy governs ingress isolation, egress isolation, or both.

A NetworkPolicy policy type declares which traffic direction becomes isolated: Ingress for incoming traffic, Egress for outgoing traffic, or both. Policies are additive, so separate objects can control different directions. section 6.6

Use policyTypes to make the intended isolation explicit:

  • Ingress isolates incoming traffic; permitted traffic and its reply traffic remain allowed. section 6.6
  • Egress isolates outgoing traffic and requires egress rules to define permitted destinations. section 6.6

Allow traffic in both directions

Select nginx with an Ingress policy allowing busybox on TCP port 80, then select busybox with an Egress policy allowing nginx on the same port. Verify the resulting connection with kubectl exec and wget.

How Acing the Certified Kubernetes Administrator Exam, Second Edition covers it

How deep it goes
Defines direction-specific isolation, defaults, additive policies, and permitted traffic, but does not detail CNI implementation internals.
Examples
Uses default-deny YAML plus nginx and busybox policies tested with kubectl exec and wget.
What it assumes
Assumes basic Kubernetes pods and NetworkPolicy knowledge while distinguishing ingress from egress isolation.
What you can do after
Operate/configure NetworkPolicy isolation by selecting policy types and verifying allowed pod traffic with kubectl and wget.
How it connects
Connects NetworkPolicy with ingress rules, egress rules, podSelector, namespaceSelector, ipBlocks, and CNI support.

This explainer was generated by Manning's knowledge graph from the text of Acing the Certified Kubernetes Administrator Exam, Second Edition. The section links point to the parts of the book it draws on.