These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
What I would usually do is store my database details like hostname, password, username, port and etc. in a Kubernetes secret. Then I would add those database details to my deployment yaml file as environment variables.
The exact environment variables would depend on what kind of application you have.
For example, if you are using Laravel, you could follow the steps on how to do that here:
From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.