k8s搭建kuboard-v3可视化交互工具

官网使用教程;Kubernetes教程 | Kuboard

https://kuboard.cn/learning/

  • 简介

Kuboard是一个基于Web的Kubernetes管理工具,旨在帮助用户更轻松地可视化和管理其Kubernetes集群。Kuboard提供了一个直观、功能丰富的用户界面,使用户可以方便地查看和操作Kubernetes集群中的各种资源,包括Pod、Deployment、Service、Namespace等。以下是一些让人想使用Kuboard的特点和优势:

1,直观的用户界面:Kuboard提供了一个直观、易于使用的Web界面,用户无需深入了解Kubernetes的命令行操作,即可轻松管理集群中的资源。

2,资源监控和日志查看:Kuboard提供了资源监控功能,用户可以实时查看集群中各种资源的使用情况,包括CPU、内存、网络等指标。此外,Kuboard还提供了日志查看功能,方便用户查看Pod的日志信息。

3,资源管理和操作:用户可以通过Kuboard对集群中的资源进行管理和操作,包括创建、删除、扩缩容等操作,从而更方便地管理Kubernetes集群。

4,命名空间管理:Kuboard支持对命名空间进行管理,用户可以在不同的命名空间中查看和操作资源,帮助用户更好地组织和管理集群中的资源。

5,事件查看:Kuboard还提供了事件查看功能,用户可以查看集群中发生的事件,帮助快速定位和解决问题。

总的来说,Kuboard是一个功能丰富、易于使用的Kubernetes管理工具,可以帮助用户更直观地了解和管理其Kubernetes集群。如果您希望通过一个直观、功能丰富的Web界面来管理您的Kubernetes集群,Kuboard可能是一个很好的选择。试用Kuboard可能会让您的Kubernetes管理体验更加愉快和高效。如果您有任何其他问题或需要更多信息,请随时告诉我。我将很乐意帮助您。

可视化交互工具,只需要输入服务名称、镜像地址等信息,就可以创建好一个服务

kuboard官网:https://kuboard.cn/

二、kuboard部署

1、获取kuboard的yaml文件

这是华为云的镜像仓库替代 docker hub 分发 Kuboard 所需要的镜像

wget https://addons.kuboard.cn/kuboard/kuboard-v3-swr.yaml

2、修改kuboard-v3-swr.yaml

记得将nodeName: k8s-master改为自己的master的名称

---

apiVersion: v1

kind: Namespace

metadata:

  name: kuboard

---

apiVersion: v1

kind: ConfigMap

metadata:

  name: kuboard-v3-config

  namespace: kuboard

data:

  # 关于如下参数的解释,请参考文档 https://kuboard.cn/install/v3/install-built-in.html

  # [common]

  KUBOARD_SERVER_NODE_PORT: '30080'

  KUBOARD_AGENT_SERVER_UDP_PORT: '30081'

  KUBOARD_AGENT_SERVER_TCP_PORT: '30081'

  KUBOARD_SERVER_LOGRUS_LEVEL: info  # error / debug / trace

  # KUBOARD_AGENT_KEY 是 Agent 与 Kuboard 通信时的密钥,请修改为一个任意的包含字母、数字的32位字符串,此密钥变更后,需要删除 Kuboard Agent 重新导入。

  KUBOARD_AGENT_KEY: 32b7d6572c6255211b4eec9009e4a816

  KUBOARD_AGENT_IMAG: swr.cn-east-2.myhuaweicloud.com/kuboard/kuboard-agent

  KUBOARD_QUESTDB_IMAGE: swr.cn-east-2.myhuaweicloud.com/kuboard-dependency/questdb:6.0.4

  KUBOARD_DISABLE_AUDIT: 'false' # 如果要禁用 Kuboard 审计功能,将此参数的值设置为 'true',必须带引号。

  # 关于如下参数的解释,请参考文档 https://kuboard.cn/install/v3/install-gitlab.html

  # [gitlab login]

  # KUBOARD_LOGIN_TYPE: "gitlab"

  # KUBOARD_ROOT_USER: "your-user-name-in-gitlab"

  # GITLAB_BASE_URL: "http://gitlab.mycompany.com"

  # GITLAB_APPLICATION_ID: "7c10882aa46810a0402d17c66103894ac5e43d6130b81c17f7f2d8ae182040b5"

  # GITLAB_CLIENT_SECRET: "77c149bd3a4b6870bffa1a1afaf37cba28a1817f4cf518699065f5a8fe958889"

  

  # 关于如下参数的解释,请参考文档 https://kuboard.cn/install/v3/install-github.html

  # [github login]

  # KUBOARD_LOGIN_TYPE: "github"

  # KUBOARD_ROOT_USER: "your-user-name-in-github"

  # GITHUB_CLIENT_ID: "17577d45e4de7dad88e0"

  # GITHUB_CLIENT_SECRET: "ff738553a8c7e9ad39569c8d02c1d85ec19115a7"

  # 关于如下参数的解释,请参考文档 https://kuboard.cn/install/v3/install-ldap.html

  # [ldap login]

  # KUBOARD_LOGIN_TYPE: "ldap"

  # KUBOARD_ROOT_USER: "your-user-name-in-ldap"

  # LDAP_HOST: "ldap-ip-address:389"

  # LDAP_BIND_DN: "cn=admin,dc=example,dc=org"

  # LDAP_BIND_PASSWORD: "admin"

  # LDAP_BASE_DN: "dc=example,dc=org"

  # LDAP_FILTER: "(objectClass=posixAccount)"

  # LDAP_ID_ATTRIBUTE: "uid"

  # LDAP_USER_NAME_ATTRIBUTE: "uid"

  # LDAP_EMAIL_ATTRIBUTE: "mail"

  # LDAP_DISPLAY_NAME_ATTRIBUTE: "cn"

  # LDAP_GROUP_SEARCH_BASE_DN: "dc=example,dc=org"

  # LDAP_GROUP_SEARCH_FILTER: "(objectClass=posixGroup)"

  # LDAP_USER_MACHER_USER_ATTRIBUTE: "gidNumber"

  # LDAP_USER_MACHER_GROUP_ATTRIBUTE: "gidNumber"

  # LDAP_GROUP_NAME_ATTRIBUTE: "cn"

