本文介绍了私有GKE与Cloud SQL之间的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有公共主节点的私有GKE集群,该集群具有需要访问Cloud SQL的作业.我在3307上接收到一个云SQL代理DaemonSet,它在3306上连接到实际的数据库.

I have a Private GKE Cluster with a public master endpoint, which has jobs that needs access Cloud SQL. I have a cloud SQL proxy DaemonSet receiving on 3307, which connects to actual DB on 3306.

我的网络没有出站互联网,也没有添加任何防火墙规则.我在云SQL代理上遇到以下错误.解决此问题的任何帮助或有关如何在私有GKE和Cloud SQL之间建立连接的指南?

My network doesn't have outbound internet, neither any firewalls rules added.I get below error on my cloud SQL proxy. Any help on resolving this or guide on how to establish a connection between private GKE and Cloud SQL ?

推荐答案

云SQL代理使用数据库公共IP进行连接,并且由于您的群集是私有的,无法从节点访问Internet,因此我相信不可能达到这种目的.您可以尝试为SQL实例使用私有IP:

The cloud SQL proxy uses database public IP to connect and as your cluster is private with no internet access from nodes I believe it is impossible to reach it like that. You could try using private IP for your SQL instance:

https://cloud.google.com/sql/docs/mysql/private-ip

或为群集配置NAT网关:

or conifguring the NAT gateway for your cluster:

https://cloud.google.com/solutions/使用带有Kubernetes引擎的nat网关

这篇关于私有GKE与Cloud SQL之间的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 03:03