connection to googles private apis endpoints (private service connect)

406 Views Asked by At

I am locking down our vpc and cluster in terms of ensuring no access to the internet and public endpoints, thus one of the things is the connection to the public endpoint for accessing googles apis so instead of accessing public, we should be accessing the private/restricted google api endpoint

I am using this module to create the dns, endpoint for private service connect and the endpoint seems to work, however, the actual routing/dns side doesn't work

https://github.com/terraform-google-modules/terraform-google-network/tree/v7.3.0/modules/private-service-connect

So when I run this command from a VM on the VPC with this setup, I get this error:

curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" "https://storage-endpoint1.p.googleapis.com/storage/v1/b?project=$(gcloud config get-value project)"
curl: (6) Could not resolve host: storage-endpoint1.p.googleapis.com
1

There are 1 best solutions below

2
Veera Nagireddy On

To overcome this error, you can follow this blog by ET digital team which explains below 2 methods clearly.

The error can occur due to several reasons, such as enabled IPv6, No DNS Nameserver, Syntax Problem or the website being temporarily unavailable.

Method 1: Disable IPv6 to fix the error

Method 2: Add Google DNS server

As per the github link which you are following, can you cross check the below points:

  1. Service Account running Terraform must have dns.managedZones.* permissions. You can add them by assigning the DNS Admin default role to the Service Account.

  2. Did you recently upgrade your development environment or operating system? Is there a firewall which could be updated?

Workaround 1 : Try updating cURL and rebooting the server (update your /etc/resolv.conf file by replacing with default and restart your system).

Workaround 2 : Private Service Connect for DNS follows the naming convention, SERVICE-ENDPOINT.p.googleapis.com. Follow Codelabs Private Service Connect for Google APIs example authored by Deepak Michael for more information.