一、下载:
下载你docker-mac对应的版本,我的是v1.21.3
git clone -b v1.21.3 https://github.com/AliyunContainerService/k8s-for-docker-desktop.git
二、执行脚本下拉镜像:
进入k8s-for-docker-desktop,执行如下命令
./load_images.sh
开启kubernetes
开启 Kubernetes,并等待 Kubernetes 开始运行
部署 Kubernetes dashboard
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-rc5/aio/deploy/recommended.yaml
检查 kubernetes-dashboard 应用状态
kubectl get pod -n kubernetes-dashboard
开启 API Server 访问代理
kubectl proxy
通过如下 URL 访问 Kubernetes dashboard
配置控制台访问令牌
对于mac环境
对于Mac环境
TOKEN=$(kubectl -n kube-system describe secret default| awk '$1=="token:"{print $2}')
kubectl config set-credentials docker-for-desktop --token="${TOKEN}"
echo $TOKEN
eyJhbGciOiJSUzI1NiIsImtpZCI6IkExNW4tcW1LbmZpT3I3YWhZUXgzbXNDZmx4a0RQSzUxcDQ0NVo1b3A0S2cifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkZWZhdWx0LXRva2VuLWg2cWc2Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImRlZmF1bHQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJjYmVjNGVhOS03NzQ5LTQ0NzAtYjFhYy1hZWYyNGI5YTNlN2YiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06ZGVmYXVsdCJ9.bwREEU7Ac7hnnHU8_Oww2O9a-ymw6foeU8pvG-6YZ35EobuRSRRpTIGc3crnyrxbd2sQFiaQieakkxME2eDD9EoQmsvHK9S7YoLI8HQDW_wByzUqc6n7PW8PYZRuWZuhhhWBF2YHfgIoQ2BCQFivjvWbkyzZ508cgAHJ6B0YWlOc0d55qslW6OxgXVbiX0qnGd5IPcFk97mz_6w9KvWnf011XzxfIiQI97wYTSquSZjP_TsjmEyx9HrLfxAwgp_81SqEeFYWeZ5XED337D4XOxbsh714nnPVpDL_n1EKUextArPJ7OFkysA5HIeLzgxD2z0Mtj94QhV_XSdAfxNFuw