Scott Stensland
Scott Stensland

Reputation: 28285

How to make a Google Compute Cloud app visible from a domain not just a raw IP address?

I have deployed an app using google compute cloud which is visible from a raw ephemeral IP address ... How to I link this ephemeral IP to my domain ?

To make this easier I registered the domain ( mydomain.org ) at Google Domains

I added a type A Record Set on my managed zone :

gcloud dns managed-zones describe  myzone


creationTime: '2016-03-28T23:05:31.385Z'
description: just another zone
dnsName: mydomain.org.
id: '2379583277824599330'
kind: dns#managedZone
name: myzone
nameServers:
- ns-cloud-e1.googledomains.com.
- ns-cloud-e2.googledomains.com.
- ns-cloud-e3.googledomains.com.
- ns-cloud-e4.googledomains.com.

from here you can see the raw IP (111.222.333.444) where the app is visible from

gcloud dns record-sets list  --zone myzone 

NAME                       TYPE  TTL  DATA
mydomain.org.  A     5    111.222.333.444
mydomain.org.  NS    6    ns-cloud-e1.googledomains.com., ns-cloud-e2.googledomains.com., ns-cloud-e3.googledomains.com., ns-cloud-e4.googledomains.com.
mydomain.org.  SOA   6    ns-cloud-e1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 1209600 300

yet when I do a

curl mydomain.org

it just responds with (similar from browser)

curl: (6) Could not resolve host: mydomain.org

yet using the raw IP it correctly connects to the cloud app

curl 111.222.333.444

here I show some command line DNS lookups

nslookup mydomain.org ns-cloud-e1.googledomains.com.

output

Server:     ns-cloud-e1.googledomains.com.
Address:    216.239.32.110#53

Name:   mydomain.org
Address: 111.222.333.444

What am I missing ? What is the gcloud dns command I am missing ? The process would be : deploy app to ephemeral IP -> issue unknown command to link this IP to domain ... I want to be able to issue this after each deploy (a fresh ephemeral IP) from my app still in development ... I do not want a Static IP

I deployed the app using command line tools gcloud and kubectl so its a Google Compute (IaaS) app not a Google App Engine (PaaS) app

I did the domain register a few days ago so the domain has propagated

Upvotes: 0

Views: 298

Answers (2)

Scott Stensland
Scott Stensland

Reputation: 28285

Here is the solution which works across hosting providers generally. It involves going back and forth between where you created your domain (Domain Registrar) and where you deploy your app :

  • create your domain at your Domain Registrar ... ignore its list of Name Servers ... you will be replacing the original list with a fresh LIST
  • wherever you deploy your app will supply ability to define some kind of DNS hosting zone ... create a new zone for your domain which will auto populate a fresh LIST of Name Servers ... copy this LIST
  • go back to your Domain Registrar and update its Name Servers for your domain (record type NS) with that LIST
  • deploy your app which will reveal a fresh new IP
  • get into the DNS hosting zone and update your Type A record with this new IP

Upvotes: 0

J D
J D

Reputation: 71

Since the Cloud DNS nameservers appear to be happy to resolve the domain, I'd double-check that Cloud DNS is actually set as the nameservers for your domain:

$ dig NS mydomain.org.

Upvotes: 1

Related Questions