I am using a Google Cloud DNS Managed Private Zone, which is unable to be resolved by Compute instances that are within the network permitted by the zone. I am using two Ubuntu 18.04 LTS standard images. The two instances are on two different subnetworks of the same network, which has been permitted to see the Private zone.
I am using GCloud CLI, and I am signed in and verified through gcloud init with a project selected that I am the Owner for.
I have tried adjusting /etc/resolv.conf to point to the metadata server specifically, however this simply stopped resolution altogether. I was originally using A records in the private zone which didn't work; based on this article https://www.jhanley.com/google-cloud-private-dns-zones/ I tried using CNAME for the [INSTANCE_NAME].[ZONE].c.[PROJECT].internal domain which also didn't work.
The setup I am doing is through GCloud CLI and is as follows:
#!/bin/bash
# gcloud init or gcloud auth activate-service-account must have been previously run
CUSTOMER=test
NETWORK=testnetwork
# configure Cloud DNS - create customer.workshop.local
gcloud dns managed-zones create "${CUSTOMER}internal" \
--dns-name="${CUSTOMER}.workshop.local" --description="A zone" \
--visibility=private --networks="$NETWORK"
# IP is derived through a gcloud compute call but presume it is:
IP=10.10.0.4
gcloud dns record-sets transaction start --zone="${CUSTOMER}internal"
gcloud dns record-sets transaction add "$IP" \
--name="server.${CUSTOMER}.workshop.local." \
--ttl=300 \
--type=A \
--zone="${CUSTOMER}internal"
gcloud dns record-sets transaction execute --zone="${CUSTOMER}internal"
When pinging from my Ubuntu 18.04 LTS machine in a subnetwork 10.10.1.0/24, I get:
david.alexander@jump-ubuntu-01:~$ ping server.test.workshop.local
ping: server.test.workshop.local: Temporary failure in name resolution
Has anyone got any ideas? Cheers!