在 ECS 上启动 minikube 失败的解决办法

本文涉及的产品
容器镜像服务 ACR,镜像仓库100个 不限时长
简介: 在尝试启动Minikube时遇到初始化失败的错误,可能由于 kubelet 或系统配置问题。通过指定 Kubernetes 版本 (`--kubernetes-version=v1.23.8`) 和镜像国家 (`--image-mirror-country='cn'`) 启动 Minikube 可以解决问题。执行该命令后,成功启动了 Minikube 并设置了默认的 kubectl 配置。

背景

$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
相关实践学习
一小时快速掌握 SQL 语法
本实验带您学习SQL的基础语法,快速入门SQL。
7天玩转云服务器
云服务器ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,可降低 IT 成本,提升运维效率。本课程手把手带你了解ECS、掌握基本操作、动手实操快照管理、镜像管理等。了解产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
7天前
|
域名解析 网络协议 安全
服务器部署访问出错的原因和解决办法
部署到服务器后无法访问可能是由于配置错误、权限问题或网络设置不当。解决办法包括检查服务器配置文件、确保文件路径正确、调整权限设置以及检查防火墙和端口设置。
34 4
|
6月前
|
C++
VS Code 突然连接不上远程服务器的解决办法
VS Code 突然连接不上远程服务器的解决办法
861 0
|
7月前
|
中间件
使用 SAP Fiori Tools 部署 SAP UI5 应用到 ABAP 服务器时遇到的各种错误和解决办法
使用 SAP Fiori Tools 部署 SAP UI5 应用到 ABAP 服务器时遇到的各种错误和解决办法
46 0
|
8月前
|
Linux Shell 数据安全/隐私保护
百度搜索:蓝易云【CentOS7系统服务器密码忘记的解决办法?】
总之,以上步骤是在忘记CentOS7系统服务器密码时的一种解决办法,需要谨慎操作。同时,也建议在平时的使用中,定期备份重要数据,以避免意外情况的发生。
443 0
|
9月前
|
Oracle 关系型数据库 数据库
mstsc连接远程服务器CredSSP加密数据库修真、加密Oracle修正报错解决办法
mstsc连接远程服务器CredSSP加密数据库修真、加密Oracle修正报错解决办法
|
11月前
|
关系型数据库 MySQL Linux
Navicat远程连接linux下mysql服务器1045错误解决办法在这儿
Navicat远程连接linux下mysql服务器1045错误解决办法在这儿
306 0
解决办法:gpg : 从公钥服务器接收失败:公钥服务器错误
解决办法:gpg : 从公钥服务器接收失败:公钥服务器错误
1621 0
|
安全 Linux
阿里云服务器中挖矿病毒解决办法(已实践)
阿里云服务器中挖矿病毒解决办法(已实践)
1852 1
阿里云服务器中挖矿病毒解决办法(已实践)
代理服务器拒绝连接(无法连接到代理服务器)的解决办法
代理服务器拒绝连接(无法连接到代理服务器)的解决办法
代理服务器拒绝连接(无法连接到代理服务器)的解决办法
服务器上的RTC时间与世界时间不一致解决办法
服务器上的RTC时间与世界时间不一致解决办法
963 0