Flask pod results in Cannot GET / when another flask pod is accessed

I have 2 pods

containers:
pod1

  1. flask
  2. vue

pod2
1.flask
2.postgres

when I make api calls to flask of pod1, the pod2 results in Cannot GET and vice versa. when i recreate the pods and make api calls to flask of pod2, the pod1 results in Cannot GET.

What maybe the reason and how to resolve this?

Cluster information:

Kubernetes version: v1.15.3
Cloud being used: (put bare-metal if not on a public cloud)
Installation method:
Host OS: centos
CNI and version:
CRI and version:

You can format your yaml by highlighting it and pressing Ctrl-Shift-C, it will make your output easier to read.