Introduction
Apart from infrastructure metrics like CPU, memory, disk IO, etc., applications generate metrics based on their app logic. For example, DB applications can have several queries, several pending transactions, and so on; message broker applications can have several topics, several messages not delivered, and so on. These metrics are essential in debugging and finding out root-causing issues.
Kubernetes 2.0 provides a mechanism to display both application/workload metrics and the infrastructure metrics of pods.
Supported Workload Metrics
- HAProxy Receiver
- JMX Receiver
- Kafka Receiver
- MySQL Receiver
- Nginx Receiver
- Prometheus Receiver
- Redis Receiver
- Spark Receiver
ConfigMap
All workload ConfigMaps share a consistent syntax. The key fields such as targetPodSelector, auth, and others are explained below, with examples from the opsramp-workload-metric-user-config. To view the current configuration, run:
kubectl get configmap opsramp-workload-metric-user-config -n <agent-installed-namespace>Sample ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
name: opsramp-workload-metric-user-config
namespace: opsramp-agent
data:
workloads: |
redis:
- name: redis
auth: none
port: 6379
collectionFrequency: 2m
targetPodSelector:
matchLabels:
- key: app
operator: ==
value:
- redis
- name: redis-with-tls
auth: tls
certFile:
source: secret
value: default/redis-tls-client/redis-client.crt
keyFile:
source: secret
value: default/redis-tls-client/redis-client.key
port: 6379
collectionFrequency: 2m
targetPodSelector:
matchLabels:
- key: app
operator: ==
value:
- redis-tls
- name: redis-with-credentials
auth: credentials
userName:
source: value
value: sri
password:
source: configmap
value: default/redis-config/REDIS_PASSWORD
port: 6379
collectionFrequency: 2m
targetPodSelector:
matchLabels:
- key: app
operator: ==
value:
- redis-credsConfiguration Parameters
| Field | Description |
|---|---|
| workload/application | Name of the workload/application. |
| name | Unique name for the workload configuration. |
| collectionFrequency | Collection frequency (e.g., 10s, 30m, 1h). Default value is 1m. |
| auth | Authentication method (options: none, credentials, tls). |
| userName | Username used for authentication. |
| password | Password used for authentication. |
| port | Port number where metrics are exposed for the workload. |
| targetPodSelector | Criteria to select target pods. All specified conditions must match to select a pod. |
| matchLabels | Specifies matching criteria for pod labels. |
| key | Pod label key. |
| operator | Operator to compare the key (options: ==, !=, =, in, notin, exists, !exists). |
| value | Pod label values as an array of strings. |
Troubleshooting
If you encounter workload metrics related issues, see the Troubleshooting documentation.