Bird
0
0

What will be the effect of this NetworkPolicy snippet?

medium📝 Predict Output Q5 of 15
Kubernetes - Networking
What will be the effect of this NetworkPolicy snippet?
spec:
  podSelector: {}
  egress:
  - to:
    - ipBlock:
        cidr: 10.0.0.0/24
        except:
        - 10.0.0.5/32
APods can send traffic to any IP including 10.0.0.5
BPods can send traffic only to IPs in 10.0.0.0/24 except 10.0.0.5
CPods cannot send traffic to any IP
DPods can send traffic only to 10.0.0.5
Step-by-Step Solution
Solution:
  1. Step 1: Understand podSelector and egress

    podSelector: {} selects all pods; egress limits traffic to IPs in 10.0.0.0/24 except 10.0.0.5.
  2. Step 2: Interpret ipBlock with except

    Pods can send traffic to the subnet except the excluded IP 10.0.0.5.
  3. Final Answer:

    Pods can send traffic only to IPs in 10.0.0.0/24 except 10.0.0.5 -> Option B
  4. Quick Check:

    Egress IP block with except excludes IP = A [OK]
Quick Trick: ipBlock except excludes specific IPs from allowed range [OK]
Common Mistakes:
  • Ignoring except field
  • Assuming all IPs allowed
  • Confusing ingress with egress

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes