I am running some services in minikube and trying to connect to mysql running on localhost(127.0.0.1) on 3306 port.
I read this and trying to create service
and Endpoints
. However, when I specify 127.0.0.1
as IP, it throws error as below:
The Endpoints "mysql-service" is invalid: subsets[0].addresses[0].ip: Invalid value: "127.0.0.1": may not be in the loopback range (127.0.0.0/8)
my deployment is like below:
---
apiVersion: v1
kind: Service
metadata:
name: mysql-service
spec:
ports:
- protocol: TCP
port: 1443
targetPort: mysql
---
apiVersion: v1
kind: Endpoints
metadata:
name: mysql-service
subsets:
- addresses:
- ip: 127.0.0.1
ports:
- name: mysql
port: 3306
Please assist me to understand how can I connect to mysql
db from minikube
.
I have also tried replacing 127.0.0.1
with public IP of my computer(Don't know why though) and connection was timed out.
Any help or guide towards right direction is appreciated.
According to minikube's document, you can use host.minikube.internal
to access your localhost
if your minikube's
version is higher than v1.10
. you can use minikube ssh
to confirm connectivity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With