k8s笔记4-Web UI dashboard设置
Web UI设置cd k8s/soft/kubernetes/tar zxf kubernetes-src.tar.gzcd cluster/addons/cd dashboard/kubectl create -f dashboard-configmap.yamlkubectl create -f dashboard-rbac.yamlkubectl create -f dashb...
·
Web UI设置
cd k8s/soft/kubernetes/
tar zxf kubernetes-src.tar.gz
cd cluster/addons/
cd dashboard/
kubectl create -f dashboard-configmap.yaml
kubectl create -f dashboard-rbac.yaml
kubectl create -f dashboard-secret.yaml
vi dashboard-controller.yaml
*****************
------------------------
containers:
- name: kubernetes-dashboard
image: k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.0
---------------------------
修改为
---------------------------
containers:
- name: kubernetes-dashboard
image: registry.cn-hangzhou.aliyuncs.com/kuberneters/kubernetes-dashboard-amd64:v1.10.1
-----------------------
**********************
kubectl create -f dashboard-controller.yaml
直接在 dev.aliyun.com 中搜索kubernetes-dashboard-amd64,
找到最新版,复制并更改在dashboard-controller.yaml中。
kubectl get pods
kubectl get pods -n kube-system
kubectl logs kubernetes-dashboard-6d9698df7b-wvmcf -n kube-system
vi dashboard-service.yaml
添加NodePort类型:
type: NodePort
kubectl create -f dashboard-service.yaml
kubectl get pods -n kube-system
有错误的话可查看日志
kubectl logs kubernetes-dashboard-5f5bfdc89f-jt7k6 -n kube-system
结果如果有HTTPS port: 8443,则说明外部连接https成功。
kubectl get svc -n kube-system
Note:重新生成dashboard,需要先删除再运行
kubectl delete -f dashboard-controller.yaml
kubectl delete -f dashboard-service.yaml
kubectl create -f dashboard-controller.yaml
kubectl create -f dashboard-service.yaml
vi k8s-admin.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: dashboard-admin
namespace: kube-system
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: dashboard-admin
subjects:
- kind: ServiceAccount
name: dashboard-admin
namespace: kube-system
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
生成token
kubectl get secret -n kube-system
token使用即可
kubectl describe secret dashboard-admin-token-cmk9j -n kube-system
在firefox浏览器中输入任一Node::
当出现很多不能访问的waring时,建立如下文件
apiVersion: v1
kind: ServiceAccount
metadata:
name: aks-dashboard-admin
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: aks-dashboard-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: aks-dashboard-admin
namespace: kube-system
重新生成secret,如下面第一条
更多推荐
已为社区贡献8条内容
所有评论(0)