简介
本文介绍Ubuntu安装k8s的dashboard(管理页面)的方法。
Dashboard的作用有:便捷操作、监控、分析、概览。
相关网址
官网地址:https://kubernetes.io/zh-cn/docs/tasks/access-application-cluster/web-ui-dashboard/
github:https://github.com/kubernetes/dashboard/releases
1.安装dashboard
先去github上找找当前的稳定版:github地址,当前是2.7.0
1.下载dashboard配置
创建文件夹
mkdir -p /work/devops/k8s/dashboard/config cd /work/devops/k8s/dashboard/config
下载 dashboard配置
wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
注意:如果下载失败,可以手动用浏览器去访问这个地址,把内容复制到Linux服务器里即可。
2.修改配置,允许外部访问
默认Dashboard只能集群内部访问,修改Service为NodePort类型,暴露到外部。
找到 kubernetes-dashboard 的 service,添加 type: NodePort ,这里我指定的 nodePort 是 30001(nodePort有限制:30000~32767)。如下图所示(左侧是原文件,右侧是修改后的(忽略中间的大于号)):

3.启用dashboard
kubectl apply -f recommended.yaml
结果

4.查看状态
查看service
kubectl get services -A
或者
kubectl get services -n kubernetes-dashboard
结果

查看pods
kubectl get pods -n kubernetes-dashboard
或者
kubectl get pods -A
结果

这样是有问题的,解决方法如下:
K8S-解决dashboard一直Pending的问题 – 自学精灵
解决K8S的dashboard的ImagePullBackOff和ErrImagePull的问题-自学精灵
最终结果:

查看services
kubectl get services -A
结果

5.访问页面
先访问一下dashboard页面(注意:必须用https访问):https://ip:30001

OK,可以访问了!
2.登录
见:K8S的dashboard使用token登录 – 自学精灵
注意:下边这个方式不推荐
请先
!