KCNA practice question 14 of 25

What is the role of a NetworkPolicy in Kubernetes?

Full set: 240 questions
Answer options
A: The ability to cryptic and obscure all traffic.
B: The ability to classify the Pods as isolated and non isolated. Correct answer
C: The ability to prevent loopback or incoming host traffic.
D: The ability to log network security events.
Correct Answer:
B. The ability to classify the Pods as isolated and non isolated.
Explanation

The primary role of a NetworkPolicy resource in Kubernetes is to control traffic flow between Pods. By default, all Pods in a cluster can communicate freely. When a NetworkPolicy selects a Pod, that Pod becomes "isolated." This means it will reject any connections that are not explicitly allowed by the policy's ingress or egress rules. Therefore, NetworkPolicy's core function is to classify Pods as isolated (requiring explicit rules to communicate) or non-isolated (open by default).

Why Incorrect

A. Encryption of traffic is handled by service meshes like Istio or Linkerd, not by the standard NetworkPolicy resource.
C. NetworkPolicy controls inter-Pod traffic, not traffic on the host's loopback interface or general incoming traffic to the node itself.
D. Logging is a function of the CNI plugin that implements the policy or other monitoring tools, not a direct role of the NetworkPolicy object itself.

References

1. Kubernetes Documentation. (n.d.). Network Policies. In Kubernetes Concepts. Retrieved from https://kubernetes.io/docs/concepts/services-networking/network-policies/. The first paragraph states, "By default, pods are non-isolated; they accept traffic from any source. Pods become isolated by having a NetworkPolicy that selects them."

2. Cloud Native Computing Foundation (CNCF). (n.d.). Kubernetes for Developers. Linux Foundation Training. In the "Network Policy" section, it explains that policies are used to "isolate pods from each other."

3. Red Hat OpenShift Documentation. (n.d.). About network policy. In Networking. Retrieved from https://docs.openshift.com/container-platform/4.12/networking/networkpolicy/about-network-policy.html. Section "About network policy" states, "By default, all pods in a project are accessible from other pods... To isolate one or more pods, you can create NetworkPolicy objects."

Scroll to Top