环境:windows10

使用choco安装minikube

	choco install minikube

使用minikube version验证

C:\Users\Administrator>minikube version
minikube version: v1.25.2
commit: 362d5fdc0a3dbee389b3d3f1034e8023e72bd3a7

通过Powershell启用Hyper-V

  	Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

创建K8S

minikube start --image-mirror-country='cn' --vm-driver="hyperv" --memory=3076 

输出:

– --image-mirror-country 这儿需要制定为cn,自动使用阿里云镜像

– --vm-driver 基座

– --memory 虚机内存大小

PS C:\Users\Administrator> minikube start --image-mirror-country='cn' --vm-driver="hyperv" --memory=3076  * Microsoft Windows 10 Enterprise LTSC 2019 10.0.17763 Build 17763 上的 minikube v1.25.2
* 根据用户配置使用 hyperv 驱动程序
* 正在使用镜像存储库 registry.cn-hangzhou.aliyuncs.com/google_containers
* Starting control plane node minikube in cluster minikube
* Creating hyperv VM (CPUs=2, Memory=3076MB, Disk=20000MB) ...
* 正在 Docker 20.10.12 中准备 Kubernetes v1.23.3…
  - kubelet.housekeeping-interval=5m
  - 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
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default


PS C:\Users\Administrator> kubectl get nodes
NAME       STATUS   ROLES                  AGE     VERSION
minikube   Ready    control-plane,master   2m37s   v1.23.3

安装完成,执行minikube dashboard

PS C:\Users\Administrator> minikube dashboard
* 正在开启 dashboard ...
  - Using image registry.cn-hangzhou.aliyuncs.com/google_containers/dashboard:v2.3.1
  - Using image registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-scraper:v1.0.7
* 正在验证 dashboard 运行情况 ...
* Launching proxy ...
* 正在验证 proxy 运行状况 ...
* Opening http://127.0.0.1:62079/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ in your default browser...

至此,安装完成并打开dashboard界面 

其他命令

删除已安装的虚机:

minikube delete

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