window本地安装k8s集群,用Minikube安装

先把防火墙关闭,否则安装会提示如下错误:

X 因 INET_DOWNLOAD_BLOCKED 错误而退出:update primary control-plane node: downloading binaries: downloading kubelet: download failed: https://dl.k8s.io/release/v1.30.0/bin/linux/amd64/kubelet?checksum=file:https://dl.k8s.io/release/v1.30.0/bin/linux/amd64/kubelet.sha256: getter: &{Ctx:context.Background Src:https://dl.k8s.io/release/v1.30.0/bin/linux/amd64/kubelet?checksum=file:https://dl.k8s.io/release/v1.30.0/bin/linux/amd64/kubelet.sha256 Dst:D:\minikube\.minikube\cache\linux\amd64\v1.30.0/kubelet.download Pwd: Mode:2 Umask:---------- Detectors:[0x4f92a00 0x4f92a00 0x4f92a00 0x4f92a00 0x4f92a00 0x4f92a00 0x4f92a00] Decompressors:map[bz2:0xc000a814c0 gz:0xc000a814c8 tar:0xc000a81470 tar.bz2:0xc000a81480 tar.gz:0xc000a81490 tar.xz:0xc000a814a0 tar.zst:0xc000a814b0 tbz2:0xc000a81480 tgz:0xc000a81490 txz:0xc000a814a0 tzst:0xc000a814b0 xz:0xc000a814d0 zip:0xc000a814e0 zst:0xc000a814d8] Getters:map[file:0xc001f34900 http:0xc000c939a0 https:0xc000c939f0] Dir:false ProgressListener:0x4ef8d30 Insecure:false DisableSymlinks:false Options:[0x18b80a0]}: read tcp 26.26.26.1:57562->151.101.129.55:443: wsarecv: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. * 建议:防火墙可能会阻止 minikube 访问互联网。您可能需要将 minikube 配置为使用 * 文档:https://minikube.sigs.k8s.io/docs/handbook/vpn_and_proxy/ * 相关问题: - https://github.com/kubernetes/minikube/issues/3922 - https://github.com/kubernetes/minikube/issues/6109 - https://github.com/kubernetes/minikube/issues/6123

编写一个文件,名称:Hyper-V Installer.cmd,执行文件,内容如下:

pushd "%~dp0" dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i" del hyper-v.txt Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL

执行完就安装了Hyper-V了

下载安装minikube-installer.exe

MINIKUBE_HOME env变量设置.minikube目录的路径。比如我的环境变量是这么设置的。

最后产生的.minikube就在D:\minikube中。

启动集群:

minikube start --registry-mirror=https://registry.docker-cn.com --image-mirror-country=cn --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers --memory=4096

安装完成提示

执行命令

minikube dashboard

输出:会自动打开浏览器

W0807 09:10:07.798404 1588 main.go:291] Unable to resolve the current Docker CLI context "default": context "default": context not found: open C:\Users\33409\.docker\contexts\meta\37a8eec1ce19687d132fe29051dca629d164e2c4958ba141d5f4133a33f0688f\meta.json: The system cannot find the path specified. * 正在开启 dashboard ... - 正在使用镜像 docker.io/kubernetesui/dashboard:v2.7.0 - 正在使用镜像 docker.io/kubernetesui/metrics-scraper:v1.0.8 * Some dashboard features require the metrics-server addon. To enable all features please run: minikube addons enable metrics-server * 正在验证 dashboard 运行情况 ... * 正在启动代理... * 正在验证 proxy 运行状况 ... * 正在使用默认浏览器打开 http://127.0.0.1:37030/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ ...

会出现如下界面:

搞定

  • 12
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值