Kubernetes1.13安装kubernetes-dashboard
kubernetes-dashboard.yaml简介
官网参考
官网推荐安装模式
kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
我为了看下kubernetes-dashboard.yaml的内容,所有先把kubernetes-dashboard.yaml下载下来
wget https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
spec.containers.image:填写dashboard的镜像路径。大家可以通过docker search查询1.10.0版本的dashboard。
spec.containers.args:此处填写的是一些参数,由于kubernetes1.13.0是通过HTTPS安全验证的安装,访问的是http://masterip:6443,因此,此处默认填写了- --auto-generate-certificates,用以自动生成dashboard证书,此处不需要填写apiserver地址。
RBAC配置
因为kubernetes1.13开启了 RBAC 所以这里需要创建一个 RBAC 认证。在Kubernetes1.13安装Helm文中已详述rbac的配置过程,请参考helm rbac配置;
dashboard安装启动
官网推荐了两种启动访问方式
执行kubectl proxy命令
可以通过下面的地址进行访问
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
但是存在一个问题
The UI can only be accessed from the machine where the command is executed.
只能从执行命令的机器进行访问
这明显不符合我们的需求,我们是打算通过其他管理机访问
直接通过apiserver访问
https://<master-ip>:<apiserver-port>/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/, where <master-ip> is IP address or domain name of the Kubernetes master.
通过第二种又遇到了一些坑
访问dashboard网页时,可能出现下面这种报错:
- 403 Forbidden问题
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {
},
"status": "Failure",
"message": "services \"https:kubernetes-dashboard:\" is forbidden: User \"system:anonymous\" cannot get services/proxy in the namespace \"kube-s