How to make jdbc PAYARA connection to CloudSQL from GKE - kubernetes

I have a project into PAYARA server full with JDBC Connectiones. The project works fine over VMs (actually GCP).
But I need migrate to GKE. I have a payara server full running on GCP POD but i don't know make a JDBC Connection to CLoudSQL.
Please helpme.

Take a look at the Cloud SQL connector for Java.
You might also be interested in the Cloud SQL Auth proxy, which is covered in the "Connecting from Google Kubernetes Engine".

Related

How to test connection from GKE to MongoDB Atlas Server?

Theres a NodeJS application deployed on GKE
MongoDB Atlas Peering Connection is successful with GCP VPC Peering Connection
However, NodeJS Application is throwing error with connection with MongoDB
What can I do to test connection from GKE Cluster to MongoDB?
The easiest way would be to deploy your nodeJS application and look at the application logs. If for some reason that's not working you could launch a mongo CLI pod, start a shell session and try to initiate the connection that way.
You mentioned the nodeJS application is throwing an error. You might want to copy paste that error here so people on StackOverflow can be of more help. It's important that you provide as much context as possible in your question.

Unable to connect to mysql in Istio environment

We have configured the Kubernetes cluster on bare-metal server with v1.15.1 and Istio-1.4.0 (demo) with mTLS enabled.
And our mysql server is outside the K8s cluster on Azure VM's.
Now when we inject istio-proxy while deploying the application we are unable to connect to mysql server via jdbc and also tried my mysql client. But when remove the istio-proxy by re-deploying we are able to connect instantly with out any issue.
When through many blogs wrt istio and mysql, tried with removing the default mesh policy but tht didnt work. The case in istio faq's is when the mysql is in k8s cluster with istio injected.
You can configure auto-mtls for istio by configuring values.global.mtls.auto=true (ie it uses mtls when possible and falls back for other connections
https://istio.io/docs/tasks/security/authentication/auto-mtls/
Serviceentry and destionation rule does the work form my case

Can I use the cloudsql-proxy to connect to a custom VM running postgres?

I have a custom Postgres instance running on a GCE VM. I am not using CloudSQL. I'd like to use the functionality provided by the cloudsql-proxy, but when I specify my custom instance the proxy fails.
googleapi: Error 404: The Cloud SQL instance does not exist., instanceDoesNotExist
It appears that only CloudSQL instances work and I don't understand the limitation. It seems like the proxy should work on any VM with port 5432 open.
Cloud SQL Proxy can only be used with Cloud SQL instances.
In the documentation About the Cloud SQL Proxy there is no mention about using it for custom databases inside GCE.
As it is stated in the documentation:
The Cloud SQL Proxy provides secure access to your Cloud SQL Second
Generation instances without having to whitelist IP addresses or
configure SSL.
However, I found some documentation about Access control overview where you can find an alternative to it.

Using RDS instead of mysql containers in kubernetes

I used this tutorial to install wordpress using kubernetes.
https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/
It is working as expected. But I will prefer to use Amazon RDS instead of mysql pods. I am not sure what changes are required.
In the wordpress deployment you just need to update the host and credentials for your amazon db
you don't need to deploy any of the mysql resources from the tutorial.

Google Cloud SQL - Service Account

I am following the link below to create a Cloud SQL Proxy.
https://cloud.google.com/sql/docs/mysql/connect-container-engine
When I get to the step to create the service account, I am unable to see any Cloud SQL roles, even though I have a MySQL instance associated with the project and I have enabled Cloud SQL administration API as described in the previous step.
Also, the whole process seems to be quite long-winded. Is there a way to connect directly from the container cluster to Cloud SQL without using the proxy? If yes, how do I find the IP address of the Cloud SQL instance? Also, how do I get the container cluster IP to white-list?
Many thanks