小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

簡單4步,利用Prometheus Operator實現(xiàn)自定義指標監(jiān)控

 可口可愛吧 2021-01-31

在過去的文章中,我們花了相當大的篇幅來聊關于監(jiān)控的話題。這是因為當你正在管理Kubernetes集群時,一切都會以極快的速度發(fā)生變化。因此有一個工具來監(jiān)控集群的健康狀態(tài)和資源指標極為重要。

Rancher 2.5中,我們引入了基于Prometheus Operator的新版監(jiān)控,它可以提供Prometheus以及相關監(jiān)控組件的原生Kubernetes部署和管理。Prometheus Operator可以讓你監(jiān)控集群節(jié)點、Kubernetes組件和應用程序工作負載的狀態(tài)和進程。同時,它還能夠通過Prometheus收集的指標來定義告警并且創(chuàng)建自定義儀表盤,通過Grafana可以輕松地可視化收集到的指標。你可以訪問下列鏈接獲取更多關于新版監(jiān)控組件的細節(jié):

新版本站長交易的監(jiān)控也采用prometheus-adapter,開發(fā)人員可以利用其基于自定義指標和HPA擴展他們的工作負載。

在本文中,我們將探索如何利用Prometheus Operator來抓取自定義指標并利用這些指標進行高級工作負載管理。

安裝Prometheus

Rancher 2.5中安裝Prometheus極為簡單。僅需訪問Cluster Explorer -> Apps并安裝rancher-monitoring即可。

你需要了解以下默認設置:

prometheus-adapter將會作為chart安裝的一部分啟用

ServiceMonitorNamespaceSelector 留為空,允許 Prometheus 在所有命名空間中收集 ServiceMonitors

部署工作負載

現(xiàn)在讓我們部署一個從應用層暴露自定義指標的示例工作負載。該工作負載暴露了一個簡單的應用程序,該應用程序已經(jīng)使用Prometheus client_golang庫進行了檢測,并在/metric端點上提供了一些自定義指標。

它有兩個指標:

http_requests_total

http_request_duration_seconds

以下manifest部署了工作負載、相關服務以及訪問該工作負載的ingress:

apiVersion: apps/v1kind: Deploymentmetadata:

  labels:

    app.kubernetes.io/name: prometheus-example-app

  name: prometheus-example-appspec:

  replicas: 1

  selector:

    matchLabels:

      app.kubernetes.io/name: prometheus-example-app

  template:

    metadata:

      labels:

        app.kubernetes.io/name: prometheus-example-app

    spec:

      containers:

      - name: prometheus-example-app

        image: gmehta3/demo-app:metrics

        ports:

        - name: web

          containerPort: 8080---apiVersion: v1kind: Servicemetadata:

  name: prometheus-example-app

  labels:

    app.kubernetes.io/name: prometheus-example-appspec:

  selector:

    app.kubernetes.io/name: prometheus-example-app

  ports:

    - protocol: TCP

      port: 8080

      targetPort: 8080

      name: web---apiVersion: networking.k8s.io/v1beta1kind: Ingressmetadata:

    name: prometheus-example-appspec:

    rules:

    - host: hpa.demo

      http:

        paths:

        - path: /

          backend:

            serviceName: prometheus-example-app

            servicePort: 8080

    本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內容均由用戶發(fā)布,不代表本站觀點。請注意甄別內容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內容,請點擊一鍵舉報。
    轉藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多