Bird
0
0

Given this NetworkPolicy snippet, what will be the effect on pod traffic?

medium📝 Predict Output Q4 of 15
Kubernetes - Networking
Given this NetworkPolicy snippet, what will be the effect on pod traffic? ```yaml apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-web-egress spec: podSelector: matchLabels: role: web policyTypes: - Egress egress: - to: - ipBlock: cidr: 10.0.0.0/24 ports: - protocol: TCP port: 80 ```
APods with label role=web can send traffic to any IP and port
BPods with label role=web can only send TCP traffic to port 80 in 10.0.0.0/24
CPods with label role=web can only receive traffic on port 80
DPods with label role=web are blocked from all egress traffic
Step-by-Step Solution
Solution:
  1. Step 1: Analyze podSelector and policyTypes

    The policy applies to pods labeled role=web and controls egress traffic only.
  2. Step 2: Interpret egress rules

    Egress allows TCP traffic on port 80 only to IPs in 10.0.0.0/24 subnet.
  3. Final Answer:

    Pods with label role=web can only send TCP traffic to port 80 in 10.0.0.0/24 -> Option B
  4. Quick Check:

    Egress restricted to TCP port 80 in subnet [OK]
Quick Trick: Egress rules restrict outbound traffic by IP and port [OK]
Common Mistakes:
  • Confusing egress with ingress rules
  • Assuming open traffic to all IPs
  • Thinking it controls incoming traffic

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes