SlideShare a Scribd company logo
The Journey to the Kubernetes Metrics
智金處 智能系統部 黃晨懿
2021/12/22
1
Outline
• Scenario
• Kubernetes Monitoring Architecture
• Components details
• Conclusion
2
Scenario
• Monitoring cluster status at Grafana
• Check CPU and memory usage by kubectl top
3
example
Kubernetes Monitoring Architecture
4
source: https://github.com/kubernetes/design-proposals-archive/blob/main/instrumentation/monitoring_architecture.md
K8s architecture
5
source: https://github.com/kubernetes/design-proposals-archive/blob/main/instrumentation/monitoring_architecture.md
K8s architecture
6
Core metrics pipeline
Monitoring pipeline
Component details
7
kubectl top
• Check node and pod CPU and memory usage through CLI tool
provided by k8s
8
example
REST client: kubectl top -> API server
9
kubernetes/vendor/k8s.io/metrics/pkg/client/clientset/versioned/typed/metrics/v1beta1/nodemetrics.go
10
kubernetes/vendor/k8s.io/metrics/pkg/apis/metrics/types.go
API server
• Core component to communicate with k8s in control plane
• Expose Resource Metrics API to the following components
• kubectl top
• kube-scheduler
• HPA
• …
source: https://github.com/kubernetes/design-proposals-archive/blob/main/instrumentation/resource-metrics-api.md
11
metrics-server
• Store locally only latest values
• Expose the master metrics API
source: https://github.com/kubernetes-sigs/metrics-server
12
REST server: API server -> metrics-server
13
metrics-server/pkg/storage/node.go
metrics-server/pkg/storage/types.go
14
metrics-server/pkg/server/server.go
15
metrics-server/pkg/server/server.go
REST client: metrics-server -> kubelet
16
metrics-server/pkg/scraper/client/resource/client.go
Kubelet
• The daemon that runs on every kubernetes node and controls pod
and container lifecycle, among many other things.
• Combine container-level metrics form cAdvisor/CRI with the kubelets
knowledge of kubernetes constructs to produce the kubelet Summary
statistics.
source: https://github.com/kubernetes/design-proposals-archive/blob/main/instrumentation/core-metrics-pipeline.md
17
18
kubernetes/pkg/kubelet/kubelet.go
19
kubernetes/pkg/kubelet/stats/cri_stats_provider.go
gRPC client: kubelet -> CRI
20
kubernetes/pkg/kubelet/cri/remote/remote_runtime.go
Container Runtime Interface (CRI)
• The Container Runtime Interface designed to provide an abstraction
over runtimes (docker, rkt, etc).
• Consist of specs, protobuf API and libraries for container runtimes to
integrate with kubelet on a node
source:https://github.com/kubernetes/design-proposals-archive/blob/main/instrumentation/core-metrics-pipeline.md
21
gRPC client: kubelet -> CRI
22
kubernetes/pkg/kubelet/cri/remote/remote_runtime.go
23
containerd/vendor/k8s.io/cri-api/pkg/apis/runtime/v1/api.proto
gRPC server: kubelet -> containerd CRI
24
containerd/pkg/cri/server/container_stats_list.go
and it goes to Stats method…
25
containerd/runtime/v2/runc/v1/service.go
26
containerd/vendor/github.com/containerd/cgroups/cpuacct.go
Conclusion
27
source: https://github.com/kubernetes/design-proposals-archive/blob/main/instrumentation/monitoring_architecture.md
K8s architecture
28
Core metrics pipeline
Monitoring pipeline
• In Kubernetes Monitoring Architecture,
• Each component is responsible for producing, scraping and leveraging the
metrics
• Each component is communicated with API, such as RESTful API and gRPC
29
Backups
30
K8s architecture
31
32
cgroup
• cgroup core organizes processes hierarchically
• cgroup controller distributes system resources along the hierarchy in
a controlled and configurable manner.
• cgroup controllers:
• cpu
• memory
• …
source:https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt
33
source:https://www.kernel.org/doc/Documentation/cgroup-v1/cpuacct.txt
34
container = namespace + cgroup
example
35
container ID = cgroup ID
example
36
example

More Related Content

PPTX
Kubernetes 101
PDF
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
PDF
Running Kafka On Kubernetes With Strimzi For Real-Time Streaming Applications
PDF
Improving fault tolerance and scaling out in Kafka Streams with Bill Bejeck |...
PPTX
Fast Userspace OVS with AF_XDP, OVS CONF 2018
PDF
Meetup OpenTelemetry Intro
PDF
Log aggregation: using Elasticsearch, Fluentd/Fluentbit and Kibana (EFK)
PDF
Bastion jump hosts with Teleport
Kubernetes 101
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
Running Kafka On Kubernetes With Strimzi For Real-Time Streaming Applications
Improving fault tolerance and scaling out in Kafka Streams with Bill Bejeck |...
Fast Userspace OVS with AF_XDP, OVS CONF 2018
Meetup OpenTelemetry Intro
Log aggregation: using Elasticsearch, Fluentd/Fluentbit and Kibana (EFK)
Bastion jump hosts with Teleport

What's hot (20)

