2.14. 为单模型服务平台配置监控


单型号服务平台包括 KServe 组件支持的运行时 的指标。KServe 不会生成自己的指标,并依赖于底层模型服务运行时来提供它们。已部署模型的可用指标集合取决于其模型的运行时。

除了 KServe 的运行时指标外,您还可以为 OpenShift Service Mesh 配置监控。OpenShift Service Mesh 指标可帮助您了解网格中组件之间的依赖项和流量流。

先决条件

流程

  1. 在一个终端窗口中,如果您还没有以集群管理员登录到 OpenShift 集群,请登录 OpenShift CLI,如下例所示:

    $ oc login <openshift_cluster_url> -u <admin_username> -p <password>
    Copy to Clipboard Toggle word wrap
  2. 在名为 uwm-cm-conf.yaml 的 YAML 文件中定义 ConfigMap 对象,其内容如下:

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: user-workload-monitoring-config
      namespace: openshift-user-workload-monitoring
    data:
      config.yaml: |
        prometheus:
          logLevel: debug
          retention: 15d
    Copy to Clipboard Toggle word wrap

    user-workload-monitoring-config 对象配置监控用户定义的项目的组件。观察到保留时间被设置为推荐的值 15 天。

  3. 应用配置以创建 user-workload-monitoring-config 对象。

    $ oc apply -f uwm-cm-conf.yaml
    Copy to Clipboard Toggle word wrap
  4. 在名为 uwm-cm-enable.yaml 的 YAML 文件中定义另一个 ConfigMap 对象,其内容如下:

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: cluster-monitoring-config
      namespace: openshift-monitoring
    data:
      config.yaml: |
        enableUserWorkload: true
    Copy to Clipboard Toggle word wrap

    cluster-monitoring-config 对象为用户定义的项目启用监控。

  5. 应用配置以创建 cluster-monitoring-config 对象。

    $ oc apply -f uwm-cm-enable.yaml
    Copy to Clipboard Toggle word wrap
  6. 创建 ServiceMonitorPodMonitor 对象来监控服务网格 control plane 中的指标,如下所示:

    1. 使用以下内容创建 istiod-monitor.yaml YAML 文件:

      apiVersion: monitoring.coreos.com/v1
      kind: ServiceMonitor
      metadata:
        name: istiod-monitor
        namespace: istio-system
      spec:
        targetLabels:
        - app
        selector:
          matchLabels:
            istio: pilot
        endpoints:
        - port: http-monitoring
          interval: 30s
      Copy to Clipboard Toggle word wrap
    2. 在指定的 istio-system 命名空间中部署 ServiceMonitor CR。

      $ oc apply -f istiod-monitor.yaml
      Copy to Clipboard Toggle word wrap

      您会看到以下输出:

      servicemonitor.monitoring.coreos.com/istiod-monitor created
      Copy to Clipboard Toggle word wrap
    3. 使用以下内容创建 istio-proxies-monitor.yaml YAML 文件:

      apiVersion: monitoring.coreos.com/v1
      kind: PodMonitor
      metadata:
        name: istio-proxies-monitor
        namespace: istio-system
      spec:
        selector:
          matchExpressions:
          - key: istio-prometheus-ignore
            operator: DoesNotExist
        podMetricsEndpoints:
        - path: /stats/prometheus
          interval: 30s
      Copy to Clipboard Toggle word wrap
    4. 在指定的 istio-system 命名空间中部署 PodMonitor CR。

      $ oc apply -f istio-proxies-monitor.yaml
      Copy to Clipboard Toggle word wrap

      您会看到以下输出:

      podmonitor.monitoring.coreos.com/istio-proxies-monitor created
      Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat