Courseiva
Services and NetworkinghardMultiple ChoiceObjective-mapped

CKA Services and Networking Practice Question

A NetworkPolicy with podSelector: {} and policyTypes: [Ingress] is applied to a namespace. What is the effect on pods in that namespace?

⚠ Common exam trap

Watch out — candidates often assume an empty rules list means 'no effect' or 'allow all', but Kubernetes NetworkPolicy defaults to deny for the specified policyTypes when no rules are defined, making it a powerful isolation tool.

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

All ingress traffic is denied unless explicitly allowed by another policy.

A NetworkPolicy with `podSelector: {}` selects all pods in the namespace. When `policyTypes: [Ingress]` is set without any ingress rules, it defaults to denying all ingress traffic that is not explicitly allowed by another policy. This is because Kubernetes NetworkPolicy implements an implicit deny for the specified traffic direction when no rules are provided, effectively isolating the pods from inbound connections.

Answer analysis

Option-by-option breakdown

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

  • All ingress traffic is denied unless explicitly allowed by another policy.

    Why this is correct

    An empty `podSelector: {}` in a NetworkPolicy selects all pods within the policy's namespace. When `policyTypes: [Ingress]` is specified without any `ingress` rules, the policy's effect on the selected pods is to deny all incoming traffic by default. This effectively creates a default-deny ingress posture for all pods in the namespace, unless another NetworkPolicy explicitly permits specific ingress connections to those pods.

  • The policy has no effect because no rules are defined.

    Why it's wrong here

    This statement is incorrect because a NetworkPolicy with `policyTypes: [Ingress]` and an empty `podSelector: {}` has a significant effect, even without explicit `ingress` rules. The absence of `ingress` rules, combined with the `Ingress` policy type, implicitly means that all ingress traffic to the selected pods is denied. NetworkPolicies are not passive; their configuration actively dictates network behavior.

  • All ingress traffic is allowed.

    Why it's wrong here

    This is incorrect because the default behavior for NetworkPolicies, once a pod is selected by a policy with `policyTypes: [Ingress]`, is to deny all ingress traffic unless explicitly allowed by an `ingress` rule. An empty `podSelector: {}` selects all pods in the namespace, and the specified `policyTypes: [Ingress]` activates ingress enforcement. Therefore, without any allowing rules, all ingress traffic to these pods is blocked, not allowed.

  • All egress traffic is denied.

    Why it's wrong here

    This statement is incorrect because the NetworkPolicy explicitly specifies `policyTypes: [Ingress]`, which means this particular policy only governs incoming traffic to the selected pods. Egress traffic, or outgoing connections from the pods, is entirely unaffected by this policy. To control egress traffic, `policyTypes: [Egress]` must be included, and corresponding `egress` rules defined.

About these practice questions

One of 302 original CKA practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CKA practice question is part of Courseiva's free CNCF 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 CKA exam.