---
title: "获取Pod监控指标"
method: GET
path: "/k8s/cluster/{id}/namespaces/{namespaceName}/pods/{podName}/metrics"
tags: ["K8s监控"]
---

# 获取Pod监控指标

`GET /k8s/cluster/{id}/namespaces/{namespaceName}/pods/{podName}/metrics`

获取指定Pod的CPU、内存等监控指标和使用率

## Path parameters

- `id` integer, required
- `namespaceName` string, required
- `podName` string, required

## Headers

- `Authorization` string, required

## Response `200`

OK

- object
  - `code` integer — 状态码
  - `data` object — 返回的数据
    - `containers` ModelContainerMetricsInfo[] — 容器监控信息列表
      - `limits` ModelResourceUsage
        - `cpu` string — CPU使用量 (如: "100m", "1.5")
        - `memory` string — 内存使用量 (如: "128Mi", "1Gi")
      - `name` string — 容器名称
      - `requests` ModelResourceUsage
        - `cpu` string — CPU使用量 (如: "100m", "1.5")
        - `memory` string — 内存使用量 (如: "128Mi", "1Gi")
      - `restartCount` integer — 重启次数
      - `state` string — 容器状态
      - `usage` ModelResourceUsage
        - `cpu` string — CPU使用量 (如: "100m", "1.5")
        - `memory` string — 内存使用量 (如: "128Mi", "1Gi")
      - `usageRate` ModelResourceUsageRate
        - `cpuRate` number — CPU使用率 (百分比: 0-100)
        - `memoryRate` number — 内存使用率 (百分比: 0-100)
    - `namespace` string — 命名空间
    - `nodeName` string — 节点名称
    - `podName` string — Pod名称
    - `resourceQuota` ModelPodResourceQuota
      - `limits` ModelResourceUsage
        - `cpu` string — CPU使用量 (如: "100m", "1.5")
        - `memory` string — 内存使用量 (如: "128Mi", "1Gi")
      - `requests` ModelResourceUsage
        - `cpu` string — CPU使用量 (如: "100m", "1.5")
        - `memory` string — 内存使用量 (如: "128Mi", "1Gi")
    - `timestamp` string — 采集时间
    - `totalUsage` ModelResourceUsage
      - `cpu` string — CPU使用量 (如: "100m", "1.5")
      - `memory` string — 内存使用量 (如: "128Mi", "1Gi")
    - `usageRate` ModelResourceUsageRate
      - `cpuRate` number — CPU使用率 (百分比: 0-100)
      - `memoryRate` number — 内存使用率 (百分比: 0-100)
  - `message` string — 提示信息

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `404` — Not Found
- `500` — Internal Server Error

---

[API](https://skmtc.dev/opsre/apis/devops.md) · [All operations](https://skmtc.dev/opsre/apis/devops/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/opsre/devops/revisions/25cac8835c4c/schema)
