mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
kubeadm: print out the solution if CA files do not exist
phase `kubeadm init phase kubeconfig/*` must run after the phase `kubeadm init phase certs/ca` to get the client cert and key singed by the CA. print out the way to generate the CA file is more useful than just say the file cannot be loaded. Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
parent
575031b68f
commit
3fa6662875
@ -140,6 +140,9 @@ func createKubeConfigFiles(outDir string, cfg *kubeadmapi.InitConfiguration, kub
|
|||||||
// NB. this method holds the information about how kubeadm creates kubeconfig files.
|
// NB. this method holds the information about how kubeadm creates kubeconfig files.
|
||||||
func getKubeConfigSpecs(cfg *kubeadmapi.InitConfiguration) (map[string]*kubeConfigSpec, error) {
|
func getKubeConfigSpecs(cfg *kubeadmapi.InitConfiguration) (map[string]*kubeConfigSpec, error) {
|
||||||
caCert, caKey, err := pkiutil.TryLoadCertAndKeyFromDisk(cfg.CertificatesDir, kubeadmconstants.CACertAndKeyBaseName)
|
caCert, caKey, err := pkiutil.TryLoadCertAndKeyFromDisk(cfg.CertificatesDir, kubeadmconstants.CACertAndKeyBaseName)
|
||||||
|
if os.IsNotExist(errors.Cause(err)) {
|
||||||
|
return nil, errors.Wrap(err, "the CA files do not exist, please run `kubeadm init phase certs ca` to generate it")
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "couldn't create a kubeconfig; the CA files couldn't be loaded")
|
return nil, errors.Wrap(err, "couldn't create a kubeconfig; the CA files couldn't be loaded")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user