KCSA Kubernetes Security Fundamentals Practice Question
You need to isolate a database pod so that only pods with the label 'tier=frontend' within the same namespace can connect to it on port 5432. Which NetworkPolicy resource configuration 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
✓
A NetworkPolicy with an ingress rule specifying podSelector for 'tier=frontend' and port 5432.
A NetworkPolicy targeting the database pods with 'podSelector' and defining an 'ingress' rule allowing traffic from pods matching 'tier=frontend' on port 5432.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
A NetworkPolicy with an ingress rule specifying podSelector for 'tier=frontend' and port 5432.
Why this is correct
This accurately restricts incoming traffic to only authorized frontend pods on the database port.
- ✗
A PodSecurityPolicy enforcing frontend network access.
Why it's wrong here
PodSecurityPolicies are deprecated and manage pod security contexts, not network connectivity.
- ✗
A ServiceMesh AuthorizationPolicy restricting namespace-level routes.
Why it's wrong here
While service meshes can do this, native Kubernetes NetworkPolicies are the core resource for layer 3/4 isolation.
- ✗
A NetworkPolicy with an egress rule allowing frontend pods to reach the database.
Why it's wrong here
Egress rules control outgoing traffic from selected pods, whereas ingress is required to protect the database pod from unauthorized incoming traffic.
About these practice questions
This KCSA question is part of Courseiva's 320-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
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 CNCF / Linux Foundation exam blueprint
This KCSA practice question is part of Courseiva's free CNCF / Linux Foundation 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 KCSA exam.