IP adress of database keep changing in Kubernetes

I run Pydio cells as 2 pods in Kubernetes. One for the app and the other for the database.
When installing the application the application is asking for the IP Address of the database. So far so good.
The problem after that is when Kubernetes restart a pod of move a pod to another node, the IP address changed. Every time that happen it results in application not starting because it can’t find the database. Is there is solution for this? I was thinking in not putting the IP address of the database in the config file but the host name of the database or something like that.

did you actually try to pass the hostname instead of the IP ?

That is what i want to do in the Pydio config.file but till now it didn’t work.
Maybe i did something wrong but if i pass the hostname instead of the IP it won’t work

Here is how my Pydio.Json file look like

“dsn”: “root:Myrootpassword@tcp(my_IP:3306)/cells?parseTime=true”

Hello @boss_75 ,

Your issue with the ip is most likely because each time a pod restarts it is assigned a new ip,
the best way to handle this would be to use a hostname, if both Cells and the Database are running under the same network, you could use the hostname(see link below to configure the hostname on kubernetes) to refer to it.
In the event that you restart a new database and it is assigned a the IP your hostname will be static.

(make also sure to update the pydio.json with the hostname of the database).

In the kubernetes config I believe this would make the trick.

Yes, you were on the right track, you should use the hostname for the database.

Thanks for your help
I will try to figure it out base on your advise.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.