2V0-71.23 Question 34
Single answerYou are managing a Kubernetes cluster in a VMware Tanzu environment. An application team reports issues with their microservice not being able to communicate with another service running in a different namespace. Upon investigation, you notice that NetworkPolicies are enabled in the cluster. What step should you take to resolve the issue while adhering to Kubernetes networking principles?
- A
Create a NetworkPolicy in the target namespace to explicitly allow traffic from the source namespace.
- B
Disable NetworkPolicies in the cluster to allow all traffic by default.
- C
Create a Service in the source namespace with a ClusterIP type to allow communication.
- D
Use a PersistentVolumeClaim (PVC) to establish communication between the two services.
Show answer and explanation
Correct answer: A
Explanation
In Kubernetes, NetworkPolicies are used to control traffic flow to and from pods. When these policies are enforced, they default to denying all traffic unless explicitly permitted. To allow communication between services in different namespaces, you must create a NetworkPolicy in the target namespace that allows traffic from the source namespace. This ensures secure and compliant communication between workloads.
- A. Correct.
This is the correct approach. NetworkPolicies define traffic rules in Kubernetes, and you need to explicitly allow traffic between namespaces when they are enforced.
- B. Incorrect.
Disabling NetworkPolicies is not recommended as it overrides the security model of Kubernetes and can lead to unintended communication between workloads.
- C. Incorrect.
Creating a Service with a ClusterIP type won’t help since it only provides internal DNS and IP-based access within the cluster but does not override NetworkPolicy restrictions.
- D. Incorrect.
PersistentVolumeClaims (PVCs) are used for storage purposes, not for enabling networking communication between services.