Is there a way to restrict communication between two containers on the same pod to have improved isolation?

6/29/2017

I have deployed two containers on a pod. One is privileged and the other is a normal user container. I want to restrict communication between the two containers so that they cannot access each other or talk to each other on local host.

-- Zirak Zaheer
containers
kubernetes

2 Answers

7/6/2017

Containers on the same Pod share the same network namespace and can reach each other on localhost. It as if the pods are on the same computer/machine/vm.

See here: https://kubernetes.io/docs/concepts/workloads/pods/pod/#resource-sharing-and-communication

and here: https://kubernetes.io/docs/concepts/cluster-administration/networking/

-- Chen Fisher
Source: StackOverflow

7/4/2017

As long as this privileged container has no applications listening, there shouldn't be any reason for these two containers to talk to each other. In case it has any kind of application listening, make sure to add any kind of authentication so it prevents any unwanted communication.

-- Javier Salmeron
Source: StackOverflow