code: func NewFromCluster(client clientset.Interface, certificatesDir string) (*Client, error) {
  	// etcd is listening the API server advertise address on each control-plane node
  	// so it is necessary to get the list of endpoints from kubeadm cluster status before connecting
  
  	// Gets the cluster status
  	clusterStatus, err := config.GetClusterStatus(client)
  	if err != nil {
  		return nil, err
  	}
  
  	// Get the list of etcd endpoints from cluster status
  	endpoints := []string{}
  	for _, e := range clusterStatus.APIEndpoints {
  		endpoints = append(endpoints, GetClientURLByIP(e.AdvertiseAddress))
  	}
  	klog.V(1).Infof("etcd endpoints read from pods: %s", strings.Join(endpoints, ","))
  
  	// Creates an etcd client
  	etcdClient, err := New(
  		endpoints,
  		filepath.Join(certificatesDir, constants.EtcdCACertName),
  		filepath.Join(certificatesDir, constants.EtcdHealthcheckClientCertName),
  		filepath.Join(certificatesDir, constants.EtcdHealthcheckClientKeyName),
  	)
  	if err != nil {
  		return nil, errors.Wrapf(err, "error creating etcd client for %v endpoints", endpoints)
  	}
  
  	// synchronizes client's endpoints with the known endpoints from the etcd membership.
  	err = etcdClient.Sync()
  	if err != nil {
  		return nil, errors.Wrap(err, "error syncing endpoints with etc")
  	}
  	klog.V(1).Infof("update etcd endpoints: %s", strings.Join(etcdClient.Endpoints, ","))
  
  	return etcdClient, nil
  }
docs: // NewFromCluster creates an etcd client for the etcd endpoints defined in the ClusterStatus value stored in
  // the kubeadm-config ConfigMap in kube-system namespace.
  // Once created, the client synchronizes client's endpoints with the known endpoints from the etcd membership API (reality check).