I have a Kubernetes cluster with 2 containers running in a single workload.
One container is running a Flask server application and the other is running an angular application. I need to have this pod set up in a way where both applications can communicate with each other within the localhost. I need the angular container which is exposed in port 4200 to communicate with the unexposed flask server which is on port 5000. I am stuck when it comes to having these containers communicate within the pod.
Rather than localhost (127.0.0.1
), make sure your flask server is reachable via any local IP, that is, app.run(host='0.0.0.0')
.
You should be able to communicate with each other using localhost:<port-number>
as all containers in a Kubernetes pod share the same network namespace.