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.
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/
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.