k8s helm方式部署夜莺监控系统

一、夜莺介绍

      Nightingale | 夜莺监控,一款先进的开源云原生监控分析系统,采用 All-In-One 的设计,集数据采集、可视化、监控告警、数据分析于一体,与云原生生态紧密集成,提供开箱即用的企业级监控分析和告警能力。于 2022 年 5 月 11 日,捐赠予中国计算机学会开源发展委员会(CCF ODC),为 CCF ODC 成立后接受捐赠的首个开源项目。

特性:

夜莺系统架构

官网地址:https://n9e.github.io/

官方文档:https://n9e.github.io/docs/prologue/introduction/

GitHub仓库地址:https://github.com/flashcatcloud/n9e-helm

二、安装部署openebs存储

克隆夜莺github项目到本地

git clone https://github.com/flashcatcloud/n9e-helm.git

安装openebs存储

openebs安装部署参考文档:https://blog.mafeifan.com/DevOps/K8s/k8s-%E5%9F%BA%E7%A1%80-%E5%AE%89%E8%A3%85OpenEBS.html#local-pv

kubectl apply -f https://openebs.github.io/charts/openebs-operator.yaml

kubectl patch storageclass openebs-hostpath  -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'    #设置openebs-hostpath为默认存储类

[root@sealyun-k8s-master-01 ~]# kubectl get pod -n openebs
NAME                                            READY   STATUS    RESTARTS   AGE
openebs-localpv-provisioner-6994cf5dd9-ct9ld    1/1     Running   7          20d
openebs-ndm-cluster-exporter-84bb5fc764-rf7jr   1/1     Running   3          20d
openebs-ndm-ksccz                               1/1     Running   2          20d
openebs-ndm-mtrds                               1/1     Running   2          20d
openebs-ndm-node-exporter-6sjh2                 1/1     Running   3          20d
openebs-ndm-node-exporter-7cvxl                 1/1     Running   4          20d
openebs-ndm-operator-5f8578c994-wds88           1/1     Running   3          20d
[root@sealyun-k8s-master-01 ~]# kubectl get sc -n openebs
NAME                         PROVISIONER        RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
openebs-device               openebs.io/local   Delete          WaitForFirstConsumer   false                  20d
openebs-hostpath (default)   openebs.io/local   Delete          WaitForFirstConsumer   false                  20d
[root@sealyun-k8s-master-01 ~]# 
[root@sealyun-k8s-master-01 ~]# 

三、通过helm安装部署夜莺监控系统

[root@sealyun-k8s-master-01 ~]# helm install nightingale ./n9e-helm -n n9e --create-namespace
NAME: nightingale
LAST DEPLOYED: Fri Sep 30 14:25:54 2022
NAMESPACE: n9e
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Please wait for several minutes for nightingale deployment to complete.
Then you should be able to visit the nightingale web at http://hello.n9e.info
For more details, please visit https://github.com/flashcat/n9e-helm
[root@sealyun-k8s-master-01 ~]#
[root@sealyun-k8s-master-01 ~]# 
[root@sealyun-k8s-master-01 ~]# 
[root@sealyun-k8s-master-01 ~]# kubectl get pod -n n9e
NAME                                   READY   STATUS    RESTARTS   AGE
nightingale-categraf-4vzcp             1/1     Running   84         24h
nightingale-categraf-9qzlw             1/1     Running   85         24h
nightingale-categraf-f6shc             1/1     Running   86         24h
nightingale-categraf-jblrk             1/1     Running   86         24h
nightingale-categraf-m54mr             1/1     Running   85         24h
nightingale-database-0                 1/1     Running   0          24h
nightingale-nserver-b8d66fb69-75blt    1/1     Running   6          24h
nightingale-nwebapi-679446f848-mg6b6   1/1     Running   6          24h
nightingale-prometheus-0               1/1     Running   0          24h
nightingale-redis-0                    1/1     Running   0          24h
[root@sealyun-k8s-master-01 ~]# kubectl get pvc -n n9e
NAME                                       STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS       AGE
data-nightingale-redis-0                   Bound    pvc-40b9f9d7-1cfa-4385-b9d8-8b461d2f8bda   1Gi        RWO            openebs-hostpath   24h
database-data-nightingale-database-0       Bound    pvc-4cafb849-a127-4097-8b4e-4495a7f98bba   4Gi        RWO            openebs-hostpath   24h
prometheus-data-nightingale-prometheus-0   Bound    pvc-41e89e56-aa6d-4f8d-95c2-80768b39b7be   4Gi        RWO            openebs-hostpath   24h
[root@sealyun-k8s-master-01 ~]# kubectl get pv -n n9e
NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                                          STORAGECLASS       REASON   AGE
pvc-40b9f9d7-1cfa-4385-b9d8-8b461d2f8bda   1Gi        RWO            Delete           Bound    n9e/data-nightingale-redis-0                   openebs-hostpath            24h
pvc-41e89e56-aa6d-4f8d-95c2-80768b39b7be   4Gi        RWO            Delete           Bound    n9e/prometheus-data-nightingale-prometheus-0   openebs-hostpath            24h
pvc-4cafb849-a127-4097-8b4e-4495a7f98bba   4Gi        RWO            Delete           Bound    n9e/database-data-nightingale-database-0       openebs-hostpath            24h
[root@sealyun-k8s-master-01 ~]# 

