mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
kubeadm: delete boostrap-kubelet.conf after TLS bootstrap on init
This commit is contained in:
parent
2dedfddf81
commit
71cb27836d
@ -19,6 +19,7 @@ package phases
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"text/template"
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
@ -100,6 +101,13 @@ func runWaitControlPlanePhase(c workflow.RunData) error {
|
|||||||
return errors.New("couldn't initialize a Kubernetes cluster")
|
return errors.New("couldn't initialize a Kubernetes cluster")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deletes the kubelet boostrap kubeconfig file, so the credential used for TLS bootstrap is removed from disk
|
||||||
|
// This is done only on success.
|
||||||
|
bootstrapKubeConfigFile := kubeadmconstants.GetBootstrapKubeletKubeConfigPath()
|
||||||
|
if err := os.Remove(bootstrapKubeConfigFile); err != nil {
|
||||||
|
klog.Warningf("[wait-control-plane] could not delete the file %q: %v", bootstrapKubeConfigFile, err)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user