CK.V · CKAD practice question

In a NetworkPolicy, you write ingress: [{ from: [{ namespaceSelector: { matchLabels: { team: frontend } } }, { podSelector: { matchLabels: { app: batch } } }] }] inside namespace app-ns. How does Kubernetes evaluate the two elements in the from array?

Choose one answer
Check answer and explanation

Correct answer: As logical OR: traffic is allowed from any Pod in a namespace labeled team: frontend OR from any Pod labeled app: batch inside app-ns

Explanation

Each element (- ...) inside from or to is evaluated independently and combined with logical OR, while fields inside a single element are combined with logical AND.

Common trap

Each element (- ...) inside from or to is evaluated independently and combined with logical OR, while fields inside a single element are combined with logical AND.

Source: Original unofficial practice; not an official CKAD exam item
Checked against the cited text on 2026-11-30.

Report an error in this question