安装kubernetes dashboard

安装kubernetes dashboard

目标

在 kubernetes desktop for mac 基础上安装dashboard UI

官方方式安装

github地址

#部署
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
#启动
kubectl proxy

浏览器访问:UI地址

报错:

no endpoints available for service “http:kubernetes-dashboard:”

查看pod状态:官方镜像拉取失败

$ kubectl get pods --all-namespaces
NAMESPACE     NAME                                         READY     STATUS             RESTARTS   AGE
kube-system   kubernetes-dashboard-669f9bbd46-6vrpc        0/1       ImagePullBackOff   0          4h

重置当前环境:

kubectl delete deployment kubernetes-dashboard -n kube-system
kubectl delete service kubernetes-dashboard -n kube-system
kubectl delete serviceaccount kubernetes-dashboard -n kube-system
kubectl delete rolebinding.rbac.authorization.k8s.io kubernetes-dashboard-minimal -n kube-system
kubectl delete role.rbac.authorization.k8s.io kubernetes-dashboard-minimal -n kube-system
kubectl delete deployment.apps kubernetes-dashboard -n kube-system
kubectl delete secret kubernetes-dashboard-certs -n kube-system

解决方案:更换镜像

  • 拉取镜像 docker pull siriuszg/kubernetes-dashboard-amd64
  • 下载文件内容
  • 修改image为:siriuszg/kubernetes-dashboard-amd64
  • 重新部署 kubectl apply -f kubernetes-dashboard.yaml
查看运行状态
$ kubectl get pods --all-namespaces
NAMESPACE     NAME                                         READY     STATUS    RESTARTS   AGE
docker        compose-7447646cf5-tpc79                     1/1       Running   1          1d
docker        compose-api-6fbc44c575-qz9jk                 1/1       Running   0          1d
kube-system   etcd-docker-for-desktop                      1/1       Running   0          1d
kube-system   kube-apiserver-docker-for-desktop            1/1       Running   1          1d
kube-system   kube-controller-manager-docker-for-desktop   1/1       Running   0          1d
kube-system   kube-dns-86f4d74b45-glx2k                    3/3       Running   0          1d
kube-system   kube-proxy-t6slz                             1/1       Running   0          1d
kube-system   kube-scheduler-docker-for-desktop            1/1       Running   0          1d
kube-system   kubernetes-dashboard-59767c49f9-9fhpc        1/1       Running   0          3m

开启dashboard代理

$ kubectl proxy
Starting to serve on 127.0.0.1:8001

浏览器访问:UI地址

生成访问令牌

$ kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')

拷贝token填入浏览器并提交登录

你可能感兴趣的:(运维,#,Docker)