mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Merge pull request #85843 from Itxaka/kubeadm_docker_messages
Enhance error message for failed controlplane init
This commit is contained in:
commit
c8b123e8e1
@ -47,11 +47,18 @@ var (
|
||||
- 'journalctl -xeu kubelet'
|
||||
|
||||
Additionally, a control plane component may have crashed or exited when started by the container runtime.
|
||||
To troubleshoot, list all containers using your preferred container runtimes CLI, e.g. docker.
|
||||
To troubleshoot, list all containers using your preferred container runtimes CLI.
|
||||
{{ if .IsDocker }}
|
||||
Here is one example how you may list all Kubernetes containers running in docker:
|
||||
- 'docker ps -a | grep kube | grep -v pause'
|
||||
Once you have found the failing container, you can inspect its logs with:
|
||||
- 'docker logs CONTAINERID'
|
||||
{{ else }}
|
||||
Here is one example how you may list all Kubernetes containers running in cri-o/containerd using crictl:
|
||||
- 'crictl --runtime-endpoint {{ .Socket }} ps -a | grep kube | grep -v pause'
|
||||
Once you have found the failing container, you can inspect its logs with:
|
||||
- 'crictl --runtime-endpoint {{ .Socket }} logs CONTAINERID'
|
||||
{{ end }}
|
||||
`)))
|
||||
)
|
||||
|
||||
@ -93,10 +100,17 @@ func runWaitControlPlanePhase(c workflow.RunData) error {
|
||||
fmt.Printf("[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory %q. This can take up to %v\n", data.ManifestDir(), timeout)
|
||||
|
||||
if err := waiter.WaitForKubeletAndFunc(waiter.WaitForAPI); err != nil {
|
||||
ctx := map[string]string{
|
||||
"Error": fmt.Sprintf("%v", err),
|
||||
context := struct {
|
||||
Error string
|
||||
Socket string
|
||||
IsDocker bool
|
||||
}{
|
||||
Error: fmt.Sprintf("%v", err),
|
||||
Socket: data.Cfg().NodeRegistration.CRISocket,
|
||||
IsDocker: data.Cfg().NodeRegistration.CRISocket == kubeadmconstants.DefaultDockerCRISocket,
|
||||
}
|
||||
kubeletFailTempl.Execute(data.OutputWriter(), ctx)
|
||||
|
||||
kubeletFailTempl.Execute(data.OutputWriter(), context)
|
||||
return errors.New("couldn't initialize a Kubernetes cluster")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user