liveBook · Manning

Namespace selector

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

A namespace selector is a label-based selector that identifies namespaces whose pods may be included in a network policy rule.

A namespace selector is a label-based NetworkPolicy selector that identifies namespaces whose pods may be included in ingress or egress rules. It combines with pod selectors, IP blocks, and ports for granular traffic filtering. section 6.6

Apply these rules when reading or writing NetworkPolicy manifests:

  • Place namespaceSelector and podSelector in the same list item to require both conditions. section 6.6
  • Place selectors in separate list items to make them alternatives; each item under ingress.from or egress.to is an OR condition. section 6.6
  • Use the selector within ingress or egress rules to control which pod connections are permitted. section 6.6

Combining namespace and pod scope

A NetworkPolicy can allow incoming traffic to db pods in the default namespace only from frontend pods running in the myproject namespace, while also restricting node CIDRs and ports. section 6.6

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

How deep it goes
Explains selector composition and OR-versus-AND behavior, but does not provide a standalone namespace-selector manifest.
Examples
Uses frontend pods in myproject accessing db pods in default alongside CIDR exceptions and TCP port restrictions.
What it assumes
Assumes familiarity with pods and NetworkPolicy rules while reinforcing ingress, egress, pod selectors, and IP blocks.
What you can do after
Evaluate NetworkPolicy rules and configure namespace-scoped traffic permissions with selector combinations.
How it connects
Connects namespace selectors with NetworkPolicy, pod selectors, IP blocks, ingress, egress, and port filtering.

Also explained in

Compare how 2 books explain namespace selector →

Related concepts

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.