Skip to content

Instantly share code, notes, and snippets.

@bells17
Created February 10, 2022 16:06
Show Gist options
  • Save bells17/b3256d6e2172d5b6089a4e4b951f7494 to your computer and use it in GitHub Desktop.
Save bells17/b3256d6e2172d5b6089a4e4b951f7494 to your computer and use it in GitHub Desktop.
$ kind create cluster
$ docker exec -it kind-control-plane bash
# apt-get update -y
# apt-get install -y curl jq python3 python3-pip python3-setuptools
# pip3 --no-cache-dir install yq
# cat /etc/kubernetes/admin.conf | yq -r .users[0].user.\"client-certificate-data\" | base64 -d > /tmp/cacert.pem
# cat /etc/kubernetes/admin.conf | yq -r .users[0].user.\"client-key-data\" | base64 -d > /tmp/key.pem
# curl -k --cert /tmp/cacert.pem --key /tmp/key.pem https://$(kubectl get node kind-control-plane -o jsonpath="{.status.addresses[0].address}"):10250/metrics/resource
# HELP container_cpu_usage_seconds_total [ALPHA] Cumulative cpu time consumed by the container in core-seconds
# TYPE container_cpu_usage_seconds_total counter
container_cpu_usage_seconds_total{container="coredns",namespace="kube-system",pod="coredns-558bd4d5db-btrh6"} 2.657494525 1644508968019
container_cpu_usage_seconds_total{container="coredns",namespace="kube-system",pod="coredns-558bd4d5db-chjtb"} 2.606617234 1644508973949
container_cpu_usage_seconds_total{container="etcd",namespace="kube-system",pod="etcd-kind-control-plane"} 12.231783825 1644508965643
container_cpu_usage_seconds_total{container="kindnet-cni",namespace="kube-system",pod="kindnet-r8dn6"} 0.320790528 1644508973708
container_cpu_usage_seconds_total{container="kube-apiserver",namespace="kube-system",pod="kube-apiserver-kind-control-plane"} 37.480735424 1644508965882
container_cpu_usage_seconds_total{container="kube-controller-manager",namespace="kube-system",pod="kube-controller-manager-kind-control-plane"} 10.645146927 1644508963708
container_cpu_usage_seconds_total{container="kube-proxy",namespace="kube-system",pod="kube-proxy-89kfq"} 0.530498902 1644508968681
container_cpu_usage_seconds_total{container="kube-scheduler",namespace="kube-system",pod="kube-scheduler-kind-control-plane"} 2.825848511 1644508971551
container_cpu_usage_seconds_total{container="local-path-provisioner",namespace="local-path-storage",pod="local-path-provisioner-547f784dff-lbkw5"} 0.811959691 1644508971061
# HELP container_memory_working_set_bytes [ALPHA] Current working set of the container in bytes
# TYPE container_memory_working_set_bytes gauge
container_memory_working_set_bytes{container="coredns",namespace="kube-system",pod="coredns-558bd4d5db-btrh6"} 1.2992512e+07 1644508968019
container_memory_working_set_bytes{container="coredns",namespace="kube-system",pod="coredns-558bd4d5db-chjtb"} 1.3320192e+07 1644508973949
container_memory_working_set_bytes{container="etcd",namespace="kube-system",pod="etcd-kind-control-plane"} 3.1367168e+07 1644508965643
container_memory_working_set_bytes{container="kindnet-cni",namespace="kube-system",pod="kindnet-r8dn6"} 1.097728e+07 1644508973708
container_memory_working_set_bytes{container="kube-apiserver",namespace="kube-system",pod="kube-apiserver-kind-control-plane"} 2.8678144e+08 1644508965882
container_memory_working_set_bytes{container="kube-controller-manager",namespace="kube-system",pod="kube-controller-manager-kind-control-plane"} 5.0200576e+07 1644508963708
container_memory_working_set_bytes{container="kube-proxy",namespace="kube-system",pod="kube-proxy-89kfq"} 1.634304e+07 1644508968681
container_memory_working_set_bytes{container="kube-scheduler",namespace="kube-system",pod="kube-scheduler-kind-control-plane"} 2.041856e+07 1644508971551
container_memory_working_set_bytes{container="local-path-provisioner",namespace="local-path-storage",pod="local-path-provisioner-547f784dff-lbkw5"} 8.323072e+06 1644508971061
# HELP node_cpu_usage_seconds_total [ALPHA] Cumulative cpu time consumed by the node in core-seconds
# TYPE node_cpu_usage_seconds_total counter
node_cpu_usage_seconds_total 142.565468839 1644508969738
# HELP node_memory_working_set_bytes [ALPHA] Current working set of the node in bytes
# TYPE node_memory_working_set_bytes gauge
node_memory_working_set_bytes 7.83990784e+08 1644508969738
# HELP pod_cpu_usage_seconds_total [ALPHA] Cumulative cpu time consumed by the pod in core-seconds
# TYPE pod_cpu_usage_seconds_total counter
pod_cpu_usage_seconds_total{namespace="kube-system",pod="coredns-558bd4d5db-btrh6"} 2.680536017 1644508966676
pod_cpu_usage_seconds_total{namespace="kube-system",pod="coredns-558bd4d5db-chjtb"} 2.607255646 1644508965908
pod_cpu_usage_seconds_total{namespace="kube-system",pod="etcd-kind-control-plane"} 12.394894692 1644508975738
pod_cpu_usage_seconds_total{namespace="kube-system",pod="kindnet-r8dn6"} 0.337305245 1644508967915
pod_cpu_usage_seconds_total{namespace="kube-system",pod="kube-apiserver-kind-control-plane"} 37.31684689 1644508961782
pod_cpu_usage_seconds_total{namespace="kube-system",pod="kube-controller-manager-kind-control-plane"} 10.855138548 1644508976931
pod_cpu_usage_seconds_total{namespace="kube-system",pod="kube-proxy-89kfq"} 0.546557391 1644508976955
pod_cpu_usage_seconds_total{namespace="kube-system",pod="kube-scheduler-kind-control-plane"} 2.853696788 1644508972852
pod_cpu_usage_seconds_total{namespace="local-path-storage",pod="local-path-provisioner-547f784dff-lbkw5"} 0.837150437 1644508968191
# HELP pod_memory_working_set_bytes [ALPHA] Current working set of the pod in bytes
# TYPE pod_memory_working_set_bytes gauge
pod_memory_working_set_bytes{namespace="kube-system",pod="coredns-558bd4d5db-btrh6"} 1.3889536e+07 1644508966676
pod_memory_working_set_bytes{namespace="kube-system",pod="coredns-558bd4d5db-chjtb"} 1.4692352e+07 1644508965908
pod_memory_working_set_bytes{namespace="kube-system",pod="etcd-kind-control-plane"} 3.258368e+07 1644508975738
pod_memory_working_set_bytes{namespace="kube-system",pod="kindnet-r8dn6"} 1.1800576e+07 1644508967915
pod_memory_working_set_bytes{namespace="kube-system",pod="kube-apiserver-kind-control-plane"} 2.8782592e+08 1644508961782
pod_memory_working_set_bytes{namespace="kube-system",pod="kube-controller-manager-kind-control-plane"} 5.1437568e+07 1644508976931
pod_memory_working_set_bytes{namespace="kube-system",pod="kube-proxy-89kfq"} 1.738752e+07 1644508976955
pod_memory_working_set_bytes{namespace="kube-system",pod="kube-scheduler-kind-control-plane"} 2.1475328e+07 1644508972852
pod_memory_working_set_bytes{namespace="local-path-storage",pod="local-path-provisioner-547f784dff-lbkw5"} 9.453568e+06 1644508968191
# HELP scrape_error [ALPHA] 1 if there was an error while getting container metrics, 0 otherwise
# TYPE scrape_error gauge
scrape_error 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment