背景
$minikube start 😄 minikube v1.28.0 on Alibaba 7.2 (amd64) ✨ Automatically selected the docker driver. Other choices: ssh, none ✅ Using image repository registry.cn-hangzhou.aliyuncs.com/google_containers 📌 Using Docker driver with root privileges 👍 Starting control plane node minikube in cluster minikube 🚜 Pulling base image ... 🔥 Creating docker container (CPUs=2, Memory=2200MB) ... > kubeadm.sha256: 64 B / 64 B [-------------------------] 100.00% ? p/s 0s > kubectl.sha256: 64 B / 64 B [-------------------------] 100.00% ? p/s 0s > kubelet.sha256: 64 B / 64 B [-------------------------] 100.00% ? p/s 0s > kubectl: 42.93 MiB / 42.93 MiB [------------] 100.00% 27.30 MiB p/s 1.8s > kubeadm: 41.77 MiB / 41.77 MiB [------------] 100.00% 23.30 MiB p/s 2.0s > kubelet: 108.95 MiB / 108.95 MiB [----------] 100.00% 25.30 MiB p/s 4.5s ▪ Generating certificates and keys ... ▪ Booting up control plane ... 💢 initialization failed, will try again: wait: /bin/bash -c "sudo env PATH="/var/lib/minikube/binaries/v1.25.3:$PATH" kubeadm init --config /var/tmp/minikube/kubeadm.yaml --ignore-preflight-errors=DirAvailable--etc-kubernetes-manifests,DirAvailable--var-lib-minikube,DirAvailable--var-lib-minikube-etcd,FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml,FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml,FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml,FileAvailable--etc-kubernetes-manifests-etcd.yaml,Port-10250,Swap,Mem,SystemVerification,FileContent--proc-sys-net-bridge-bridge-nf-call-iptables": Process exited with status 1
如上所述,在 Booting up control plane
这一步卡了一段时间之后就报错了。根据报错信息里的提示进行一些尝试,也无果。
... [etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests" [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. 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/cri-dockerd.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/cri-dockerd.sock logs CONTAINERID' stderr: W1213 05:28:41.538649 1624 initconfiguration.go:119] Usage of CRI endpoints without URL scheme is deprecated and can cause kubelet errors in the future. Automatically prepending scheme "unix" to the "criSocket" with value "/var/run/cri-dockerd.sock". Please update your configuration! [WARNING Service-Kubelet]: kubelet service is not enabled, please run 'systemctl enable kubelet.service' 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
最后 Google 搜了一下,居然通过这里的方法解决了,切换到指定版本启动:
https://github.com/kubernetes/minikube/issues/14477#issuecomment-1176188284
$minikube start --kubernetes-version=v1.23.8 --image-mirror-country='cn'
运行结果:
😄 minikube v1.28.0 on Alibaba 7.2 (amd64) ✨ Automatically selected the docker driver. Other choices: none, ssh ✅ Using image repository registry.cn-hangzhou.aliyuncs.com/google_containers 📌 Using Docker driver with root privileges 👍 Starting control plane node minikube in cluster minikube 🚜 Pulling base image ... 🔥 Creating docker container (CPUs=2, Memory=2200MB) ... > kubeadm.sha256: 64 B / 64 B [-------------------------] 100.00% ? p/s 0s > kubectl.sha256: 64 B / 64 B [-------------------------] 100.00% ? p/s 0s > kubelet.sha256: 64 B / 64 B [-------------------------] 100.00% ? p/s 0s > kubeadm: 43.12 MiB / 43.12 MiB [------------] 100.00% 19.11 MiB p/s 2.5s > kubectl: 44.44 MiB / 44.44 MiB [------------] 100.00% 18.84 MiB p/s 2.6s > kubelet: 118.78 MiB / 118.78 MiB [----------] 100.00% 17.51 MiB p/s 7.0s ▪ Generating certificates and keys ... ▪ Booting up control plane ... ▪ Configuring RBAC rules ... 🔎 Verifying Kubernetes components... ▪ Using image registry.cn-hangzhou.aliyuncs.com/google_containers/storage-provisioner:v5 🌟 Enabled addons: storage-provisioner, default-storageclass ❗ /usr/local/bin/kubectl is version 1.26.0, which may have incompatibilities with Kubernetes 1.23.8. ▪ Want kubectl v1.23.8? Try 'minikube kubectl -- get pods -A' 🏄 Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default