window10专业版下:docker中k8s安装
安装k8sPower shell获取管理员权限运行1.下载k8s镜像Git clone https://gitee.com/AliyunContainerService/k8s-for-docker-desktop.gitCd k8s-for-docker-desktop.\load_images.ps12.打开docker doashbard启动k8s3.安装Kubernetes Dashboa
安装k8s
Power shell获取管理员权限运行
1.下载k8s镜像
Git clone https://gitee.com/AliyunContainerService/k8s-for-docker-desktop.git
Cd k8s-for-docker-desktop
.\load_images.ps1
2.打开docker doashbard
启动k8s
3.安装Kubernetes Dashboard
查看当前k8s的kubectl 安装是否正确.
通过yaml文件安装部署镜像.
在k8s-for-docker-desktop目录下
执行:kubectl create -f kubernetes-dashboard.yaml
查看当前docker运行状态
kubectl get pods --namespace kube-system
4.开启代理
kubectl proxy
注意,只有当dashboard 容器,正常运行也就是状态为(Running),才能打开浏览器访问。当出现错误时,才看容器运行具体信息,使用如下命令:
kubectl describe pod kubernetes-dashboard-669f9bbd46-rhmst --namespace kube-system
执行 kubernetes-dashboard.yaml 文件时,可能拉取镜像失败,导致doashboard 容器不能正常执行。
镜像拉取失败处理脚本:
$DASHDOARD_VERSION="v1.10.1"
$HEAPSTER_VERSION="v1.5.4"
$GRAFANA_VERSION="v5.0.4"
$INFLUXDB_VERSION="v1.5.2"
$username="registry.cn-hangzhou.aliyuncs.com/google_containers"
$images="kubernetes-dashboard-amd64:${DASHDOARD_VERSION}","heapster-grafana-amd64:${GRAFANA_VERSION}","heapster-amd64:${HEAPSTER_VERSION}","heapster-influxdb-amd64:${INFLUXDB_VERSION}"
foreach($item in $images)
{
docker pull ${username}/${item}
docker tag ${username}/${item} k8s.gcr.io/${item}
docker rmi ${username}/${item}
}
以下kubectl 常用命令:
kubectl create -f kubernetes-dashboard.yaml --删除资源
kubectl apply -f kubernetes-dashboard.yaml --重新应用配置
5.打开doashbard
浏览器打开
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/overview?
namespace=default
此时可能 也有问题无法登陆
1
2 "Deleted kubernetes-dashboard version 1.10.1 and switched to v2.0.0-beta8 which worked like a charm: localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/overview?namespace=_all"
参考链接:https://github.com/kubernetes-sigs/kubespray/issues/5347
获取token命令
---token 登录
$TOKEN=((kubectl -n kube-system describe secret default | Select-String "token:") -split " +")[1]
kubectl config set-credentials docker-for-desktop --token="${TOKEN}"
echo $TOKEN
"Any key to exit" ;
Read-Host | Out-Null ;
Exit
查看token的命令:
kubectl -n kube-system describe secret default
eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkZWZhdWx0LXRva2VuLXdwd3F3Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImRlZmF1bHQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiIxOTE0ODRkMS00MDBjLTQ5ZDUtOGJmMi04OTU5YmE3NjQzNWQiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06ZGVmYXVsdCJ9.Z1oNwi_b_nEG3qjAU5KK6M4XNIr41zeWYGwlU2gOXQnCsyQn9Vbo3wgu7Ktpm35kul8i7Ul4S1L8eEJGuPXaFhp-0sgJziHUq5ANG4LodmuwjIlfyPRDc-yaBx1epPYqThj-HR6Qnd6pu7jIZKkERXZUFzrcb_5XdL-W7px70kT42NnrDQrTjuKYzOMfm90vTCPoOqLU8J9XNP_V2knfoD2dTGM3QdgxYJmVdNezr3F9ueVv-tUEortU4cHfkkHjHdF-CazLBq4nEmfShquI2Dr_LNerxYK6RrOuAkRgVYtNr4JsN5zL5IVxGXzVsoEbPuZG6frYeJsZiPT0Y20pag
更多推荐
所有评论(0)