<p>I use Google Cloud for deploy company app.</p>

<p>The goal: every branch deployed on some subdomain(example.com): task-123.example.com, etc.</p>

<p>I copy Cloud DNS namespace to the domain registrar. I pass the static IP address(via <code>kubernetes.io/ingress.global-static-ip-name: "test-static-ip"</code>) for Ingress and pass it to domain registrar to A record. But I can't understand how to make subdomain works.</p>

<p>Every branch creates Ingress with static IP, but with different URLs for the host.</p>

<p>I made CNAME *.example.com which refers to example.com, but its not works.</p>

<p>Help me, please. Sorry for my English.</p>

Serhii Koberniuk
<p>You want *.example.com to point to the ingress controller so branch1.example.com and branch2.example.com will both hit the ingress controller. This is achieved with wildcard DNS.</p>

<p>Each branch in your scenario should have its own routing rule (ingress resource) with a host section defined for its specific branch. The ingress controller is updated when a new ingress resource is created and its routing rules then reflect the additional rule. So creating a new branch with a new ingress resource for that host will tell the ingress controller to route traffic for that specific host to a Service specific to that branch. (Or you can define all the branch rules in one go with a fanout ingress - see <a href="https://stackoverflow.com/questions/52382658/ingress-nginx-create-one-ingress-per-host-or-combine-many-hosts-into-one-ingr/52382878#52382878">ingress-nginx - create one ingress per host? Or combine many hosts into one ingress and reload?</a> )</p>

<p>That's 'how it works'. I'm not sure if that is your question though? It's hard to diagnose the problem you're having. Presumably you have an Ingress, a Service and a Deployment? To help with that I think you'd need to post those and explain (either as an update or a separate question) what behaviour you see (a 404 maybe)?</p>
