So I currently have a database server that is up and running. I have it running on 0.0.0.0:8080. I have another python file making requests to that IP address, but when I run it in a container I have this python file point to the container's IP address, but when I have it on a kubernetes cluster I have it now point to the IP address of the kubernetes pod.
The pod IP address constantly changes, so how do I solve this approach?
Define a Service
for that database:
https://kubernetes.io/docs/concepts/services-networking/service/
This will expose the database with a fixed DNS name. Then from your python app, use the service name to access your database. The service will direct the traffic to the correct IP.