Can't connect OKE Kubernetes cluster to Oracle MySQL DB instance that is outside of the cluster

8/31/2021

Currently I am using Oracle Cloud to host an Oracle Kubernetes Cluster managed by Rancher. I also have an Oracle MySQL DB that is outside of the cluster.

The kubernetes cluster and db instance are on the same VCN, subnet, and in the same compartment.

The db instance does not have an external IP but has an internal IP.

I have deployed an endpoint and a ClusterIP in an effort to expose the db instance to the application.

<!-- begin snippet --><!-- language: lang-yaml -->
apiVersion: v1
kind: Service
metadata:
    name: mysql-dev
    namespace: development
spec:
    type: ClusterIP
    ports:
      - port: 3306
        targetPort: 3306
---
kind: Endpoints
apiVersion: v1
metadata:
 name: mysql-dev
 namespace: development
subsets:
 - addresses:
     - ip: <DB INTERNAL IP>
   ports:
     - port: 3306
<!-- end-->

In my application properties file I referenced the service...

<!-- begin snippet --><!-- language: lang-yaml -->
datasource.dev.db=dev
datasource.dev.host=mysql-dev
datasource.dev.username=<USERNAME>
datasource.dev.password=<PASSWORD>
<!-- end-->

I can't seem to get my application to communicate with the db. Any help would be much appreciated!

-- jmcglock
kubernetes
mysql

1 Answer

9/17/2021

Looks like the mysql version referenced is not compatible with this version of OKE. Updated the mysql version and it is working well.

-- jmcglock
Source: StackOverflow