I'm trying to create an AlloyDB instance using the gcloud CLI using these commands:
gcloud alloydb clusters create default \
--region=$LOCATION \
--password=postgres
gcloud alloydb instances create default \
--cluster=default \
--region=$LOCATION \
--cpu-count=2 \
--instance-type=PRIMARY
The first command succeeds, but the second fails with:
service networking config validation failed NETWORK_NOT_PEERED - no peering found on network, see https://cloud.google.com/alloydb/docs/configure-connectivity for details
I believe I have to manually configure the peering network but I can't understand how? If I add the --enable-private-service-connect
flag the instance is successfully created but then I'm unable to reach it from my GKE cluster, and I see the AlloyDB cluster has an empty "Network" entry.
I managed to create the instance with these commands:
gcloud alloydb clusters create default \
--region=$LOCATION \
--password=postgres \
--network=default
gcloud compute addresses create servicenetworking-googleapis-com \
--global \
--purpose=VPC_PEERING \
--addresses=192.168.0.0 \
--prefix-length=16 \
--network=default
gcloud services vpc-peerings connect \
--service=servicenetworking.googleapis.com \
--ranges=servicenetworking-googleapis-com \
--network=default
gcloud alloydb instances create default \
--cluster=default \
--region=$LOCATION \
--cpu-count=2 \
--instance-type=PRIMARY