How to disable cross communicate between pods which are in 2 different namespaces in kubernetes

余生长醉 提交于 2021-02-10 14:23:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!