I'm trying to connect my node.js backend to a Cloud SQL on the same project, following many tutorials and documentation, but without success.
Here my service and endpoint config:
kind: Service
apiVersion: v1
metadata:
name: mysql-service
spec:
type: ClusterIP
ports:
- protocol: TCP
port: 3306
targetPort: 3306
---
kind: Endpoints
apiVersion: v1
metadata:
name: mysql-service
subsets:
- addresses:
- ip: 10.78.176.3
ports:
- port: 3306
I got on my node.js side:
process.DB_HOST 10.78.176.3
process.DB_DATABASE marketplace_test
MySQL Connection pool error
connect ETIMEDOUT
I already tried to connect over the public and the private IP, over the 'mysql-service' name, but nothing worked.
Could it be some relation I'm missing, like a matchLabels? Should I match the service+endpoint+deployment? How?
Must I use a proxy for that?
What I'm missing?
Thanks for all help!
curl -v 10.78.176.3:3306show that it can connect. It connected. Running from instance ssh.. what can happen?