KCNA practice question 14 of 25
What is the role of a NetworkPolicy in Kubernetes?
Full set: 240 questionsThe 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).
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.
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."
Keep practicing
Take the free KCNA practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other KCNA practice questions
- Question 1Which of these commands is used to retrieve the documentation and field definitions for a…
- Question 2Kubernetes Secrets are specifically intended to hold confidential dat a. Which API object…
- Question 3What is the practice of bringing financial accountability to the variable spend model of …
- Question 6In Kubernetes, which command is the most efficient way to check the progress of a Deploym…
- Question 7What Kubernetes component handles network communications inside and outside of a cluster,…
- Question 8Kubernetes supports multiple virtual clusters backed by the same physical cluster. These …
