问题
I have 2 namespaces and 1 pod, 1 service running in each.
Example
Namespace 1: default
Pod: pod1
Service: pod1service
Namespace 2: test
Pod: pod1
Service: pod1service
I can actually make HTTP request from namespace2 pod to namespace1 pod.
curl -H "Content-Type: application/json" -X GET http://pod1service.default.svc.cluster.local/some/api
How do i disable communication between 2 differet namespaces?
回答1:
You need to configure network policies. For that to work you also need to use a network addon that supports policies.
来源:https://stackoverflow.com/questions/43675572/how-to-disable-cross-communicate-between-pods-which-are-in-2-different-namespace