Updated on 2026-04-28 GMT+08:00

Enabling Pod Metrics

CCI 2.0 supports basic monitoring of pod resources with multiple metrics, such as metrics for CPU, memory, disk, and network. Pods have built-in system agents, which provide pod and container metrics over HTTP by default. The agents are integrated into pods and occupy resources in the pods. You are advised to reserve 30-MB memory.

Basic metrics include those for CPU, memory, disk, and network. For details, see Resource Metrics.

Configuration Example

apiVersion: cci/v2
kind: Pod
metadata:
  annotations:
    resource.cci.io/pod-size-specs: 2.00_4.0
    resource.cci.io/instance-type: general-computing # Pod type
    monitoring.cci.io/enable-pod-metrics: 'true'
    monitoring.cci.io/metrics-port: '19100'
  labels:
    app: nginx
  name: 'test2'
  namespace: test
spec:
  containers:
  - name: centos
    image: centos:latest
    resources:
      limits:
        cpu: 2000m
        memory: 4096Mi
      requests:
        cpu: 2000m
        memory: 4096Mi
    command:
    - sh
    - '-c'
    - 'while true; do echo hello; sleep 10; done'	
    lifecycle: {}
  dnsPolicy: ''
  imagePullSecrets:
    - name: imagepull-secret
Table 1 Annotations

Annotation

Mandatory

Type

Description

monitoring.cci.io/enable-pod-metrics

No

String

Whether to enable metric monitoring. The default value is true. The value false indicates that metric monitoring is disabled.

monitoring.cci.io/metrics-port

No

String

Listening port of pod exporter. The value ranges from 1 to 65535. The default value is 19100.

Obtaining Resource Metrics

Once pod metric monitoring is enabled, run the following command on a network that can access the pod to obtain the pod monitoring data:

curl $podIP:$port/metrics
  • $podIP: IP address of the pod
  • $port: listening port