简体   繁体   中英

Connect to MySQL database by using route exposed on openshift

I have just exposed my database on openshift and it gives me an 'https://....' url Does anybody know how to connect using DBeaver by using this url that openshift gave to me. The error that dbeaver says to me is the following Malformed database URL, failed to parse the main URL sections.

Short answer: You can't with a Route
Route can only expose http/https traffic
If you want to expose tcp traffic (like for a database), do not create a Route and change your Service type to "NodePort"`
Check my previous answer for this kind of problem (exposing MQ in this case): How to connect to IBM MQ deployed to OpenShift?

OpenShift doc on NodePorts: https://docs.openshift.com/container-platform/4.7/networking/configuring_ingress_cluster_traffic/configuring-ingress-cluster-traffic-nodeport.html

There's another way to do this.

If your Route is set to "passthrough" it will just look at the SNI headers to determine where to route the traffic but won't unwrap it (and expect http inside) which will let it pass other traffic through to a pod.

I use this mechanism to run a ZNC bouncer (irc traffic) behind SNI.

The downside is you need to provide your own TLS cert inside the pod instead of leveraging the general one available to *.apps.(cluster).com

As for the specific error, "Malformed database URL", I've not used this software but from a quick websearch it looks like you want to rewrite the https://(appname).(clustername).com into a jdbc:.../hostname... string, and then enable TLS in settings.

I found this page that talks about setting it up, so it might be helpful if you've not around found it -- https://github.com/dbeaver/dbeaver/issues/9573

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM