Question

How is a managed databased accessed by a Kubernetes cluster?

How is a managed databased accessed by a Kubernetes cluster?

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi there @robDolphin,

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:

https://www.digitalocean.com/community/tutorials/how-to-deploy-laravel-7-and-mysql-on-kubernetes-using-helm

Regards, Bobby