<p>I'm not able to get a custom domain record working with an openshift cluster. I've read tons of articles, StackOverflow posts, and this youtube video <a href="https://www.youtube.com/watch?v=Y7syr9d5yrg" rel="nofollow noreferrer">https://www.youtube.com/watch?v=Y7syr9d5yrg</a>. All seem to &quot;almost&quot; be usefull for me, but there is always something missing and I'm not able to get this working by myself.</p>
<p>The scenario is as follows. I've got an openshift cluster deployed on an IBM Cloud account. I've registered <strong>myinnovx.com</strong>. I want to use it with an openshift app. Cluster details:</p>
<pre><code>oc v3.11.0+0cbc58b
kubernetes v1.11.0+d4cacc0
openshift v3.11.146
kubernetes v1.11.0+d4cacc0
</code></pre>
<p>I've got an application deployed with a blue/green strategy. In the following screenshot, you can see the routes I've available.</p>
<p><a href="https://i.stack.imgur.com/TcZRZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TcZRZ.png" alt="routes screenshot" /></a></p>
<blockquote>
<p>mobile-blue: I created this one manually pointing to my custom domain <strong>mobileoffice.myinnovx.com</strong></p>
<p>mobile-office: Created with <code>oc expose service mobile-office --name=mobile-blue</code> to use external access.</p>
<p>mobile-green: Openshift automatically generated a route for the green app version. (Source2Image deployment)</p>
<p>mobile-blue: Openshift automatically generated a route for the blue app version. (Source2Image deployment)</p>
</blockquote>
<p>I've set up a two CNAME record on my DNS edit page as follows:</p>
<p><a href="https://i.stack.imgur.com/JTzXV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JTzXV.png" alt="enter image description here" /></a></p>
<p>In several blogs/articles, I've found that I'm supposed to point my wildcard record to the router route canonical name. But I don't have any route canonical name in my cluster. I don't even have an Ingress route configured.</p>
<p>I'm at a loss here as to what I'm missing. Any help is greatly appreciated.
This is the response I get testing my DNS:</p>
<p><a href="https://i.stack.imgur.com/DpezY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DpezY.png" alt="enter image description here" /></a></p>
<p>This is a current export of my DNS:</p>
<pre><code>$ORIGIN myinnovx.com.
$TTL 86400
@ IN SOA ns1.softlayer.com. msalimbe.ar.ibm.com. (
                       2019102317        ; Serial
                       7200              ; Refresh
                       600               ; Retry
                       1728000           ; Expire
                       3600)             ; Minimum

@                      86400    IN NS    ns1.softlayer.com.
@                      86400    IN NS    ns2.softlayer.com.


*.myinnovx.com         900      IN CNAME .mycluster-342148-26562a7d6831df3dfa02975385757d2d-0001.us-south.containers.appdomain.cloud.
mobileoffice           900      IN CNAME mobile-office-mobile-office.mycluster-342148-26562a7d6831df3dfa02975385757d2d-0001.us-south.containers.appdomain.cloud
mobile-test.myinnovx.com 900      IN A     169.63.244.76
</code></pre>

<p>Most of what I'm about to say only applies to OpenShift 3.x. In OpenShift 4.x things are sufficiently different that most of the below doesn't quite apply.</p>

<p>By default OpenShift 3.11 exposes applications via Red Hat's custom HAProxy Ingress Controller (colloquially known as the "Router"). The typical design in a OpenShft 3.x cluster is to designate particular cluster hosts for running cluster infrastructure workloads like the HAProxy router and the internal OpenShift registry (usually using the <a href="https://docs.openshift.com/container-platform/3.11/install/example_inventories.html#multi-masters-single-etcd-using-native-ha" rel="nofollow noreferrer">node-role.kubernetes.io/infra=true</a> node labels).</p>

<p>For convenience purposes so admins don't have to manually create a DNS record for each exposed OpenShift application, there is a wildcard DNS entry that points to the load balancer associated with the HAProxy Router. The DNS name of this is configured in the <a href="https://docs.openshift.com/container-platform/3.11/install/configuring_inventory_file.html#advanced-install-configuring-docker-route" rel="nofollow noreferrer">openshift_master_default_subdomain</a> of the ansible inventory file used to do your cluster installation.</p>

<p>The structure of this record is generally something like <code>*.apps.&lt;cluster name&gt;.&lt;dns subdomain&gt;</code>, but it can be anything you like.</p>

<p>If you want to have a prettier DNS name for your applications you can do a couple things. </p>

<p>The first is to create a DNS entry <code>myapp.example.com</code> pointing to your load balancer and have your load balancer configured to forward those requests to the cluster hosts where the HAProxy Router is running on port 80/443. You can then configure your application's <a href="https://docs.openshift.com/container-platform/3.11/dev_guide/routes.html" rel="nofollow noreferrer">Route</a> object to use hostname <code>myapp.example.com</code> instead of the default <code>&lt;app name&gt;-&lt;project name&gt;.apps.&lt;cluster name&gt;.&lt;dns subdomain&gt;</code>.</p>

<p>Another method would be to do what your suggesting and let the application use the default wildcard route name, but create a DNS CNAME pointing to the original wildcard route name. For example if my <code>openshift_master_default_subdomain</code> is <code>apps.openshift-dev.example.com</code> and my application route is <code>myapp-myproject.apps.openshift-dev.example.com</code> then I could create a CNAME DNS record <code>myapp.example.com</code> pointing to <code>myapp-myproject.apps.openshift-dev.example.com</code>.</p>

<p>The key thing that makes either of the above work is that the HAProxy router doesn't care what the hostname of the request is. All its going to do is match the Host header (SNI must be set in the case of TLS requests and the HAProxy router configured for pass through) of the incoming request against all of Route objects in the cluster and see if any of them match. So if your DNS/Load Balancer configuration is setup to bring requests to the HAProxy Router and the Host header matches a Route, that request will get forwarded to the appropriate OpenShift service.</p>

<p>In your case I don't think you have the CNAME pointed at the right place. You need to point your CNAME at the wildcard hostname your application Route is using.</p>
