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

4/28/2017

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?

-- sravis
kube-dns
kubernetes

1 Answer

4/28/2017

You need to configure network policies. For that to work you also need to use a network addon that supports policies.

-- Janos Lenart
Source: StackOverflow