<p>I want to know when the master nodes want to connect the etcd cluster, which etcd node will be selected?does the master node always connects the same etcd node untill it becomes unavailable?does each node in master cluster will connect the same node in etcd cluster?</p>

<p>The scheduler and controller-manager talk to the API server present on the same node. In a HA setup you'll have only one of them running at a time (based on a lease) and whoever is the current active will be talking to the local API server. If for some reason it fails to connect to the local API server, it doesn't renew the lease and another leader will be elected.</p>

<p>As described only one API server will be the leader at any given moment so that's the only place that needs to worry about reaching the etcd cluster. As for the etcd cluster itself, when you configure the kubernetes API server you pass it the <code>etcd-servers</code> flag, which is a list of etcd nodes like: </p>

<pre><code>--etcd-servers=https://10.240.0.10:2379,https://10.240.0.11:2379,https://10.240.0.12:2379
</code></pre>

<p>This is then passed the Go <a href="https://github.com/coreos/etcd/tree/master/client" rel="nofollow noreferrer">etcd/client library</a> which, looking at it's README states:</p>

<blockquote>
  <p>etcd/client does round-robin rotation on other available endpoints if the preferred endpoint isn't functioning properly. For example, if the member that etcd/client connects to is hard killed, etcd/client will fail on the first attempt with the killed member, and succeed on the second attempt with another member. If it fails to talk to all available endpoints, it will return all errors happened.</p>
</blockquote>

<p>Which means that it'll try each of the available nodes until it succeeds connecting to one.</p>
