一、软件准备
1、去Docker官网下载Docker Desktop,并一键安装
2、下载k8s-for-docker-desktop包
git clone https://github.com/AliyunContainerService/k8s-for-docker-desktop.git
二、镜像源配置
配置docker的国内镜像,国外的网络下载可能比较慢 docker中国镜像地址:
“https://registry.docker-cn.com”, 网络docker镜像地址
“http://hub-mirror.c.163.com”, ustc大学镜像地址
“https://docker.mirrors.ustc.edu.cn”
{"builder": {"gc": {"defaultKeepStorage": "20GB","enabled": true}},"experimental": false,"features": {"buildkit": true},"insecure-registries": ["10.146.200.22"],"registry-mirrors": ["https://registry.docker-cn.com","http://hub-mirror.c.163.com","https://docker.mirrors.ustc.edu.cn"]
}
三、安装k8s所需的镜像
cd k8s-for-docker-desktop
git branch -a
git checkout v1.25.4
.\load_images.ps1or
./load_images.sh
四、重启Docker与Kubernetes
在Docker仪表盘上在Settings切到Kubernetes上启动Enabled Kubernetes
五、安装Dashboard(可选)
1、使用recommended.yaml进行安装
kubectl apply -f recommended.yaml
or
kubectl apply -f kubernetes-dashboard.yaml
kubectl proxy
nohup kubectl proxy >/dev/null &
2、访问URL: http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy
/
3、登录需要获取token
kubectl -n kubernetes-dashboard get secret
kubectl apply -f kube-system-default.yaml
$TOKEN=((kubectl -n kube-system describe secret default | Select-String "token:") -split " +")[1]
kubectl config set-credentials docker-desktop --token="${TOKEN}"
echo $TOKEN