PDF
Apache Flink & Graph Processing
PDF
Fluent Bit: Log Forwarding at Scale
PDF
netfilter and iptables
PPTX
Spark tunning in Apache Kylin
PDF
EDB Postgres DBA Best Practices
 
PDF
YOW2018 Cloud Performance Root Cause Analysis at Netflix
PPTX
OpenStack Kolla Introduction
PDF
Service Mesh and Serverless Chatbots with Linkerd, K8s and OpenFaaS
PDF
Improve Monitoring and Observability for Kubernetes with OSS tools
PPTX
OpenTelemetry For Architects
PDF
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
PDF
LSFMM 2019 BPF Observability
PDF
Introduction to Greenplum
PPTX
Kafka at Peak Performance
PDF
Open Service Broker APIとKubernetes Service Catalog #k8sjp
PPT
Galera Cluster Best Practices for DBA's and DevOps Part 1
PPTX
A brief study on Kubernetes and its components
ODP
MySQL Group Replication
PDF
Rsyslog vs Systemd Journal (Paper)
PPTX
Everything You Need To Know About Persistent Storage in Kubernetes
Apache Flink & Graph Processing
Fluent Bit: Log Forwarding at Scale
netfilter and iptables
Spark tunning in Apache Kylin
EDB Postgres DBA Best Practices
 
YOW2018 Cloud Performance Root Cause Analysis at Netflix
OpenStack Kolla Introduction
Service Mesh and Serverless Chatbots with Linkerd, K8s and OpenFaaS
Improve Monitoring and Observability for Kubernetes with OSS tools
OpenTelemetry For Architects
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
LSFMM 2019 BPF Observability
Introduction to Greenplum
Kafka at Peak Performance
Open Service Broker APIとKubernetes Service Catalog #k8sjp
Galera Cluster Best Practices for DBA's and DevOps Part 1
A brief study on Kubernetes and its components
MySQL Group Replication
Rsyslog vs Systemd Journal (Paper)
Everything You Need To Know About Persistent Storage in Kubernetes
Ad

Similar to The journey to the kubernetes metrics (10)

PPTX
Kubernetes #2 monitoring
PDF
KubeCon Prometheus Salon -- Kubernetes metrics deep dive
PDF
Kubernetes Colorado - Kubernetes metrics deep dive 10/25/2017
PDF
20180503 kube con eu kubernetes metrics deep dive
PDF
Monitoring a Kubernetes-backed microservice architecture with Prometheus
PDF
Monitoring on Kubernetes using Prometheus - Chandresh
PPTX
Monitoring on Kubernetes using prometheus
PDF
Monitoring Kubernetes with Prometheus
PPSX
Service Mesh - Observability
PDF
Kubernetes monitoring introduction
Kubernetes #2 monitoring
KubeCon Prometheus Salon -- Kubernetes metrics deep dive
Kubernetes Colorado - Kubernetes metrics deep dive 10/25/2017
20180503 kube con eu kubernetes metrics deep dive
Monitoring a Kubernetes-backed microservice architecture with Prometheus
Monitoring on Kubernetes using Prometheus - Chandresh
Monitoring on Kubernetes using prometheus
Monitoring Kubernetes with Prometheus
Service Mesh - Observability
Kubernetes monitoring introduction
Ad

More from ChenYiHuang5 (10)

PDF
Upgrading Loki with a Canary Deployment: Enhancing Performance and Reducing C...
PDF
Grafana Alloy Best Practice presented in COSCUP 2024
PDF
The Journey to the Kubernetes networking.pdf
PDF
Paper Study: Transformer dissection
PDF
Paper Study: A learning based iterative method for solving vehicle routing
PDF
Paper study: Attention, learn to solve routing problems!
PDF
Paper Study: OptNet: Differentiable Optimization as a Layer in Neural Networks
PDF
Buddy system
PDF
Paper study: Learning to solve circuit sat
PDF
Paper Study: Melding the data decision pipeline
Upgrading Loki with a Canary Deployment: Enhancing Performance and Reducing C...
Grafana Alloy Best Practice presented in COSCUP 2024
The Journey to the Kubernetes networking.pdf
Paper Study: Transformer dissection
Paper Study: A learning based iterative method for solving vehicle routing
Paper study: Attention, learn to solve routing problems!
Paper Study: OptNet: Differentiable Optimization as a Layer in Neural Networks
Buddy system
Paper study: Learning to solve circuit sat
Paper Study: Melding the data decision pipeline

Recently uploaded (20)

PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
ai tools demonstartion for schools and inter college
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
top salesforce developer skills in 2025.pdf
PPTX
Introduction to Artificial Intelligence
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
System and Network Administration Chapter 2
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PTS Company Brochure 2025 (1).pdf.......
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
ai tools demonstartion for schools and inter college
How Creative Agencies Leverage Project Management Software.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Odoo Companies in India – Driving Business Transformation.pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Wondershare Filmora 15 Crack With Activation Key [2025
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
How to Migrate SBCGlobal Email to Yahoo Easily
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
top salesforce developer skills in 2025.pdf
Introduction to Artificial Intelligence
Upgrade and Innovation Strategies for SAP ERP Customers
Design an Analysis of Algorithms I-SECS-1021-03
System and Network Administration Chapter 2
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf

The journey to the kubernetes metrics