将 CloudSQL 实例从 Public 转换为私有 IP

Converting CloudSQL instances from Public to Private IP

我们不能将具有 Public IPCloudSQL 实例转换为 Private IPPrivate IPSharedVPC 上使用 Private service Connection 分配。

我失败了,错误如下

   $ gcloud --project=<project id> beta sql instances patch test1-instance --network=https://www.googleapis.com/compute/alpha/projects/<SharedVPC Host Project>/global/networks/kube-shared-vpc                                                                                                                         
   The following message will be used for the patch API method.
   {"name": "test1-instance", "project": "<project-id>", "settings": {"ipConfiguration": {"privateNetwork": "https://www.googleapis.com/compute/alpha/projects/<SharedVPC Host Project>/global/networks/kube-shared-vpc"}}}

   ERROR: (gcloud.beta.sql.instances.patch) HTTPError 400: This operation is not valid for this instance.

如果 private IPCloudSQL instances 在同一个网络上,它可以工作,但是当从 SharedVPC 分配私有 IP 时,它不工作

无法在这个问题上启用 Private IP on existing Cloud SQL instance when trying to attach the instance to a Shared-VPC and there is PIT 作为功能请求来启用它。当前的解决方法是在创建时启用 Cloud SQL 实例上的私有 IP。