How to connect to external SQL Server behind VPN from a DigitalOcean K8S Cluster?

I have a DOKS cluster running Kubernetes Jobs, and one of these jobs needs to query an external database from a client that seats behind a VPN. I couldn’t find any relevant information on how to be able to access the external database from the cluster. Any help or pointers to the right direction? Thanks a lot!

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.

This isn’t really a problem of Kubernetes. It’s a problem of your SQL server and VPN settings. How would you access the database from a laptop without VPN access?

I don’t know the exact answer, but you could look into the following:

  • Can you grant access to the SQL server based on IP address? If so, you would need to add your DOKS cluster IP addresses to the allow list.
  • Can you programmatically connect to the VPN? Or, can you connect to the VPN from Linux? If so, you could embed the logic to connect to your VPN into your Kubernetes Job.