kuboard安装
这里需要先安装完成kubernetes,如果没有的话,请查看这篇文章kubernetes v1.19.0安装
参考文档:kuboard安装配置
兼容性
kubernetes版本 | kuboard版本 | 兼容性 | 说明 |
---|---|---|---|
v1.19 | v2.0.x | 兼容 | 已验证 |
v1.18 | v1.0.x、v2.0.x | 兼容 | 已验证 |
v1.17 | v1.0.x、v2.0.x | 兼容 | 已验证 |
v1.16 | v1.0.x、v2.0.x | 兼容 | 已验证 |
v1.15 | v1.0.x、v2.0.x | 兼容 | 已验证 |
v1.14 | v1.0.x、v2.0.x | 兼容 | 已验证 |
v1.13 | v1.0.x、v2.0.x | 兼容 | 已验证 |
v1.12 | v1.0.x、v2.0.x | 不兼容 | Kubernetes Api v1.12 不支持 dryRun,Kuboard 不支持 Kubernetes v1.12 |
v1.11 | v1.0.x、v2.0.x | 不兼容 | Kubernetes Api v1.12 不支持 dryRun,Kuboard 不支持 Kubernetes v1.12 |
在线安装
kubectl apply -f https://kuboard.cn/install-script/kuboard.yaml
kubectl apply -f https://addons.kuboard.cn/metrics-server/0.3.7/metrics-server.yaml
查看 Kuboard 运行状态:
kubectl get pods -l k8s.eip.work/name=kuboard -n kube-system
---------------------------------------------------------------------
NAME READY STATUS RESTARTS AGE
kuboard-54c9c4f6cb-6lf88 1/1 Running 0 45s
------------------------------------------------------------------------
获取管理员token
master 节点上执行此命令
echo $(kubectl -n kube-system get secret $(kubectl -n kube-system get secret | grep kuboard-user | awk '{print $1}') -o go-template='{{.data.token}}' | base64 -d)
----------------------------------------------------------------------
eyJhbGciOiJSUzI1NiIsImtpZCI6IjRWZ3dzQWYzZkxpUldVQ3J2VnZRdWlmb0RIVW1lUDhsUFNsQjNkTUk4eDAifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2udC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJvYXJkLXVzZXItdG9rZW4tdGponZpY2UtYWNjb3VudC5uYW1lIjoia3Vib2FyZC11c2VyIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiMjQ3MDgzNjic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmt1Ym9hcmQtdXNlciJ9.lPZfLHv1om3RZaJdtBMzYQbfPxIbKuDW6rB8_23YuRTKGtTWSogZZf3MP6BEn-GXAgbJ6a6PXhFkLyVr_rB1q8cAvYcOvmxgRD6ha87_Wt5WztyWBBPWzWoxddOu8JI0Zce8PDSaf2bKHQYdkZTD6ZkVPanQJzlaJu5D2Wf7DSSN4C0ysvRlTicVgMJf3Hqx-BuK76Y2xAsNRj87Kl2ZP-WqgYszacRIpToFrzAvGrbiLnZ03G3Q
-----------------------------------------------------------------------
只读用户token
echo $(kubectl -n kube-system get secret $(kubectl -n kube-system get secret | grep kuboard-viewer | awk '{print $1}') -o go-template='{{.data.token}}' | base64 -d)
离线安装kuboard
- 在可以上网的机器上抓取kuboard镜像
docker pull eipwork/kuboard:latest
docker images | grep kuboard
// 86eaead8421e 为上面一个命令查到的imageID
docker save 86eaead8421e > kuboard.tar
之后将kuboard.tar传输到kubernetes集群某一节点上
2. 在 Kubernetes 集群的某一个节点上执行
docker load < kuboard.tar
docker tag 86eaead8421e eipwork/kuboard:latest
- 准备kuboard.yaml文件
注意需要修改两个地方:ImagePullPolicy=IfNotPresent 和 nodeName: your-node-name
apiVersion: apps/v1
kind: Deployment
metadata:
name: kuboard
namespace: kube-system
annotations:
k8s.eip.work/displayName: kuboard
k8s.eip.work/ingress: "false"
k8s.eip.work/service: NodePort
k8s.eip.work/workload: kuboard
labels:
k8s.eip.work/layer: monitor
k8s.eip.work/name: kuboard
spec:
replicas: 1
selector:
matchLabels:
k8s.eip.work/layer: monitor
k8s.eip.work/name: kuboard
template:
metadata:
labels:
k8s.eip.work/layer: monitor
k8s.eip.work/name: kuboard
spec:
nodeName: your-node-name #这里需要修改为安装kuboard的主机名
containers:
- name: kuboard
image: eipwork/kuboard:latest
imagePullPolicy: IfNotPresent #修改为本地有镜像不从远端拉取
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
---
apiVersion: v1
kind: Service
metadata:
name: kuboard
namespace: kube-system
spec:
type: NodePort
ports:
- name: http
port: 80
targetPort: 80
nodePort: 32567
selector:
k8s.eip.work/layer: monitor
k8s.eip.work/name: kuboard
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kuboard-user
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kuboard-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: kuboard-user
namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kuboard-viewer
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kuboard-viewer
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: view
subjects:
- kind: ServiceAccount
name: kuboard-viewer
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kuboard-viewer:kuboard-minimum-role
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kuboard-minimum-role
subjects:
- kind: ServiceAccount
name: kuboard-viewer
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kuboard-minimum-role
rules:
- apiGroups:
- ''
resources:
- 'namespaces'
- 'nodes'
verbs:
- 'list'
执行命令
kubectl apply -f kuboard-offline.yaml
访问kuboard
http://节点ip:32567/
将上面的token输入浏览器之后如下: