Skip to content

No labels in kube_node_labels possibly due to parser issues #1313

Closed
@paulfantom

Description

@paulfantom

What happened:

I tried using --labels-metric-allow-list flag to enable labels in kube_node_labels metric. Depending on quotation markings results were different (described below).

All deployments were made with following cli arguments, only last line was changed in test cases:

    spec:
      containers:
      - args:
        - --host=127.0.0.1
        - --port=8080
        - --telemetry-host=127.0.0.1
        - --telemetry-port=8081
        - --pod=$(POD_NAME)
        - --pod-namespace=$(POD_NAMESPACE)
        - --labels-metric-allow-list="nodes=["kubernetes.io/arch","gpu.infra/intel","network.infra/fast"]"

Test cases tried on a cluster:

  1. all quoted

yaml line: - '--labels-metric-allow-list="nodes=["kubernetes.io/arch","gpu.infra/intel","network.infra/fast"]"'

ksm status: did not start

ksm logs:

invalid argument "\"nodes=[\"kubernetes.io/arch\",\"gpu.infra/intel\",\"network.infra/fast\"]\"" for "--labels-metric-allow-list" flag: invalid format, metric=[label1,label2,labeln...],metricN=[]
  1. quoted labels only

yaml line: - --labels-metric-allow-list=nodes=["kubernetes.io/arch","gpu.infra/intel","network.infra/fast"]

ksm status: ksm started

metric output: kube_node_labels{container="kube-rbac-proxy-main", instance="10.42.5.210:8443", job="kube-state-metrics", node="node01"}

  1. quoted all parameters to cli option

yaml line: - --labels-metric-allow-list="nodes=["kubernetes.io/arch","gpu.infra/intel","network.infra/fast"]"

ksm status: did not start

ksm logs:

invalid argument "\"nodes=[\"kubernetes.io/arch\",\"gpu.infra/intel\",\"network.infra/fast\"]\"" for "--labels-metric-allow-list" flag: invalid format, metric=[label1,label2,labeln...],metricN=[]
  1. quoted array, but not labels

yaml line: - --labels-metric-allow-list="nodes=[kubernetes.io/arch,gpu.infra/intel,network.infra/fast]"

ksm status: did not start

ksm logs:

invalid argument "\"nodes=[kubernetes.io/arch,gpu.infra/intel,network.infra/fast]\"" for "--labels-metric-allow-list" flag: invalid format, metric=[label1,label2,labeln...],metricN=[]
  1. no quotes

yaml line: - --labels-metric-allow-list=nodes=[kubernetes.io/arch,gpu.infra/intel,network.infra/fast]

ksm status: started

metric output: kube_node_labels{container="kube-rbac-proxy-main", instance="10.42.5.202:8443", job="kube-state-metrics", label_gpu_infra_intel="true", label_kubernetes_io_arch="amd64", label_network_infra_fast="true", node="node01"}

What you expected to happen:

kube_node_labels have additional labels and quotation marks don't affect ksm operations.
At a minimum, I would expect test case #5 and #2 to produce the same outcome.

How to reproduce it (as minimally and precisely as possible):

Deploy KSM to k8s environment. The problem doesn't occur when starting KSM from the command line

Anything else we need to know?:

Environment:

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.kind/documentationCategorizes issue or PR as related to documentation.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions