influxdata / influxdata/telegraf

Extend kube_inventory plugin to include resourcequota measurement and extend node and pod measurement with few more metrics

Open
#9,621 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/prometheus feature request help wanted size/m
Dominant language
Go
Stars
17.8k
Forks
5.8k
Avg merge
1d 20h
Merged PRs (30d)
161

Description

Feature Request

The kubernetes and kube_inventory input plugins have most of the metrics to monitor k8s infrastructure needs but few resources and metrics are still missing from the set of plugins which can be easily extended and will help in better k8s monitoring.

Proposal

The kube_inventory plugin can be extended to not only have capacity and allocatable quantity metrics but also other health metrics like node status, node count and if node is schedulable or not. Also new resource measurement like resourcequoata can be added for better monitoring. These are the metrics that can be easily extended using "k8s.io/api/core/v1" library.

  1. kubernetes_node_condition_status
  2. kubernetes_node_count
  3. kubernetes_unschedulable
Ex. 
for _, val := range n.Status.Conditions {
.
.
    fields["status_condition"] = string(val.Status)
}
fields["spec_unschedulable"] = n.Spec.Unschedulable

Also new measurement type can be included with following metrics.

kubernetes_resourcequota

  • tags:
    • resource
    • namespace
  • fields:
    • hard_cpu_cores_limit
    • hard_memory_bytes_limit
    • hard_pods_limit
    • used_cpu_cores
    • used_memory_bytes
    • used_pods

Current behavior

Currently the metrics mentioned above have not been included in any input plugin.

Desired behavior

After the implementation of the feature, the kube_inventory plugin output should be something like this.

_> kubernetes_node,host=vjain count=8i 1628918652000000000
_> kubernetes_node,condition=Ready,host=vjain,node_name=ip-172-17-0-2.internal,status=True status_condition=1i 1629177980000000000
_> kubernetes_node,cluster_namespace=tools,condition=Ready,host=vjain,node_name=ip-172-17-0-2.internal,status=True allocatable_cpu_cores=4i,allocatable_memory_bytes=7186567168i,allocatable_millicpu_cores=4000i,allocatable_pods=110i,capacity_cpu_cores=4i,capacity_memory_bytes=7291424768i,capacity_millicpu_cores=4000i,capacity_pods=110i,spec_unschedulable=0i,status_condition=1i 1628918652000000000

Use case

We are planning to migrate our monitoring infrastructure from prometheus to telegraf and trying to fill up those gaps in the metrics desired. Combining this feature with already raised https://github.com/influxdata/telegraf/issues/8546 will serve our purpose.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the kube_inventory plugin and the k8s.io/api/core/v1 library, then review how existing node and pod measurements are emitted. Done means adding the requested node condition, node count, unschedulable, and kubernetes_resourcequota metrics with the specified tags and fields, matching the example output.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.