2023/09 作者:ihunter 0 次 0
step1:
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
https://github.com/kubernetes/dashboard/releases
选择版本时要注意,一定要下载与自己k8s的版本对应dashboard
step3: 优化配置文件(修改相应的镜像配置以免国内无法下载)
http://github.com/pythonTaotao/kubernetes/tree/master/dashboard
kubernetes-dashboard.yaml文件需要修改2处
修改两个地方,
第一个是修改镜像,
第二个是添加一个type,指定端口类型为 NodePort,这样外界可以通过地址 nodeIP:nodePort 访问 dashboard;
step4: Getting a Bearer Token(登录WEB页面是需要使用)
kubectl describe secrets -n kubernetes-dashboard admin-user-token | grep token | awk 'NR==3{print $2}'
step5: 查看服务端口
kubectl get svc -n kubernetes-dashboard
step6: 登录验证
step6: warning异常:
configmaps is forbidden: User "system:serviceaccount:kube-system:kubernetes-dashboard" cannot list configmaps in the namespace "default"
解决办法安装dashboard-adminuser.yaml:
kubectl apply -f https://hub.fastgit.org/pythonTaotao/kubernetes/blob/master/dashboard/dashboard-adminuser.yaml