0

I'm running a service called Keycloak in Minikube for Development purposes and want to connect MySQL Database which is running on my Local Computer.

I am able to access my database by port forwarding local->localhost:3306 with user details but not from minikube.

Using this to my keylock YAML service - jdbc:mysql://mysqldb/database

But can't access it from minikube.

I have created one service also for connection.

apiVersion: v1
metadata:
  name: mysqldb
spec:
  ports:
  - port: 3306
    targetPort: 3306
---
kind: Endpoints
apiVersion: v1
metadata:
  name: mysqldb
subsets:
- addresses:
  - ip: <What should I place here?>
  ports:
  - port: 3306
~                                                                                                                                                                                                           
~                                                                                                                                                                                                           
~                                                                                                                                                                                                           
~

In Ip: I have tried to place my local system IP, localhost, etc. but none worked.

Laurent Lyaudet
  • 630
  • 8
  • 16
krishan
  • 47
  • 2
  • 8

1 Answers1

0

From minikube's documentation:

To make it easier to access your host, minikube v1.10 adds a hostname entry host.minikube.internal to /etc/hosts. The IP which host.minikube.internal resolves to is different across drivers, and may be different across clusters.

I.e. try host.minikube.internal instead of localhost and see if that helps.

Reference: https://minikube.sigs.k8s.io/docs/handbook/host-access/#hostminikubeinternal