Enable Kube State Metrics

The latest versions of Sysdig agent by default collects the following families of Kube State Metrics (KSM).

  • services
  • resourcequotas
  • persistentvolumes
  • persistentvolumeclaims
  • storageclasses

However you can further customize KSM collection for specific metrics as follows:

Customize KSM Collection

Agent Versions 12.9.0 and Onward

The Agent adds support for ingresses and certificatesigningrequests. They are not collected by default. To enable the agent to collect them, you must edit the agent configuration file, dragent.yaml, and include them along with the other resources you would like to collect.

For example, to collect all supported resources including ingresses and certificatesigningrequests, add the following to dragent.yaml:

k8s_extra_resources:
    include:
      - ingresses
      - certificatesigningrequests
      - services
      - resourcequotas
      - persistentvolumes
      - persistentvolumeclaims
      - horizontalpodautoscalers

NOTE: Adding only the ingresses or certificatesigningrequests configuration as follows will overwrite ingesting the other services.

k8s_extra_resources:
    include:
      - ingresses
      - certificatesigningrequests

Agent Versions 12.5.0 and Onward

horizontalpodautoscalers (HPA) kube state metrics are not collected by default. To enable the agent to collect HPA kube state metrics, you must edit the agent configuration file, dragent.yaml, and include it along with the other resources you would like to collect.

For example, to collect all supported resources including HPAs, add the following to dragent.yaml:

k8s_extra_resources:
    include:
      - services
      - resourcequotas
      - persistentvolumes
      - persistentvolumeclaims
      - horizontalpodautoscalers

NOTE: Adding only the horizontalpodautoscalers configuration as follows will overwrite ingesting the other five services given above.

k8s_extra_resources:
    include:
      - horizontalpodautoscalers

Therefore, ensure that you include the entire block of configuration corresponding to all the Kubernetes resources.

Agent Versions 12.3.x and 12.4.x

The Sysdig agent collects HPA, PVS, PV, Resourcequota, and Services kube state metrics by default.

To disable some of them, you must edit the agent config file, dragent.yaml, as follows:

k8s_extra_resources:
    include:
      - services
      - resourcequotas
      - persistentvolumes
      - persistentvolumeclaims
      - horizontalpodautoscalers

The above list includes all the supported resources so you must remove the resources you are not interested in. For example, if you want to disable services, use the following:

k8s_extra_resources:
    include:
      - resourcequotas
      - persistentvolumes
      - persistentvolumeclaims
      - horizontalpodautoscalers

For more information, see Understanding the Agent Configuration Files.