<p>I deployed <a href="https://www.consul.io/" rel="nofollow noreferrer">Consul</a> server using the <a href="https://www.consul.io/docs/platform/k8s/helm.html" rel="nofollow noreferrer">Helm chart</a> giving me a three node cluster. I could view the IP addresses and IDs of the nodes:</p>

<pre><code>$ consul catalog nodes
Node             ID        Address     DC
consul-server-0  065ab1e4  10.60.1.11  dc1
consul-server-1  46eca681  10.60.0.16  dc1
consul-server-2  fb5fa37d  10.60.2.8   dc1
</code></pre>

<p>As a test I force deleted all three of these nodes as follows:</p>

<pre><code>kubectl delete pods -n consul --force --grace-period=0 consul-server-0 consul-server-1 consul-server-2
</code></pre>

<p>Three new pods came up with different IPs but the same IDs, joined the cluster and achieved consensus again:</p>

<pre><code>$ consul catalog nodes
Node             ID        Address     DC
consul-server-0  065ab1e4  10.60.1.12  dc1
consul-server-1  46eca681  10.60.2.9   dc1
consul-server-2  fb5fa37d  10.60.0.17  dc1
</code></pre>

<p>What does Consul rely on to recover from this situation? Can it form quorum again since the IDs are the same and then work out between them that the IPs have changed? Or is the names of the nodes staying consistent also a requirement for automatic recovery?</p>

<p>I see log messages such as:</p>

<pre><code>consul: removed server with duplicate ID: 46eca681-b5d6-21e7-3df5-cf228ffdd02c
</code></pre>

<p>So it seems the changing IP address is causing a new node to be added to the cluster but then Consul works out that it needs to be removed. Because of this I would expect there to be 6 nodes at one point with 3 unavailable causing the cluster to lose quorum and not be able to recover automatically, but this does not happen.</p>

dippynark
<p>We also run consul in docker swarm and recovery after failure is not a trivial problem. Because failed server recreate in a new container, obviously, with different IP. Consul spring a lot of errors and messages about raft. But I did not see a serious problem with it. I just filter this kind of logs and not translate to long live indexes in elasticsearch.</p>

<p>We use the next config for a faster server recovery:</p>

<pre><code>{
  "skip_leave_on_interrupt" : true,
  "leave_on_terminate" : true,
  "disable_update_check": true,
  "autopilot" : {
    "cleanup_dead_servers": true,
    "last_contact_threshold": "1s"
  }
}
</code></pre>

<p>You can review parameters <a href="https://www.consul.io/docs/agent/options.html" rel="nofollow noreferrer">here</a></p>
