k8s学习笔记4--搭建dashborad


目前k8s的版本是1.24.3,dashboard的版本是2.50,均是最新版本

一.部署

1.下载最新版本的dashboard

wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.5.0/aio/deploy/recommended.yaml

2.修改dashboard的service为nodeport,方便后面在外面能够访问到它

.......
kind: Service
apiVersion: v1
metadata:
  labels:
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: kubernetes-dashboard
spec:
  type: NodePort
  ports:
    - port: 443
      targetPort: 8443
      nodePort: 30080
  selector:
    k8s-app: kubernetes-dashboard
......

3.直接应用即可

kubectl apply -f dashboard.yaml 

4.dashboard服务起来之后,能够进入到登录界面,现在已经部署完成,接着就是看,怎么登录了。

在这里插入图片描述

二.登录方式–token

1.获取sa

root@dycm-master:/home/dashborad# kubectl -n  kube-system get sa -n kube-system  -o name  | grep namespace
serviceaccount/namespace-controller

2.创建token

root@k8s-master1:~/dashborad# kubectl -n kube-system create token namespace-controller 
eyJhbGciOiJSUzI1NiIsImtpZCI6ImpydHplRkRsbWlBY1k1d3VodUw3ZENPcTdyd3c2QWNwN0FIbjZjTHAwdTQifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiXSwiZXhwIjoxNjU4ODIzMjIwLCJpYXQiOjE2NTg4MTk2MjAsImlzcyI6Imh0dHBzOi8va3ViZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZXRlcy5pbyI6eyJuYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsInNlcnZpY2VhY2NvdW50Ijp7Im5hbWUiOiJuYW1lc3BhY2UtY29udHJvbGxlciIsInVpZCI6ImVjNGJmMWU0LTBlYWEtNGMyMy05YTA4LWU1MDcyODY3NGEyOSJ9fSwibmJmIjoxNjU4ODE5NjIwLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06bmFtZXNwYWNlLWNvbnRyb2xsZXIifQ.PuS6nkVTUg3hsTx12YUgvPHn-ZvSIMEKictVzKYuajH4MzV2pC0SjfaFJULbiHmsJU5tDOY3EMnz4p4GciPpB4OO_L_4WVUEh4ydNz0t7hrPq4504CfelE4Hr1zi0UAchxveVHUEnmaWI5BoZmGII9nzTboFagMzM4ab6qQzcpOM_2PTWoUdXbYM6N-EY7c2I-aF_qCKQpHGU39M_cAhOwojCIHo4aHi8cffz2b9e-tp96RUYzWG8lgyc0ZBOLrLG_mqY84wZ_f1O70gIrIVi1TtZJ4z1UOROQEkLGXAgyqoMtqsTJcdYyaDSVovI4DtLdy94r2CDgJV84jd_n3p9g

3.复制步骤2中的token,然后填写到登录的地方
在这里插入图片描述
登录进去之后,如下图
在这里插入图片描述

三.参考链接

1.kubernetes 安装 Dashboard
https://blog.csdn.net/weixin_48190863/article/details/123769613
2.官方网址
https://kubernetes.io/zh-cn/docs/tasks/access-application-cluster/web-ui-dashboard/
3.kubernetes (k8s) v1.24.0 安装dashboard面板
https://blog.csdn.net/qq_33921750/article/details/124834006

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