CK.V · CKAD practice question

A NetworkPolicy in namespace prod has spec.podSelector: { matchLabels: { role: db } }, ingress: [{ from: [{ podSelector: { matchLabels: { role: api } } }], ports: [{ protocol: TCP, port: 5432 }] }], and policyTypes: [Ingress]. Which traffic does it allow?

Choose one answer
Check answer and explanation

Correct answer: Inbound TCP port 5432 to role: db Pods in prod from role: api Pods in prod

Explanation

podSelector in ingress.from without namespaceSelector selects Pods in the policy's own namespace (prod) matching role: api, allowing TCP 5432 into role: db Pods in prod.

Common trap

podSelector in ingress.from without namespaceSelector selects Pods in the policy's own namespace (prod) matching role: api, allowing TCP 5432 into role: db Pods in prod.

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