DCA · Question #66
The Kubernetes yaml shown below describes a networkPolicy. Will the networkPolicy BLOCK this traffic? Solution: a request issued from a pod lacking the tier: api label, to a pod bearing the tier: back
The correct answer is A. Yes. The NetworkPolicy will BLOCK traffic from a pod lacking the tier: api label to a pod bearing the tier: backend label.
Question
The Kubernetes yaml shown below describes a networkPolicy. Will the networkPolicy BLOCK this traffic? Solution: a request issued from a pod lacking the tier: api label, to a pod bearing the tier: backend label
Options
- AYes
- BNo
How the community answered
(48 responses)- A71% (34)
- B29% (14)
Why each option
The NetworkPolicy will BLOCK traffic from a pod lacking the `tier: api` label to a pod bearing the `tier: backend` label.
The NetworkPolicy blocks this traffic, indicating that a policy applies to the destination `tier: backend` pod, and its `ingress` rules are configured to *only* permit traffic from pods explicitly matching specific labels (e.g., `tier: api`). Consequently, any traffic originating from a pod *lacking* the `tier: api` label would be denied ingress to the `tier: backend` pod.
If the traffic were not blocked, the NetworkPolicy would either not apply to the `tier: backend` pod, or its `ingress` rules would explicitly allow traffic from any pod, or specifically from pods that lack the `tier: api` label.
Concept tested: Kubernetes NetworkPolicy ingress selection
Source: https://kubernetes.io/docs/concepts/services-networking/network-policies/#the-networkpolicy-resource
Topics
Community Discussion
No community discussion yet for this question.