code: func WriteKubeConfigWithToken(out io.Writer, cfg *kubeadmapi.InitConfiguration, clientName, token string) error {
  
  	// creates the KubeConfigSpecs, actualized for the current InitConfiguration
  	caCert, _, err := pkiutil.TryLoadCertAndKeyFromDisk(cfg.CertificatesDir, kubeadmconstants.CACertAndKeyBaseName)
  	if err != nil {
  		return errors.Wrap(err, "couldn't create a kubeconfig; the CA files couldn't be loaded")
  	}
  
  	controlPlaneEndpoint, err := kubeadmutil.GetControlPlaneEndpoint(cfg.ControlPlaneEndpoint, &cfg.LocalAPIEndpoint)
  	if err != nil {
  		return err
  	}
  
  	spec := &kubeConfigSpec{
  		ClientName: clientName,
  		APIServer:  controlPlaneEndpoint,
  		CACert:     caCert,
  		TokenAuth: &tokenAuth{
  			Token: token,
  		},
  	}
  
  	return writeKubeConfigFromSpec(out, spec, cfg.ClusterName)
  }
docs: // WriteKubeConfigWithToken writes a kubeconfig file - with a token as client authentication info - to the given writer.