title: Is there a way to get a domain for GKE loadbalancer instead of an ip?
body: <p><strong>Edit</strong> : I'm working on a project that deploys on GKE several projects a day in a 100% automatic way. Our project is developed in nodejs, here is a pseudo code:</p>
  
  <pre><code>projects = get_all_projects_today() // returns 15 projects for today (for example)
  
  for project in projects
      deploy_to_GKE(project) //generate a deployment manifest for project and post it to GKE (using api call)
      public_ip = create_service_on_GKE(project, type=Loadbalancer) //generate a service manifest (type loadbalancer) for project, post it to GKE (using api call) and returns the public created ip address
      get_domain_from_ip(public_ip) //how to do this !
  </code></pre>
  
  <p>deployed projects must be accessible via domain names and not ip like this for example :</p>
  
  <pre><code>appx.mysite.com, or
  mysite.com/appx
  </code></pre>
  
  <p><strong>End Edit</strong></p>
  
  <p>Here is an example of service manifest that i use :</p>
  
  <pre><code>{
      "kind": "Service",
      "apiVersion": "v1",
      "metadata": {
          "name": "backend-__ID__"
      },
      "spec": {
          "selector": {
              "app": "backend-__ID__"
          },
          "type": "LoadBalancer",
          "ports": [
              {
                  "name": "app1",
                  "protocol": "TCP",
                  "port": 8080,
                  "targetPort": "8080"
              },
              {
                  "name": "app2",
                  "protocol": "TCP",
                  "port": "3010",
                  "targetPort": "3010"
              }
          ]
      }
  }
  </code></pre>
  
  <p>which gives me this result on google cloud :
  <a href="https://i.stack.imgur.com/KILPW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KILPW.png" alt="enter image description here"></a></p>
  
  <p>The only way to access the project from outside is to use the ip address (Endpoint), but this blocks the use of cookies (we can not set cookies on ip, we should use a domain name).</p>
  
  <p>So is there a way to get, automatically, from GKE  named domains for Endpoints to access the projet from outside ?</p>
  
  <p>i tried using reverse DNS lookup to get a domain name for the external ip but that did not work :(</p>
  
  <p>Thank you</p>