Current scenario
I have,
- a working minikube k8s cluster
- a working MySQL server running on my Ubuntu 22.04.1 LTS machine (not deployed on docker or k8s)
Requirement
I'm actually trying to change the default database for WSO2IS_IDENTITY_DB
of WSO2 Identity Server on k8s. But that really doesn't matter for the core of question. What I really want to do is, use some IP in the below url
attribute so that the identity server can use it to store the data. I don't know what IP should be used here (in the deployment.toml
config file)
[database.identity_db]
type = "mysql"
url = "jdbc:mysql://192.168.X.X:3306/WSO2IS_IDENTITY_DB?autoReconnect=true&useSSL=false"
username = "dbusername"
password = "dbpassword"
driver = "com.mysql.cj.jdbc.Driver"
[database.identity_db.pool_options]
validationQuery = "SELECT 1"
Attached is an image for understanding the requirement. I need an approach to the middle part marked "??" in the image below.
PS- I know this can be bad practice but I want to learn how this works and that's why I'm trying to connect this way.
I'm still learning k8s so any pointers to solve this problem (if at all possible) would be highly appreciated! Thanks.
I tried setting the output IP from the minikube ssh 'grep host.minikube.internal /etc/hosts | cut -f1'
command as
[database.identity_db]
type = "mysql"
url = "jdbc:mysql://192.168.X.X:3306/WSO2IS_IDENTITY_DB?autoReconnect=true&useSSL=false"
.....
but still no luck.
I have a vague idea that this has something to do with port mapping but not sure how can I achieve that.
Similar SO questions had answers where the external MySQL runs inside a docker container but in my case I want to access the MySQL server running on the Ubuntu localhost itself.
What solves my issue
If I can show tables
inside the WSO2IS_IDENTITY_DB
in my local machine and see all the relevant tables have been created by the WSO2 IS.