<p>I am new at google kubernetes engine. So I am createing a new cluster. And deploying a sample application on this cluster. And I can access it using an ip address like <code>30.31.32.33/api</code>
So I want to use my domain name (<code>mydomain.com or subdomain products.mydomain.com</code>) for this app</p>
<ol>
<li>Should I set nameserver of domain to ip address <code>30.31.32.33/api</code> . Dose this ip address change if recreate the cluster?</li>
<li>If I want publish a new app on same cluster with different domain, what can I do?</li>
</ol>

barteloma
<p>You'll want to use a static IP in order to ensure that the IP does not change.
There is a good tutorial on this <a href="https://cloud.google.com/kubernetes-engine/docs/tutorials/configuring-domain-name-static-ip" rel="nofollow noreferrer">here</a>.</p>
<p>The high level steps:</p>
<ol>
<li><p><a href="https://cloud.google.com/kubernetes-engine/docs/tutorials/configuring-domain-name-static-ip" rel="nofollow noreferrer">Reserve a global static external IP address</a></p>
<pre><code> gcloud compute addresses create $ADDRESS_NAME \
 --global \
 --ip-version IPV4
</code></pre>
</li>
<li><p>Create the DNS A record mapping your FQDN to that IP address</p>
</li>
<li><p>Use the <code>kubernetes.io/ingress.global-static-ip-name</code> annotation in your Ingress:</p>
<pre><code> apiVersion: networking.k8s.io/v1
 kind: Ingress
 metadata:
   name: myapp
   annotations:
     kubernetes.io/ingress.global-static-ip-name: $ADDRESS_NAME
   labels:
   app: myapp
 spec:
   rules:
   - host: &quot;products.mydomain.com&quot;
     http:
       paths:
         - path: /*
           pathType: ImplementationSpecific
           backend:
             service:
               name: products-service
               port:
               number: 8080
</code></pre>
</li>
</ol>
<ol start="4">
<li><p>If you want to publish more apps, if they are in separate namespace then just repeat steps 1-3 above for each app.  If you deploy all of the apps in the same namespace, then you can create additional DNS A records for each app and point them to the same IP created in step 1 and then modify the Ingress in step 3 above:</p>
<pre><code> apiVersion: networking.k8s.io/v1
 kind: Ingress
 metadata:
   name: myapp
   annotations:
     kubernetes.io/ingress.global-static-ip-name: $ADDRESS_NAME
   labels:
   app: myapp
 spec:
   rules:
   - host: &quot;products.mydomain.com&quot;
     http:
       paths:
         - path: /*
           pathType: ImplementationSpecific
           backend:
             service:
               name: products-service
               port:
               number: 8080
   - host: &quot;app2.mydomain.com&quot;
     http:
       paths:
         - path: /*
           pathType: ImplementationSpecific
           backend:
             service:
               name: app2-service
               port:
               number: 8080
</code></pre>
</li>
</ol>
