windows10下docker-desktop使用自带k8s和dashboard
docker-desktop安装就不说了,https://www.docker.com/products/docker-desktop
安装k8s
到这个地址:https://github.com/AliyunContainerService/k8s-for-docker-desktop
下载k8s-for-docker-desktop
解要到你想放的文件夹
运行用管理员方式打开Windows PowerShell,cd 你的路径
比如我的:cd D:\dockerandk8s\k8s-for-docker-desktop-master
然后:
.\load_images.ps1
如果在Windows PowerShell执行该脚本报错(在此系统中禁止执行该脚本)
—powershell中执行脚本报错解决:可以通过执行 set-ExecutionPolicy RemoteSigned 该命令解决,再重新执行脚本即可。
打开docker-desktop,打开k8s,并勾上,等待运行
启用dashboard
kubectl create -f kubernetes-dashboard.yaml
kubectl proxy
通过如下 URL 访问 Kubernetes dashboard,此时是不能访问的
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
然后另外打开一个Windows PowerShell,扫描到k8s解压的目录下,
配置控制台访问令牌
授权kube-system默认服务账号
kubectl apply -f kube-system-default.yaml
对于Windows环境,在k8s目录下用Windows PowerShell依次执行下面三行代码
$TOKEN=((kubectl -n kube-system describe secret default | Select-String "token:") -split " +")[1]
kubectl config set-credentials docker-desktop --token="${TOKEN}"
echo $TOKEN
参考:
https://blog.csdn.net/CQCQCQY/article/details/124838102?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_title~default-0-124838102-blog-119868046.pc_relevant_multi_platform_whitelistv1&spm=1001.2101.3001.4242.1&utm_relevant_index=3
https://blog.csdn.net/wxtuan/article/details/121986084?spm=1001.2101.3001.6650.16&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-16-121986084-blog-124838102.pc_relevant_multi_platform_whitelistv1_mlttest2&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-16-121986084-blog-124838102.pc_relevant_multi_platform_whitelistv1_mlttest2&utm_relevant_index=22
本文来自博客园,作者:{春光牛牛,yak},转载请注明原文链接:https://www.cnblogs.com/yakniu/p/16427451.html
欢迎各位大佬们评论指正
QQ讨论群:610129902