k8s搭建kuboard 可视化视图

Posted docker2013

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了k8s搭建kuboard 可视化视图相关的知识,希望对你有一定的参考价值。

[root@k8s-master ~]#  docker pull eipwork/kuboard:latest
[root@k8s-master ~]#  docker images | grep kuboard
eipwork/kuboard                                                   latest              9fccf2a94412        3 weeks ago         182MB
[root@k8s-master ~]#
docker save 9fccf2a94412 > kuboard.tar

将tar包传到k8s-node1节点上面

docker load < kuboard.tar
docker tag 0146965e6475 eipwork/kuboard:latest

在主节点写入如下的yaml文件---------------------------------------注意在第二十六行写你要在那个节点上面创建kuborad

apiVersion: apps/v1
kind: Deployment
metadata:
  name: kuboard
  namespace: kube-system
  annotations:
    k8s.kuboard.cn/displayName: kuboard
    k8s.kuboard.cn/ingress: "true"
    k8s.kuboard.cn/service: NodePort
    k8s.kuboard.cn/workload: kuboard
  labels:
    k8s.kuboard.cn/layer: monitor
    k8s.kuboard.cn/name: kuboard
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s.kuboard.cn/layer: monitor
      k8s.kuboard.cn/name: kuboard
  template:
    metadata:
      labels:
        k8s.kuboard.cn/layer: monitor
        k8s.kuboard.cn/name: kuboard
    spec:
      nodeName: your-node-name
      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.kuboard.cn/layer: monitor
    k8s.kuboard.cn/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

  

运行yaml文件

kubectl apply -f kuboard.yaml
[root@k8s-master ~]# kubectl get pod -n kube-system
NAME                                 READY   STATUS    RESTARTS   AGE
kuboard-5bc5658d74-fskmw             1/1     Running   0          21m
[root@k8s-master ~]# kubectl get svc -n kube-system
NAME       TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                  AGE
kube-dns   ClusterIP   10.96.0.10      <none>        53/UDP,53/TCP,9153/TCP   2d11h
kuboard    NodePort    10.96.148.162   <none>        80:32567/TCP             22m
[root@k8s-master ~]#

  

浏览器访问验证

技术图片

 

 

获取token

[root@k8s-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)

  技术图片

 

 

 

以上是关于k8s搭建kuboard 可视化视图的主要内容,如果未能解决你的问题,请参考以下文章

k8s亲测最好用的可视化 Kuboard 部署教程

使用kuboard快速搭建k8s高可用集群

从零开始搭建kubernetes(二)_Kuboard可视化插件搭建

centos7.6 安装k8s单节点与kuboard

k8s之安装 Kubernetes 多集群管理工具 - Kuboard v3版本

k8s之安装 Kubernetes 多集群管理工具 - Kuboard v3