---

apiVersion: v1

kind: ServiceAccount

metadata:

  name: kuboard-boostrap

  namespace: kuboard

---

apiVersion: rbac.authorization.k8s.io/v1

kind: ClusterRoleBinding

metadata:

  name: kuboard-boostrap-crb

roleRef:

  apiGroup: rbac.authorization.k8s.io

  kind: ClusterRole

  name: cluster-admin

subjects:

- kind: ServiceAccount

  name: kuboard-boostrap

  namespace: kuboard

---

apiVersion: apps/v1

kind: DaemonSet

metadata:

  labels:

    k8s.kuboard.cn/name: kuboard-etcd

  name: kuboard-etcd

  namespace: kuboard

spec:

  revisionHistoryLimit: 10

  selector:

    matchLabels:

      k8s.kuboard.cn/name: kuboard-etcd

  template:

    metadata:

      labels:

        k8s.kuboard.cn/name: kuboard-etcd

    spec:

      affinity:

        nodeAffinity:

          requiredDuringSchedulingIgnoredDuringExecution:

            nodeSelectorTerms:

              - matchExpressions:

                  - key: node-role.kubernetes.io/master

                    operator: Exists

              - matchExpressions:

                  - key: node-role.kubernetes.io/control-plane

                    operator: Exists

              - matchExpressions:

                  - key: k8s.kuboard.cn/role

                    operator: In

                    values:

                      - etcd

      containers:

        - env:

            - name: HOSTNAME

              valueFrom:

                fieldRef:

                  apiVersion: v1

                  fieldPath: spec.nodeName

            - name: HOSTIP

              valueFrom:

                fieldRef:

                  apiVersion: v1

                  fieldPath: status.hostIP

          image: 'swr.cn-east-2.myhuaweicloud.com/kuboard/etcd-host:3.4.16-2'

          imagePullPolicy: Always

          name: etcd

          ports:

            - containerPort: 2381

              hostPort: 2381

              name: server

              protocol: TCP

            - containerPort: 2382

              hostPort: 2382

              name: peer

              protocol: TCP

          livenessProbe:

            failureThreshold: 3

            httpGet:

              path: /health

              port: 2381

              scheme: HTTP

            initialDelaySeconds: 30

            periodSeconds: 10

            successThreshold: 1

            timeoutSeconds: 1

          volumeMounts:

            - mountPath: /data

              name: data

      dnsPolicy: ClusterFirst

      hostNetwork: true

      restartPolicy: Always

      serviceAccount: kuboard-boostrap

      serviceAccountName: kuboard-boostrap

      tolerations:

        - key: node-role.kubernetes.io/master

          operator: Exists

        - key: node-role.kubernetes.io/control-plane

          operator: Exists

      volumes:

        - hostPath:

            path: /usr/share/kuboard/etcd

          name: data

  updateStrategy:

    rollingUpdate:

      maxUnavailable: 1

    type: RollingUpdate

---

apiVersion: apps/v1

kind: Deployment

metadata:

  annotations: {}

  labels:

    k8s.kuboard.cn/name: kuboard-v3

  name: kuboard-v3

  namespace: kuboard

spec:

  replicas: 1

  revisionHistoryLimit: 10

  selector:

    matchLabels:

      k8s.kuboard.cn/name: kuboard-v3

  template:

    metadata:

      labels:

        k8s.kuboard.cn/name: kuboard-v3

    spec:

      nodeName: k8s-master #######增加这个为k8s得主节点node名称

      affinity:

        nodeAffinity:

          preferredDuringSchedulingIgnoredDuringExecution:

            - preference:

                matchExpressions:

                  - key: node-role.kubernetes.io/master

                    operator: Exists

              weight: 100

            - preference:

                matchExpressions:

                  - key: node-role.kubernetes.io/control-plane

                    operator: Exists

              weight: 100

      containers:

        - env:

            - name: HOSTIP

              valueFrom:

                fieldRef:

                  apiVersion: v1

                  fieldPath: status.hostIP

            - name: HOSTNAME

              valueFrom:

                fieldRef:

                  apiVersion: v1

                  fieldPath: spec.nodeName

          envFrom:

            - configMapRef:

                name: kuboard-v3-config

          image: 'swr.cn-east-2.myhuaweicloud.com/kuboard/kuboard:v3'

          imagePullPolicy: Always

          livenessProbe:

            failureThreshold: 3

            httpGet:

              path: /kuboard-resources/version.json

              port: 80

              scheme: HTTP

            initialDelaySeconds: 30

            periodSeconds: 10

            successThreshold: 1

            timeoutSeconds: 1

          name: kuboard

          ports:

            - containerPort: 80

              name: web

              protocol: TCP

            - containerPort: 443

              name: https

              protocol: TCP

            - containerPort: 10081

              name: peer

              protocol: TCP

            - containerPort: 10081

              name: peer-u

              protocol: UDP

          readinessProbe:

            failureThreshold: 3

            httpGet:

              path: /kuboard-resources/version.json

              port: 80

              scheme: HTTP

            initialDelaySeconds: 30

            periodSeconds: 10

            successThreshold: 1

            timeoutSeconds: 1

          resources: {}

          # startupProbe:

          #   failureThreshold: 20

          #   httpGet:

          #     path: /kuboard-resources/version.json

          #     port: 80

          #     scheme: HTTP

          #   initialDelaySeconds: 5

          #   periodSeconds: 10

          #   successThreshold: 1

          #   timeoutSeconds: 1

      dnsPolicy: ClusterFirst

      restartPolicy: Always

      serviceAccount: kuboard-boostrap

      serviceAccountName: kuboard-boostrap

      tolerations:

        - key: node-role.kubernetes.io/master

          operator: Exists

---

apiVersion: v1

kind: Service

metadata:

  annotations: {}

  labels:

    k8s.kuboard.cn/name: kuboard-v3

  name: kuboard-v3

  namespace: kuboard

spec:

  ports:

    - name: web

      nodePort: 30080

      port: 80

      protocol: TCP

      targetPort: 80

    - name: tcp

      nodePort: 30081

      port: 10081

      protocol: TCP

      targetPort: 10081

    - name: udp

      nodePort: 30081

      port: 10081

      protocol: UDP

      targetPort: 10081

  selector:

    k8s.kuboard.cn/name: kuboard-v3

  sessionAffinity: None

  type: NodePort

1

2

��污点

Master一般默认作为调度节点,让其工作的话 ,将master作为node加入node:

kubectl taint nodes --all node-role.kubernetes.io/master-

��给master打上污点:NoSchedule:一定不能被调度

kubectl taint nodes k8s-master node-role.kubernetes.io/master=

��查看污点:

kubectl describe node k8s-master | grep Taints

��去掉污点:

kubectl taint nodes --all node-role.kubernetes.io/master-

3、创建kuboard

kubectl apply -f kuboard-v3-swr.yaml

1

4、查看创建情况

查看是否创建在master上,否者后期有很多问题。

watch kubectl get pod -n kuboard -o wide

1

5、访问UI界面

浏览器访问:http://masterIP:30080

账号:admin

密码:Kuboard123

三、kuboard初始化

1、添加集群

有两种方式:1、导入集群的配置文件。2、安装agent端。

2、安装metrics-server和metrics-scraper(安装在master节点)

如果出现不在master节点上,就在kuboard界面找到对应的pod修改yaml文件。

在Deployment任务的第二个spec下增加一条强制pod运行在master上。

nodeName: k8s-master

(注意yaml文件格式!!)

具体操作

1,实时监控和操作资源2日志追踪3传文件4堡垒机-可以直接连接powershell进入pod操作5搜索功能6证书有效期报警,7,十分方便的创建deployment

  1. 选择pod后可以直接通过powershell操作,自带堡垒机
  2. 十分简单方便的创造容器,填个端口,镜像(自动拉取),名字就自动做出来了

展现层》nginx》

原文参考文档:

k8s搭建kuboard-v3,手把手教你搭建-CSDN博客

Logo

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

更多推荐