Kubernetes Dashborad 搭建
2021-03-08 12:27
标签:releases 外网访问 protoc meta lcm not 外网 ada occurs 基于网页查看Kubernetes 用户管理界面 在控制面板节点部署dashborad 如果需要外网访问,需要使用NodePort的方式对外暴露端口,不能使用 更改原文件 然后就可以访问下面的地址 访问上面的地址会出现登录的界面,如下图: 这里选择使用token登录 创建dashboard对应的admin账户 然后通过如下命令获取登录的token 取上图的token字段粘贴进登录界面即可。 注意,有的文章会写此方式获取到的token还需要进行base64解密,可能是因为版本原因,本人测试是可以直接复制后进行登录的 登录成功后界面如图 终于装好了,踩了不少坑,主要还是不熟悉。后面切记认真仔细阅读官方文档。 https://kubernetes.io/zh/docs/tasks/access-application-cluster/web-ui-dashboard/ https://github.com/kubernetes/dashboard https://github.com/kubernetes-sigs/metrics-server https://github.com/kubernetes/dashboard/blob/master/docs/user/accessing-dashboard/1.7.x-and-above.md Kubernetes Dashborad 搭建 标签:releases 外网访问 protoc meta lcm not 外网 ada occurs 原文地址:https://www.cnblogs.com/haoyunlaile/p/12874149.html需求
安装步骤
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml
放开外网端口映射
kubectl proxy
的方式,因为该方式只能通过http访问,非本地环境无法正常登录,在这里折腾了好几个小时,主要还是没有一字一句看官方文档。type: ClusterIP
为type: NodePort
后保存kubectl -n kubernetes-dashboard edit service kubernetes-dashboard
# Please edit the object below. Lines beginning with a ‘#‘ will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
...
name: kubernetes-dashboard
namespace: kubernetes-dashboard
resourceVersion: "343478"
selfLink: /api/v1/namespaces/kubernetes-dashboard/services/kubernetes-dashboard
uid: 8e48f478-993d-11e7-87e0-901b0e532516
spec:
clusterIP: 10.100.124.90
externalTrafficPolicy: Cluster
ports:
- port: 443
protocol: TCP
targetPort: 8443
selector:
k8s-app: kubernetes-dashboard
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
下一步获取nodeport对外开放的https端口,注意这里为32443端口
kubectl -n kubernetes-dashboard get service kubernetes-dashboard
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes-dashboard NodePort 10.98.33.83
同时启动监控指标收集服务,不然会dashborad无法展示数据图表
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.3.6/components.yaml
https://
touch dashboard-admin.yml
vi dashboard-admin.yml
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: admin-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: admin-user
namespace: kubernetes-dashboard
kubectl apply -f dashboard-admin.yml
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk ‘{print $1}‘)
Name: admin-user-token-5j9gg
Namespace: kubernetes-dashboard
Labels:
参考文档
文章标题:Kubernetes Dashborad 搭建
文章链接:http://soscw.com/index.php/essay/61803.html