Courseiva
Networking And Network PolicieshardMultiple ChoiceObjective-mapped

EX280 Networking And Network Policies Practice Question

An administrator must configure a NetworkPolicy in the 'secure-zone' namespace to explicitly deny all ingress traffic except for TCP traffic coming from pods labeled 'tier=frontend' in the 'frontend-zone' namespace. Which NetworkPolicy specification achieves this?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-frontend namespace: secure-zone spec: podSelector: {} policyTypes: - Ingress ingress: - from: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: frontend-zone podSelector: matchLabels: tier: frontend ports: - protocol: TCP

To allow traffic from another namespace, the policyPeer must use namespaceSelector combined with podSelector. Denying all other ingress requires an empty ingress rule list alongside policyTypes: [Ingress].

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-frontend namespace: secure-zone spec: podSelector: {} policyTypes: - Ingress ingress: - from: - ipBlock: cidr: 10.128.0.0/14 ports: - protocol: TCP

    Why it's wrong here

    Using an ipBlock relies on cluster subnet ranges rather than native namespace and pod selectors.

  • apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-frontend namespace: secure-zone spec: podSelector: {} policyTypes: - Ingress ingress: - from: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: frontend-zone ports: - protocol: TCP

    Why it's wrong here

    This allows all pods in the frontend-zone namespace, ignoring the specific pod label 'tier=frontend'.

  • apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-frontend namespace: secure-zone spec: podSelector: {} policyTypes: - Ingress ingress: - from: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: frontend-zone podSelector: matchLabels: tier: frontend ports: - protocol: TCP

    Why this is correct

    This correctly targets the source namespace and pod label while restricting to TCP and selecting all pods in secure-zone.

  • apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-frontend namespace: secure-zone spec: podSelector: {} policyTypes: - Ingress ingress: - from: - podSelector: matchLabels: tier: frontend matchExpressions: - key: namespace operator: In values: [frontend-zone] ports: - protocol: TCP

    Why it's wrong here

    Pod selectors cannot select namespaces using matchExpressions in this manner; namespaceSelector must be used.

About these practice questions

Courseiva writes every EX280 question from scratch — 509 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed August 2026 · checked against the official Red Hat exam blueprint

This EX280 practice question is part of Courseiva's free Red Hat certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the EX280 exam.