编辑service文件,配置NodePort,让外部访问

[root@sealyun-k8s-master-01 ~]# kubectl get svc -n n9e
NAME                     TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
nightingale-database     ClusterIP   10.101.85.240   <none>        3306/TCP       24h
nightingale-nserver      ClusterIP   10.107.203.36   <none>        80/TCP         24h
nightingale-nwebapi      ClusterIP   10.111.55.177   <none>        80/TCP         24h
nightingale-prometheus   ClusterIP   10.99.128.168   <none>        9090/TCP       24h
nightingale-redis        ClusterIP   10.108.49.114   <none>        6379/TCP       24h
[root@sealyun-k8s-master-01 ~]# 
[root@sealyun-k8s-master-01 ~]# 
[root@sealyun-k8s-master-01 ~]# 
[root@sealyun-k8s-master-01 ~]# kubectl edit svc -n n9e nightingale-nwebapi
# 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
kind: Service
metadata:
  annotations:
    meta.helm.sh/release-name: nightingale
    meta.helm.sh/release-namespace: n9e
  creationTimestamp: "2022-09-30T06:25:58Z"
  labels:
    app: n9e
    app.kubernetes.io/managed-by: Helm
    chart: nightingale
    heritage: Helm
    release: nightingale
  name: nightingale-nwebapi
  namespace: n9e
  resourceVersion: "4892288"
  selfLink: /api/v1/namespaces/n9e/services/nightingale-nwebapi
  uid: 000a6a3d-c55a-48a6-99dd-7de5f01ba500
spec:
  clusterIP: 10.111.55.177
  externalTrafficPolicy: Cluster
  ports:
  - name: nwebapi-port
    port: 80
    protocol: TCP
    targetPort: 18000
  selector:
    app: n9e
    component: nwebapi
    release: nightingale
  sessionAffinity: None
  type: ClusterIP  #修此处改为NodePort
status:
  loadBalancer: {}

[root@sealyun-k8s-master-01 ~]# kubectl get svc -n n9e
NAME                     TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
nightingale-database     ClusterIP   10.101.85.240   <none>        3306/TCP       24h
nightingale-nserver      ClusterIP   10.107.203.36   <none>        80/TCP         24h
nightingale-nwebapi      NodePort    10.111.55.177   <none>        80:53003/TCP   24h
nightingale-prometheus   ClusterIP   10.99.128.168   <none>        9090/TCP       24h
nightingale-redis        ClusterIP   10.108.49.114   <none>        6379/TCP       24h
[root@sealyun-k8s-master-01 ~]# 

卸载夜莺项目:helm uninstall  nightingale -n n9e

此时可以通过NodePort端口访问夜莺监控系统

http://172.16.88.181   root  root.2020

 

posted @ 2022-10-01 15:09  cyh00001  阅读(1655)  评论(1编辑  收藏  举报