<p>I'm setting up an InnoDB Cluster using <code>mysqlsh</code>. This is in Kubernetes, but I think this question applies more generally.</p>
<p>When I use <code>cluster.configureInstance()</code> I see messages that includes:</p>
<blockquote>
<p>This instance reports its own address as node-2:3306</p>
</blockquote>
<p>However, the nodes can only find <em>each other</em> through DNS at an address like <code>node-2.cluster:3306</code>. The problem comes when adding instances to the cluster; they try to find the other nodes without the qualified name. Errors are of the form:</p>
<pre><code>[GCS] Error on opening a connection to peer node node-0:33061 when joining a group. My local port is: 33061.
</code></pre>
<p>It is using <code>node-n:33061</code> rather than <code>node-n.cluster:33061</code>.</p>
<p>If it matters, the &quot;DNS&quot; is set up as a headless service in Kubernetes that provides consistent addresses as pods come and go. It's very simple, and I named it &quot;cluster&quot; to created addresses of the form <code>node-n.cluster</code>. I don't want to cloud this question with detail I don't think matters, however, as surely other configurations require the instances in the cluster to use DNS as well.</p>
<p>I thought that setting <code>localAddress</code> when creating the cluster and adding the nodes would solve the problem. Indeed, after I added that to the <code>createCluster</code> options, I can look in the database and see</p>
<pre><code>| group_replication_local_address                     | node-0.cluster:33061                 |
</code></pre>
<p>After I create the cluster and look at the topology, it seems that the local address setting has no effect whatsoever:</p>
<pre><code>{
    &quot;clusterName&quot;: &quot;mycluster&quot;, 
    &quot;defaultReplicaSet&quot;: {
        &quot;name&quot;: &quot;default&quot;, 
        &quot;primary&quot;: &quot;node-0:3306&quot;, 
        &quot;ssl&quot;: &quot;REQUIRED&quot;, 
        &quot;status&quot;: &quot;OK_NO_TOLERANCE&quot;, 
        &quot;statusText&quot;: &quot;Cluster is NOT tolerant to any failures.&quot;, 
        &quot;topology&quot;: {
            &quot;node-0:3306&quot;: {
                &quot;address&quot;: &quot;node-0:3306&quot;, 
                &quot;memberRole&quot;: &quot;PRIMARY&quot;, 
                &quot;mode&quot;: &quot;R/W&quot;, 
                &quot;readReplicas&quot;: {}, 
                &quot;replicationLag&quot;: null, 
                &quot;role&quot;: &quot;HA&quot;, 
                &quot;status&quot;: &quot;ONLINE&quot;, 
                &quot;version&quot;: &quot;8.0.29&quot;
            }
        }, 
        &quot;topologyMode&quot;: &quot;Single-Primary&quot;
    }, 
    &quot;groupInformationSourceMember&quot;: &quot;node-0:3306&quot;
}
</code></pre>
<p>And adding more instances continues to fail with the same communication errors.</p>
<p>How do I convince each instance that the address it needs to advertise is different? I will try other permutations of the <code>localAddress</code> setting, but it doesn't look like it's intended to fix the problem I'm having. How do I reconcile the address the instance reports for itself with the address that's actually useful for other instances to find it?</p>
<p>Edit to add: Maybe it is a Kubernetes thing? Or a Docker thing at any rate. There is an environment variable set in the container:</p>
<pre><code>HOSTNAME=node-0
</code></pre>
<p>Does the containerized MySQL use that? If so, how do I override it?</p>

Jerry
<p>Apparently this value has to be set at startup. The option for my setup was</p>
<pre><code>--report-host=${HOSTNAME}.cluster
</code></pre>
<p>when starting the MySQL instances resolved the issue.</p>
<p>Specifically for Kubernetes, an example is at <a href="https://github.com/adamelliotfields/kubernetes/blob/master/mysql/mysql.yaml" rel="nofollow noreferrer">https://github.com/adamelliotfields/kubernetes/blob/master/mysql/mysql.yaml</a></p>
