Den*_*tin 5 mysql localhost kubernetes minikube
我正在尝试从 minikube 容器访问本地 MySQL 数据库。我的 minikube 可在带有 hyper-v 驱动程序的 Windows 10 上运行。我找到了一些解决方案(从 VirtualBox 创建仅主机网络),但没有找到适用于 hyper-v 的解决方案。有人可以帮助我如何从 minikube hyper-v 连接到 localhost mysql 服务器吗?
小智 1
首先您需要创建一个Service,然后Endpoint 使用您的 MySQL 的 IP 创建一个。
apiVersion: v1
kind: Service
metadata:
name: database
spec:
ports:
- port: 3306
targetPort: 3306
protocol: TCP
---
# Because this service has no selector, the corresponding Endpoints
# object will not be created. You can manually map the service to
# your own specific endpoints:
kind: Endpoints
apiVersion: v1
metadata:
name: database
subsets:
- addresses:
- ip: "23.99.34.75"
ports:
- port: 3306
Run Code Online (Sandbox Code Playgroud)
您也可以检查这个问题Connect to local database from inside minikube cluster。