使用命令kubeadm init --kubernetes-version=v1.28.0 --apiserver-advertise-address=X.X.X.X(这里是真实IP,用X代替) --pod-network-cidr=10.244.0.0/16 --control-plane-endpoint=k8s-master --ignore-preflight-errors=NumCPU
报错:
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
[kubelet-check] Initial timeout of 40s passed.
^[[A^[[A^[[B
Unfortunately, an error has occurred:
timed out waiting for the condition
This error is likely caused by:
- The kubelet is not running
- The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)
If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
- 'systemctl status kubelet'
- '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.
Here is one example how you may list all running Kubernetes containers by using crictl:
- 'crictl --runtime-endpoint unix:///var/run/containerd/containerd.sock ps -a | grep kube | grep -v pause'
Once you have found the failing container, you can inspect its logs with:
- 'crictl --runtime-endpoint unix:///var/run/containerd/containerd.sock logs CONTAINERID'
error execution phase wait-control-plane: couldn't initialize a Kubernetes cluster
To see the stack trace of this error execute with --v=5 or higher
用journalctl -xeu kubelet查看
12月 11 18:54:16 k8s-master kubelet[2695136]: I1211 18:54:16.886536 2695136 kubelet_node_status.go:70] "Attempting to register node" node="k8s-master"
12月 11 18:54:16 k8s-master kubelet[2695136]: E1211 18:54:16.887018 2695136 kubelet_node_status.go:92] "Unable to register node with API server" err="Post \"https://k8s-master:6443/api/v1/nodes\": dial tcp 109.105.34.101:6443: connect:>
12月 11 18:54:18 k8s-master kubelet[2695136]: E1211 18:54:18.607881 2695136 event.go:289] Unable to write event: '&v1.Event{TypeMeta:v1.TypeMeta{Kind:"", APIVersion:""}, ObjectMeta:v1.ObjectMeta{Name:"k8s-master.179fc0e6a7bb373f", Gene>
12月 11 18:54:21 k8s-master kubelet[2695136]: E1211 18:54:21.112273 2695136 eviction_manager.go:258] "Eviction manager: failed to get summary stats" err="failed to get node info: node \"k8s-master\" not found"
12月 11 18:54:23 k8s-master kubelet[2695136]: E1211 18:54:23.713382 2695136 controller.go:146] "Failed to ensure lease exists, will retry" err="Get \"https://k8s-master:6443/apis/coordination.k8s.io/v1/namespaces/kube-node-lease/leases>
用systemctl status kubelet命令查看,有以下问题:
kuberuntime_manager.go:1119] "CreatePodSandbox for pod failed" err="rpc error: code = Unknown desc = failed to start sandbox container for pod \"kube-controller-manager-k8s-master\": Error response from daemon: failed to create task for container: failed to cre
pod_workers.go:1300] "Error syncing pod, skipping" err="failed to \"CreatePodSandbox\" for \"kube-controller-manager-k8s-master_kube-system(2a4133cb3bce13c258285a67e9400fd1)\" with CreatePodSandboxError: \"Failed to create sandbox for pod \\"kube-controller-ma
kubelet_node_status.go:70] "Attempting to register node" node="k8s-master"
kubelet_node_status.go:92] "Unable to register node with API server" err="Post \"https://109.105.34.101:6443/api/v1/nodes\": dial tcp 109.105.34.101:6443: connect: connection refused" node="k8s-master"
reflector.go:535] vendor/k8s.io/client-go/informers/factory.go:150: failed to list v1.Service: Get "https://109.105.34.101:6443/api/v1/services?limit=500&resourceVersion=0": dial tcp 109.105.34.101:6443: connect: connection refused
reflector.go:147] vendor/k8s.io/client-go/informers/factory.go:150: Failed to watch v1.Service: failed to list *v1.Service: Get "https://109.105.34.101:6443/api/v1/services?limit=500&resourceVersion=0": dial tcp 109.105.34.101:6443: connect: connection refused
pod_container_deletor.go:80] "Container not found in pod's containers" containerID="09525288e6053c7d56627693557429aa4f60cc7d7f9bf3f6ca295771fbf98f03"
根据您提供的错误信息,问题可能是由于kubelet没有运行或者kubelet不健康导致的。您可以尝试以下方法来解决这个问题:
systemctl status kubelet
如果kubelet服务没有运行,您可以使用以下命令启动它:
systemctl start kubelet
systemctl restart kubelet
journalctl -xeu kubelet
这将显示kubelet的详细日志,帮助您诊断问题。
sudo apt-get remove --purge kubeadm
然后重新安装kubeadm:
sudo apt-get update
sudo apt-get install kubeadm
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。