Kubernetes(K8S)管理,圖形界面,Web UI
一、k8s管理界面
這里主要列舉以下3個:
- 官方的kubernetes-dashboard
- Rancher
- Kuboard
二、安裝步驟
1、前言
之前部署過dashboard v1.x的版本,后來dashboard升級了,按照之前的部署方式部署后,總是出現(xiàn)無法訪問的現(xiàn)象,后面又去github找到最新版的dashboard 部署方式,特此記錄。
2、正式安裝
step1:安裝方式也是類似k8s pod創(chuàng)建,通過kubectl apply方式
$ kubectl apply -f
https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.3/aio/deploy/recommended.yaml
step2:如果拉取不了,可以在hosts里配置這個
echo "151.101.108.133 raw.githubusercontent.com" >> /etc/hosts
注意:選擇版本時要注意,一定要下載與自己k8s的版本對應(yīng)dashboard,不然web界面會報(bào)404。也就是要看看版本中的"Compatibility"
各版本見官方項(xiàng)目地址:
https://github.com/kubernetes/dashboard github.com/kubernetes/dashboard
step3:優(yōu)化配置文件(修改相應(yīng)的鏡像配置以免國內(nèi)無法下載)
我將此服務(wù)改為NodePort方式進(jìn)行部署,方便后續(xù)進(jìn)行測試,鏡像地址也修改為阿里云倉庫的地址,配置文件地址:
點(diǎn)擊直達(dá)
github.com/pythonTaotao/kubernetes/tree/master/dashboard
p.s.recommended.yaml文件需要修改2處
- recommended.yaml 中的鏡像地址改成(一般官方默認(rèn)的鏡像下載不了):
registry.cn-hangzhou.aliyuncs.com/kubernetes_ns/dashboard:v2.0.3
- recommended.yaml 指定nodeport端口,方便主機(jī)上訪問
具體如何修改參見此文:
https://www.cnblogs.com/caoxb/p/www.cnblogs.com/caoxb/p/11244285.html
step4:Getting a Bearer Token(登錄WEB頁面是需要使用)
kubectl describe secrets -n kubernetes-dashboard admin-user-token | grep token | awk 'NR==3{print $2}'
step5:查看服務(wù)端口
[root@master ~]# kubectl get svc -n kubernetes-dashboard
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
dashboard-metrics-scraper ClusterIP 10.100.164.29 <none> 8000/TCP 11h
kubernetes-dashboard NodePort 10.107.131.103 <none> 443:32136/TCP 11h
step6:登錄驗(yàn)證
問題總結(jié)
kubernetes搭建dashboard報(bào)錯
warning
configmaps is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list configmaps in the namespace "default"
close
warning
persistentvolumeclaims is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list persistentvolumeclaims in the namespace "default"
close
warning
secrets is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list secrets in the namespace "default"
close
warning
services is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list services in the namespace "default"
close
warning
ingresses.extensions is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list ingresses.extensions in the namespace "default"
close
warning
daemonsets.apps is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list daemonsets.apps in the namespace "default"
close
warning
pods is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list pods in the namespace "default"
close
warning
events is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list events in the namespace "default"
close
warning
deployments.apps is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list deployments.apps in the namespace "default"
close
warning
replicasets.apps is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list replicasets.apps in the namespace "default"
close
warning
jobs.batch is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list jobs.batch in the namespace "default"
close
warning
cronjobs.batch is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list cronjobs.batch in the namespace "default"
close
warning
replicationcontrollers is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list replicationcontrollers in the namespace "default"
close
warning
statefulsets.apps is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list statefulsets.apps in the namespace "default"
解決辦法安裝dashboard-adminuser.yaml
kubectl apply -f https://hub.fastgit.org/pythonTaotao/kubernetes/blob/master/dashboard/dashboard-adminuser.yaml