This is something I was able to do last week. I need to have a private IP address. I’m connecting my database to a K8S cluster, and so I have a VPC network already set up. Last week, I was able to select the network, jump through a few steps, and it allowed me to have a private IP for my database. This week, I get perpetually:
Incorrect service networking config: Incorrect service networking config: Reserved range: ‘vpc-name-ip-range’ not found for consumer project: ‘187692289864’ network: ‘vpc-name’.
I’m able to create the database when I don’t specify a private IP (still initializing so I cannot tell whether I can add a private IP after the fact).
The VPN I created was with just all the defaults, nothing fancy.
The error message Reserved range: 'vpc-name-ip-range' not found for consumer project: '187692289864' network: 'vpc-name' indicates that the Cloud SQL service does not have access to the IP range vpc-name-ip-range in the VPC network vpc-name. This can happen for a few reasons:
The IP range is not allocated to the VPC network.
The IP range is allocated to the VPC network, but the Cloud SQL service does not have a private service connection to the VPC network.
The IP range is allocated to the VPC network, and the Cloud SQL service has a private service connection to the VPC network,but the IP range is not reserved for Cloud SQL.
To resolve this error, you can try the following:
Make sure that the IP range vpc-name-ip-range is allocated to the VPC network vpc-name.
Make sure that the Cloud SQL service has a private service connection to the VPC network vpc-name.
Make sure that the IP range vpc-name-ip-range is reserved for Cloud SQL.
To check if the IP range vpc-name-ip-range is allocated to the VPC network vpc-name, you can go to the VPC networks page in the Google Cloud console and select the Allocated IP ranges tab.
To check if the Cloud SQL service has a private service connection to the VPC network vpc-name, you can go to the Cloud SQL page in the Google Cloud console and select the Instances tab. Then, select the instance that you are trying to create and click the Connections tab.
To reserve the IP range vpc-name-ip-range for Cloud SQL, you can go to the Cloud SQL page in the Google Cloud console and select the Instances tab. Then, select the instance that you are trying to create and click the Settings tab. In the Reserved IP range section, select the Reserve IP range checkbox and select the IP range vpc-name-ip-range.
If you are still having trouble creating a Cloud SQL instance with a private IP, you can contact Google Cloud support for assistance.
Adding a private IP to an existing Cloud SQL instance
Once you have created a Cloud SQL instance without a private IP, you can add a private IP to it by following these steps:
Go to the Cloud SQL page in the Google Cloud console and select the Instances tab.
Select the instance that you want to add a private IP to and click the Edit button.
In the Connections section, select the Private IP checkbox.
Select the VPC network and IP range that you want to use for the private IP.
Click the Save button.
Troubleshooting
If you are still having trouble creating a Cloud SQL instance with a private IP, you can try the following:
Make sure that you are using the correct VPC network and IP range.
Make sure that the Cloud SQL service has a private service connection to the VPC network.
Make sure that the IP range is reserved for Cloud SQL.
Try creating the Cloud SQL instance from the command line instead of the console.
Unlike before under allocated IP range, I was able to find my new IP range, I selected it.
However, on creation, I still get an error message saying it cannot find the IP range with the name hfc-xecm-ip-range, even though I explicitly set it to something other than this. Is there a glitch in the console UI?
The error message you’re receiving indicates a mismatch between the IP range you’ve set and what the system is expecting or looking for.
Here’s a step-by-step approach to address the issue:
Verify the Allocated IP Range:
Navigate to the VPC networks page in the Google Cloud console.
Choose the VPC network you’re working with.
Go to the “Private service connection” tab and then the “Allocated IP ranges for services” tab.
Ensure that the IP range “my-db-ip-range” is listed here. If not, you’ll need to allocate it.
Establish a Private Connection:
Still under the “Private service connection” tab, switch to the “Private connections to services” tab.
Create a connection between your VPC network and the Cloud SQL service. Ensure that the allocated IP range is associated with this connection.
Check for Naming Discrepancies:
It’s possible that there might be a naming discrepancy causing the system to look for “hfc-xecm-ip-range” instead of “my-db-ip-range”. Double-check any scripts, configurations, or templates you might have used during the setup.
Console Glitch:
Sometimes, caching or UI glitches can cause unexpected behaviors in cloud consoles. Consider logging out, clearing your browser cache, and logging back in. Alternatively, try using a different browser or the gcloud command-line tool to set up the private IP.