I have two Kubernetes deployments (DeploymentA and DeploymentB) and I am wondering that is there a way to whitelist all incoming traffic from DeploymentB in DeploymentA? So that DeploymentA can be accessed only via DeploymentB.
ClusterIP service can be used to access deployments for internal communication in Kubernetes but How can I whitelist all the requests coming from a specific deployment(or its pods) in another deployment? Is there a way for example to get all possible ip addresses of the pods of a specific deployment in order to whitelist them?
Edit 1:
I have a web application which is open to Internet but a specific part of it has to be accessible only from a specific deployment. To implement that, I need to specify the IP-addresses or somehow names of the deployments which should have access.
Thank you!