Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[[inputs.kubernetes]]The component cannot collect pod memory usage, pod network rx, and tx metrics of the new version of k8s after kubernetes 1.18 version #16374

Open
RebortBoss opened this issue Jan 7, 2025 · 2 comments
Labels
bug unexpected problem or unintended behavior

Comments

@RebortBoss
Copy link

Relevant telegraf.conf

[agent]
  collection_jitter = "0s"
  debug = false
  flush_interval = "10s"
  flush_jitter = "0s"
  hostname = "$HOSTNAME"
  interval = "10s"
  logfile = ""
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  omit_hostname = false
  precision = ""
  quiet = false
  round_interval = true


[[outputs.influxdb]]
  database = "telegraf_k8s"
  insecure_skip_verify = false
  password = "admin"
  retention_policy = ""
  timeout = "5s"
  urls = [
    "http://192.168.0.163:8086"
  ]
  user_agent = "telegraf"
  username = "admin"


[[inputs.kernel]]
[[inputs.mem]]
[[inputs.nstat]]
[[inputs.processes]]
[[inputs.swap]]
[[inputs.system]]
[[inputs.cpu]]
  collect_cpu_time = false
  percpu = true
  report_active = false
  totalcpu = true
[[inputs.disk]]
  ignore_fs = [
    "tmpfs",
    "devtmpfs",
    "devfs",
    "iso9660",
    "overlay",
    "aufs",
    "squashfs"
  ]
[[inputs.kubernetes]]
  bearer_token = "/var/run/secrets/kubernetes.io/serviceaccount/token"
  insecure_skip_verify = true
  url = "https://$HOSTIP:10250"

#[[inputs.docker]]
#endpoint = "unix:///var/run/docker.sock"

Logs from Telegraf

> kubernetes_pod_container,container_name=kube-apiserver,host=host-231-01,image=registry.cn-beijing.aliyuncs.com/kubesphereio/kube-apiserver:v1.24.7,namespace=kube-system,node_name=host-231-01,pod_name=kube-apiserver-host-231-01,version=v1.24.7 cpu_usage_core_nanoseconds=2731334434123i,cpu_usage_nanocores=110577062i,logsfs_available_bytes=7028555776i,logsfs_capacity_bytes=18238930944i,logsfs_used_bytes=0i,memory_major_page_faults=0i,memory_page_faults=0i,memory_rss_bytes=0i,memory_usage_bytes=0i,memory_working_set_bytes=430616576i,rootfs_available_bytes=7028555776i,rootfs_capacity_bytes=18238930944i,rootfs_used_bytes=0i 1736243417000000000
> kubernetes_pod_network,host=host-231-01,namespace=kube-system,node_name=host-231-01,pod_name=kube-apiserver-host-231-01 rx_bytes=0i,rx_errors=0i,tx_bytes=0i,tx_errors=0i 1736243417000000000
> kubernetes_pod_container,container_name=kube-controller-manager,host=host-231-01,image=registry.cn-beijing.aliyuncs.com/kubesphereio/kube-controller-manager:v1.24.7,namespace=kube-system,node_name=host-231-01,pod_name=kube-controller-manager-host-231-01,version=v1.24.7 cpu_usage_core_nanoseconds=1238134664526i,cpu_usage_nanocores=52455567i,logsfs_available_bytes=7028555776i,logsfs_capacity_bytes=18238930944i,logsfs_used_bytes=0i,memory_major_page_faults=0i,memory_page_faults=0i,memory_rss_bytes=0i,memory_usage_bytes=0i,memory_working_set_bytes=96800768i,rootfs_available_bytes=7028555776i,rootfs_capacity_bytes=18238930944i,rootfs_used_bytes=0i 1736243417000000000
> kubernetes_pod_network,host=host-231-01,namespace=kube-system,node_name=host-231-01,pod_name=kube-controller-manager-host-231-01 rx_bytes=0i,rx_errors=0i,tx_bytes=0i,tx_errors=0i 1736243417000000000
字段值memory_usage_bytes=0i 、rx_bytes=0i,tx_bytes=0i均为0.

System info

Telegraf 1.26-1.32、centos7.9、docker 20.10.11

Docker

No response

Steps to reproduce

1.在k8s集群中,通过helm(telegraf-ds)部署telegraf,镜像版本(telegraf1.22、1.26、1.28、1.32),修改telegraf.conf输出。
2.output输出到influxdb时序数据库,查看字段为空

Expected behavior

预期表kubernetes_pod_container字段memory_usage_bytes=0i 、表kubernetes_pod_network中rx_bytes=0i,tx_bytes=0i应该有数据采集到

Actual behavior

实际采集到表kubernetes_pod_container字段memory_usage_bytes=0i 、表kubernetes_pod_network中rx_bytes=0i,tx_bytes=0i都为0

Additional info

@RebortBoss RebortBoss added the bug unexpected problem or unintended behavior label Jan 7, 2025
@RebortBoss RebortBoss changed the title The component cannot collect pod memory usage, pod network rx, and tx metrics of the new version of k8s [[inputs.kubernetes]]The component cannot collect pod memory usage, pod network rx, and tx metrics of the new version of k8s Jan 7, 2025
@RebortBoss RebortBoss changed the title [[inputs.kubernetes]]The component cannot collect pod memory usage, pod network rx, and tx metrics of the new version of k8s [[inputs.kubernetes]]The component cannot collect pod memory usage, pod network rx, and tx metrics of the new version of k8s after kubernetes 1.18 version Jan 7, 2025
@redbaron
Copy link
Contributor

redbaron commented Jan 7, 2025

Does all pods on a node get no network stats or just some? I recon pods run in host network namespace they get no stats reported by kubelet.

@RebortBoss
Copy link
Author

None of the pods on the node are getting network statistics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants