5

KUR8 : 一款 Kubernetes 集群拓扑和指标可视化工具

 1 year ago
source link: https://www.51cto.com/article/718656.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

KUR8 : 一款 Kubernetes 集群拓扑和指标可视化工具

作者:KUR8 2022-09-14 08:49:01
KUR8 是一个 Kubernetes 拓扑结构和 Prometheus 指标的可视化概览开源工具,只需要使用一个配置文件和 RBAC 授权的权限直接部署到你的 Kubernetes 集群中即可。

KUR8 是一个 Kubernetes 拓扑结构和 Prometheus 指标的可视化概览开源工具,只需要使用一个配置文件和 RBAC 授权的权限直接部署到你的 Kubernetes 集群中即可。KUR8 将在本地启动,让您一目了然地监控 Kubernetes 集群。

结构:浏览 ​​Structure​​ 页面可以以轻松查看你的控制平面和工作节点及其所有 pod,单击组件可查看有关其元数据、状态和规范的更多详细信息,轻松查找有关从容器到入口的任何内容的镜像 ID 或 IP 地址的信息。

图片

指标:使用我们精选的指标仪表板一目了然地了解集群的状态。

图片

自定义指标:使用我们的自定义指标页面来使用 PROMQL 自动完成查询想要的任何指标。

图片

报警:你的所有 Prometheus 报警都会显示在 ​​Alerts​​ 选项卡中,查明是否有任何警报正在触发以及它们属于哪些规则组。

图片

部署 KUR8

可以直接使用下面的资源清单直接部署到你的 Kubernetes 集群中:

# kur8-depl.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kur8-depl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: kur8
  template:
    metadata:
      labels:
        app: kur8
    spec:
      containers:
        - name: kur8
          image: kur8/dashboard:latest
---
apiVersion: v1
kind: Service
metadata:
  name: kur8-srv
  labels:
    prometheus: cluster-monitoring
    k8s-app: kube-state-metrics
spec:
  selector:
    app: kur8
  type: ClusterIP
  ports:
    - name: kur8
      protocol: TCP
      port: 3000
      targetPort: 3000

此外,为了允许读取 API 的资源,你必须配置一组权限。我们已经使用 RBAC 授权设置了一个 YAML 文件,您可以直接应用到你的 Kubernetes 集群中:

# fabric8-rbac.yaml
# NOTE: The service account `default:default` already exists in k8s cluster.
# You can create a new account following like this:
#---
#apiVersion: v1
#kind: ServiceAccount
#metadata:
#  name: <new-account-name>
#  namespace: <namespace>

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
 name: fabric8-rbac
subjects:
 - kind: ServiceAccount
   # Reference to upper's `metadata.name`
   name: default
   # Reference to upper's `metadata.namespace`
   namespace: default
roleRef:
 kind: ClusterRole
 name: cluster-admin
 apiGroup: rbac.authorization.k8s.io

部署完成后可以使用 ​​kubectl port-forward​​ 命令在端口 3068 上打开 KUR8:

kubectl port-forward deployment/kur8-depl 3068:3068

然后,打开你的网络浏览器访问 http://localhost:3068。左侧的结构选项卡将查询您的 Kubernetes API 以查看集群的架构。

部署 Prometheus

如果您没有安装 Prometheus 实例,请首先克隆存储库:

git clone https://github.com/oslabs-beta/KUR8

在 KUR8 目录中运行:

kubectl create -f infra/manifests/setup

设置完成后运行:

kubectl create -f infra/manifests/

如果您想将 Kur8 连接到 Prometheus,请通过以下方式打开端口:

kubectl --namespace monitoring port-forward svc/prometheus-k8s 9090

现在你就可以在 KUR8 中查看 Prometheus 选项卡,查看和创建您的自定义仪表板。​

仓库地址:https://github.com/oslabs-beta/KUR8


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK