• 博客园logo
  • 会员
  • 周边
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
gys001
博客园    首页    新随笔    联系   管理    订阅  订阅

ubuntu2204安装minikube【踩坑版】

参考链接 https://zhuanlan.zhihu.com/p/429690423

1.安装docker

apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get install http://docker.io 
systemctl start docker
systemctl enable docker

docker version

 

配置阿里云的代理,通过修改daemon配置文件/etc/docker/daemon.json来使用加速器:

$ cd /etc/docker
# 在daemon.json文件末尾追加如下配置:
$ sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://dhx52mku.mirror.aliyuncs.com"]
}
EOF

# 重启docker
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker

2.安装minikube

curl -Lo minikube https://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/releases/v1.23.1/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

root@k8s:/usr/local/bin# minikube start
* minikube v1.23.1 on Ubuntu 22.04
* Kubernetes 1.22.1 is now available. If you would like to upgrade, specify: --kubernetes-version=v1.22.1
* Using the none driver based on existing profile

X Exiting due to GUEST_MISSING_CONNTRACK: Sorry, Kubernetes 1.22.1 requires conntrack to be installed in root's path

 

报错1:Kubernetes 1.22.1 requires conntrack to be installed in root's path

参考链接 https://installati.one/install-conntrack-ubuntu-20-04/
#安装 conntrack
apt-get update apt-get -y install conntrack minikube start

 

报错2:X Exiting due to K8S_INSTALL_FAILED: updating control plane: downloading binaries: downloading kubelet: download failed: https://kubernetes.oss-cn-hangzhou.aliyuncs.com/kubernetes-release***

参考链接  https://github.com/kubernetes/minikube/issues/17661

#指定仓库安装 minikube start --image-mirror-country='cn' --image-repository='registry.cn-hangzhou.aliyuncs.com/google_containers' --kubernetes-version=v1.23.1
 

报错3:Unable to scale down deployment "coredns" in namespace "kube-system" to 1 replica: client: client config: invalid configuration: [unable to read client-cert /root/.minikube/profiles/minikube/client.crt for minikube due to open***

参考链接 https://github.com/kubernetes/minikube/issues/8363
##原因如下
client.key client.crt目录不对
实际是在/root/.minikube/ 目录下,而~/.kube/config配置的是/root/.minikube/profiles/minikube/
需要修改 ~/.kube/config对应目录信息后再启动

----------------------------------------------------------------
#修改如下
root@k8s:/usr/local/bin# cat ~/.kube/config
apiVersion: v1
clusters:
- cluster:
    certificate-authority: /root/.minikube/ca.crt
    extensions:
    - extension:
        last-update: Wed, 13 Mar 2024 09:00:33 UTC
        provider: minikube.sigs.k8s.io
        version: v1.23.1
      name: cluster_info
    server: https://192.168.59.100:8443
  name: minikube
contexts:
- context:
    cluster: minikube
    extensions:
    - extension:
        last-update: Wed, 13 Mar 2024 09:00:33 UTC
        provider: minikube.sigs.k8s.io
        version: v1.23.1
      name: context_info
    user: minikube
  name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
  user:
    client-certificate: /root/.minikube/profiles/client.crt
    client-key: /root/.minikube/profiles/client.key

 

 重新执行后安装成功

 

posted @ 2024-06-12 17:50  gys001  阅读(478)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3