<p>I am just starting out with <code>kubernetes</code>. I have created a simple app which is working fine with the external IP address. It's a <code>mongodb-express</code> with <code>mongo-db</code> backend. I am trying to get a domain name mapped to it, instead of the IP address.</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: mongo-express
  labels:
    app: mongo-express
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mongo-express
  template:
    metadata:
      labels:
        app: mongo-express
    spec:
      containers:
      - name: mongo-express
        image: mongo-express
        ports:
        - containerPort: 8081
        env:
        - name: ME_CONFIG_MONGODB_ADMINUSERNAME
          etc
---
apiVersion: v1
kind: Service
metadata:
  name: mongo-express-service
spec:
  selector:
    app: mongo-express
  type: LoadBalancer  
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8081
      
</code></pre>
<p>This was a walk in the park with AWS. Simply created a zone and added the name servers to the domain name provider, however in GCP this does not work. I have created a zone in cloudDNS but cannot seem to map it to the cluster. The documentation is a bit complex for me to understand. Can someone help?</p>
<pre><code>kubernetes              ClusterIP      10.28.0.1     &lt;none&gt;         443/TCP        51m
mongo-express-service   LoadBalancer   10.28.7.249   34.69.73.210   80:30055/TCP   42m
mongodb-service         ClusterIP      10.28.1.163   &lt;none&gt;         27017/TCP      45m
</code></pre>

<p><strong>Cloud DNS</strong> config is the same as the <strong>route53</strong> configuration. You can add the <strong>CName</strong> record or <strong>A</strong> record as per requirement.</p>
<p>For a simple use case, you can follow this document which is regarding adding static IP to DNS and mapping the domain.</p>
<p>As you have already exposed the service with type <strong>LoadBalancer</strong> you can follow from here</p>
<p><a href="https://cloud.google.com/kubernetes-engine/docs/tutorials/configuring-domain-name-static-ip#configuring_your_domain_name_records" rel="nofollow noreferrer">https://cloud.google.com/kubernetes-engine/docs/tutorials/configuring-domain-name-static-ip#configuring_your_domain_name_records</a></p>
<p>Make sure your Nameserver are set correctly</p>
<blockquote>
<p>If your nameserver is Cloud DNS: Follow Cloud DNS Quickstart guide to
configure DNS A record for your domain name with the reserved IP
address of your application.</p>
<p>If your nameserver is another provider: Refer to your DNS service's
documentation on setting DNS A records to configure your domain name.
If you choose to use Cloud DNS instead, refer to Migrating to Cloud
DNS.</p>
</blockquote>
<p><strong>Extra</strong> :</p>
<p>You can also use the external DNS to auto add the <strong>ingress</strong> records to Cloud DNS.</p>
<p>Example : <a href="https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/gke.md" rel="nofollow noreferrer">https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/gke.md</a></p>
