• Home
  • About
  • Contact
  • Privacy
  • Terms
  • DCMA
  • Write For Us / Submit
Tech News, Magazine & Review WordPress Theme 2017
  • Tech
    How Drones and 360-Degree Cameras Are Changing Bridal Photoshoots

    How Drones and 360-Degree Cameras Are Changing Bridal Photoshoots

    120+ Best Creative Names for Team at Work

    120+ Best Creative Names for Team at Work

    Can You Repair Printed Circuit Board ?

    Mastering PCB Board Repair Comprehensive Guide

    Breaking Barriers Federal Inmate Texting Service

    Breaking Barriers Federal Inmate Texting Service

    transfer whatsapp from android to iphone

    How to Transfer WhatsApp from Android to iPhone!

    Understanding the Role of Humidity Chambers in Climate Testing

    Understanding the Role of Humidity Chambers in Climate Testing

    Everything You Get to Know About Movember Beard Memes

    Everything You Get to Know About Movember Beard Memes

    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

  • Gear
    • All
    • Camera
    • Laptop
    • Smartphone
    The New Galaxy Watch Ultra and Galaxy Ring Are Announced by Samsung

    The New Galaxy Watch Ultra and Galaxy Ring Are Announced by Samsung

    Exploring the Innovative Features of Pear Phones

    Exploring the Innovative Features of Pear Phones

    Latest Smart Home Gadgets for a Connected Life

    Latest Smart Home Gadgets for a Connected Life

    Eco-Friendly Products for Students

    Eco-Friendly Products for Students

    Essential Photography Equipment and Gadgets

    Mastering Your Shots: Essential Photography Equipment and Gadgets

    Level Up Your Game: Must-Have Gaming Gear!

    Level Up Your Game: Must-Have Gaming Gear!

    Trending Tags

    • Best iPhone 7 deals
    • Apple Watch 2
    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • iOS 10
    • iPhone 7
    • Sillicon Valley
  • Gaming
    Master the World of Online Gaming with the Best Gaming VPN

    Master the World of Online Gaming with 3 Best Gaming VPN

    7 Powerful Strategies to Overcome Video Game Addiction and Reclaim Your Life

    7 Powerful Strategies to Overcome Video Game Addiction and Reclaim Your Life

    Powerful Ways Xbox Cloud Gaming is Revolutionizing the Gaming World

    5 Powerful Ways Xbox Cloud Gaming is Revolutionizing the Gaming World

    9 Best Alternative Games Like Kahoot

    9 Best Alternative Games Like Kahoot

    The Top 8 Free Bubble Shooter Games for Endless Entertainment

    The Top 8 Free Bubble Shooter Games for Endless Entertainment

    Cloud Gaming Revolution: How Streaming is Changing the Future of Gaming

    Cloud Gaming Revolution: How Streaming is Changing the Future of Gaming

  • Crypto
    How Drones and 360-Degree Cameras Are Changing Bridal Photoshoots

    How Drones and 360-Degree Cameras Are Changing Bridal Photoshoots

    120+ Best Creative Names for Team at Work

    120+ Best Creative Names for Team at Work

    Can You Repair Printed Circuit Board ?

    Mastering PCB Board Repair Comprehensive Guide

    Breaking Barriers Federal Inmate Texting Service

    Breaking Barriers Federal Inmate Texting Service

    transfer whatsapp from android to iphone

    How to Transfer WhatsApp from Android to iPhone!

    Understanding the Role of Humidity Chambers in Climate Testing

    Understanding the Role of Humidity Chambers in Climate Testing

    Everything You Get to Know About Movember Beard Memes

    Everything You Get to Know About Movember Beard Memes

    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

  • Business
    How Drones and 360-Degree Cameras Are Changing Bridal Photoshoots

    How Drones and 360-Degree Cameras Are Changing Bridal Photoshoots

    120+ Best Creative Names for Team at Work

    120+ Best Creative Names for Team at Work

    Can You Repair Printed Circuit Board ?

    Mastering PCB Board Repair Comprehensive Guide

    Breaking Barriers Federal Inmate Texting Service

    Breaking Barriers Federal Inmate Texting Service

    transfer whatsapp from android to iphone

    How to Transfer WhatsApp from Android to iPhone!

    Understanding the Role of Humidity Chambers in Climate Testing

    Understanding the Role of Humidity Chambers in Climate Testing

    Everything You Get to Know About Movember Beard Memes

    Everything You Get to Know About Movember Beard Memes

    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

No Result
View All Result
Geeky Insider
  • Tech
    How Drones and 360-Degree Cameras Are Changing Bridal Photoshoots

    How Drones and 360-Degree Cameras Are Changing Bridal Photoshoots

    120+ Best Creative Names for Team at Work

    120+ Best Creative Names for Team at Work

    Can You Repair Printed Circuit Board ?

    Mastering PCB Board Repair Comprehensive Guide

    Breaking Barriers Federal Inmate Texting Service

    Breaking Barriers Federal Inmate Texting Service

    transfer whatsapp from android to iphone

    How to Transfer WhatsApp from Android to iPhone!

    Understanding the Role of Humidity Chambers in Climate Testing

    Understanding the Role of Humidity Chambers in Climate Testing

    Everything You Get to Know About Movember Beard Memes

    Everything You Get to Know About Movember Beard Memes

    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

  • Gear
    • All
    • Camera
    • Laptop
    • Smartphone
    The New Galaxy Watch Ultra and Galaxy Ring Are Announced by Samsung

    The New Galaxy Watch Ultra and Galaxy Ring Are Announced by Samsung

    Exploring the Innovative Features of Pear Phones

    Exploring the Innovative Features of Pear Phones

    Latest Smart Home Gadgets for a Connected Life

    Latest Smart Home Gadgets for a Connected Life

    Eco-Friendly Products for Students

    Eco-Friendly Products for Students

    Essential Photography Equipment and Gadgets

    Mastering Your Shots: Essential Photography Equipment and Gadgets

    Level Up Your Game: Must-Have Gaming Gear!

    Level Up Your Game: Must-Have Gaming Gear!

    Trending Tags

    • Best iPhone 7 deals
    • Apple Watch 2
    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • iOS 10
    • iPhone 7
    • Sillicon Valley
  • Gaming
    Master the World of Online Gaming with the Best Gaming VPN

    Master the World of Online Gaming with 3 Best Gaming VPN

    7 Powerful Strategies to Overcome Video Game Addiction and Reclaim Your Life

    7 Powerful Strategies to Overcome Video Game Addiction and Reclaim Your Life

    Powerful Ways Xbox Cloud Gaming is Revolutionizing the Gaming World

    5 Powerful Ways Xbox Cloud Gaming is Revolutionizing the Gaming World

    9 Best Alternative Games Like Kahoot

    9 Best Alternative Games Like Kahoot

    The Top 8 Free Bubble Shooter Games for Endless Entertainment

    The Top 8 Free Bubble Shooter Games for Endless Entertainment

    Cloud Gaming Revolution: How Streaming is Changing the Future of Gaming

    Cloud Gaming Revolution: How Streaming is Changing the Future of Gaming

  • Crypto
    How Drones and 360-Degree Cameras Are Changing Bridal Photoshoots

    How Drones and 360-Degree Cameras Are Changing Bridal Photoshoots

    120+ Best Creative Names for Team at Work

    120+ Best Creative Names for Team at Work

    Can You Repair Printed Circuit Board ?

    Mastering PCB Board Repair Comprehensive Guide

    Breaking Barriers Federal Inmate Texting Service

    Breaking Barriers Federal Inmate Texting Service

    transfer whatsapp from android to iphone

    How to Transfer WhatsApp from Android to iPhone!

    Understanding the Role of Humidity Chambers in Climate Testing

    Understanding the Role of Humidity Chambers in Climate Testing

    Everything You Get to Know About Movember Beard Memes

    Everything You Get to Know About Movember Beard Memes

    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

  • Business
    How Drones and 360-Degree Cameras Are Changing Bridal Photoshoots

    How Drones and 360-Degree Cameras Are Changing Bridal Photoshoots

    120+ Best Creative Names for Team at Work

    120+ Best Creative Names for Team at Work

    Can You Repair Printed Circuit Board ?

    Mastering PCB Board Repair Comprehensive Guide

    Breaking Barriers Federal Inmate Texting Service

    Breaking Barriers Federal Inmate Texting Service

    transfer whatsapp from android to iphone

    How to Transfer WhatsApp from Android to iPhone!

    Understanding the Role of Humidity Chambers in Climate Testing

    Understanding the Role of Humidity Chambers in Climate Testing

    Everything You Get to Know About Movember Beard Memes

    Everything You Get to Know About Movember Beard Memes

    Best Book Recommendation Apps

    11 Best Book Recommendation Apps

    How to quickly divide or Split PDF files

    How to Quickly Divide or Split PDF Files

Submit
Geeky Insider
No Result
View All Result

How to Monitor Kubernetes Resource Usage With Metrics Server and Kubectl Top

by Staff Writer
August 12, 2022
in Gadget and Gear
Reading Time: 5 mins read
Kubernetes logo
Share on FacebookShare on Twitter

Monitoring the resource usage of your Kubernetes cluster is essential so you can track performance and understand whether your workloads are operating efficiently. The kubectl top command streams metrics directly from your cluster, letting you access the basics in your terminal.

This command won’t usually work straightaway in a fresh Kubernetes environment. It depends on the Metrics Server addon being installed in your cluster. This component collects metrics from your Nodes and Pods and provides an API to retrieve the data.

Table of Contents

Toggle
    • READ ALSO
    • Mastering Your Shots: Essential Photography Equipment and Gadgets
    • Level Up Your Game: Must-Have Gaming Gear!
  • Adding Metrics Server to Kubernetes
  • Retrieving Metrics With Kubectl Top
  • Changing the Object Sort Order
  • Filtering the Object List
  • Getting the Utilization of a Specific Resource
  • Summary

READ ALSO

Latest Smart Home Gadgets for a Connected Life

Latest Smart Home Gadgets for a Connected Life

September 1, 2023
Eco-Friendly Products for Students

Eco-Friendly Products for Students

August 24, 2023

In this article we’ll show how to install Metrics Server and access its measurements using kubectl top. You’ll be able to view the CPU and memory consumption of each of your Nodes and Pods.

Adding Metrics Server to Kubernetes

Kubernetes distributions don’t normally come with Metrics Server built-in. You can easily check whether your cluster already has support by trying to run kubectl top:

$ kubectl top node
error: Metrics API not available

The error message confirms that the metrics server API is not present in the cluster.

Metrics Server is maintained within the Kubernetes Special Interest Group (SIG) community. It can be added to your cluster using its plain YAML manifest or the project’s Helm chart.

We’ll use the manifest file for this tutorial. Run the following Kubectl command to install the Metrics Server:

$ kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
serviceaccount/metrics-server created
clusterrole.rbac.authorization.k8s.io/system:aggregated-metrics-reader created
clusterrole.rbac.authorization.k8s.io/system:metrics-server created
rolebinding.rbac.authorization.k8s.io/metrics-server-auth-reader created
clusterrolebinding.rbac.authorization.k8s.io/metrics-server:system:auth-delegator created
clusterrolebinding.rbac.authorization.k8s.io/system:metrics-server created
service/metrics-server created
deployment.apps/metrics-server created
apiservice.apiregistration.k8s.io/v1beta1.metrics.k8s.io created

Metrics Server will now start collecting and exposing Kubernetes resource consumption data. If the installation fails with an error, you should check your cluster meets the project’s requirements. Metrics Server has specific dependencies which may not be supported in some environments.

Many Kubernetes distributions bundle Metrics Server support using their own addons system. You can use this command to easily add Metrics Server to a Minikube cluster, for example:

$ minikube addons enable metrics-server
Using image k8s.gcr.io/metrics-server/metrics-server:v0.4.2
The ‘metrics-server’ addon is enabled

Retrieving Metrics With Kubectl Top

With Metrics Server installed, you can now run kubectl top to access the information it collects.

Use the node sub-command to get the current resource utilization of each of the Nodes in your cluster:

$ kubectl top node
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
minikube 249m 3% 847Mi 2%

The pod sub-command provides individual metrics for each of your Pods:

$ kubectl top pod
NAME CPU(cores) MEMORY(bytes)
nginx 120m 8Mi

This will surface Pods in the default namespace. Add the –namespace flag if you’re interested in Pods in a specific namespace:

$ kubectl top pod –namespace demo-app
NAME CPU(cores) MEMORY(bytes)
nginx 0m 2Mi

The –all-namespaces flag is also supported to list every Pod in your cluster.

Metrics may take a few minutes to become available after new Pods are created. There’s a delay in the metrics server’s pipeline so it doesn’t become a performance issue itself.

The kubectl top command doesn’t overwhelm you with dozens of metrics. It focuses on covering the bare essentials of CPU and memory usage. This basic start can be adequate for scenarios where you simply need data fast, such as identifying the Pod that’s caused a spike in overall utilization.

One source of confusion can be the 100m values reported in the CPU(cores) field. The command displays CPU usage in millicores. A measurement of 1000m always means 100% consumption of a single CPU core. 500m indicates 50% consumption of one core, while 2000m means two cores are being occupied.

Changing the Object Sort Order

The kubectl top command can optionally sort the emitted object list by CPU or memory consumption. This makes it easier to quickly spot the Nodes or Pods that are exerting the highest pressure on cluster resources.

Add the –sort-by flag with either cpu or memory as its value to activate this behavior:

$ kubectl top pod –sort-by=memory
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
nginx-1 249m 3% 1790Mi 5%
nginx-2 150m 1% 847Mi 2%

Filtering the Object List

In common with other Kubectl commands, the –selector flag lets you filter the object list to items with specific labels:

$ kubectl top pod –selector application=demo-app
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
nginx-1 249m 3% 1790Mi 5%
nginx-2 150m 1% 847Mi 2%

In this example, only Pods that have the application: demo-app label will be included in the output. =, ==, and != are supported as operators. Multiple constraints can be applied by stringing them together as a comma-separated string, such as application=demo-app,version!=1. Objects will only show up if they match all of the label filters in your query.

Getting the Utilization of a Specific Resource

The top node and top pod sub-commands can both be passed the name of a specific Node or Pod to fetch. The current metrics associated with that item will be displayed in isolation.

Supply the object’s name as a plain argument to the command, straight after node or pod:

$ kubectl top node minikube
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
minikube 245m 3% 714Mi 2%

Summary

The kubectl top command surfaces essential resource consumption metrics for Nodes and Pods in your Kubernetes cluster. You can use it to quickly check the CPU and memory usage associated with each of your workloads. This information can be helpful to diagnose performance issues and identify when it’s time to add another Node.

Before using the command, you need to install the Kubernetes Metrics Server in your cluster. This provides the API that exposes resource utilization data. Enabling Metrics Server incurs a performance overhead but this is usually negligible in most deployments. It typically requires 1m core of CPU and 2MiB of memory per monitored Node, although this may vary with the workloads running in your specific environment.



Source by www.howtogeek.com

Related Posts

The New Galaxy Watch Ultra and Galaxy Ring Are Announced by Samsung
Smartphone

The New Galaxy Watch Ultra and Galaxy Ring Are Announced by Samsung

July 11, 2024
Exploring the Innovative Features of Pear Phones
Smartphone

Exploring the Innovative Features of Pear Phones

October 25, 2023
Latest Smart Home Gadgets for a Connected Life
Gadget and Gear

Latest Smart Home Gadgets for a Connected Life

September 1, 2023
Eco-Friendly Products for Students
Gadget and Gear

Eco-Friendly Products for Students

August 24, 2023

Recommended.

Crypto’s bear market is unlike others before it. This time the Fed's steering the ship

Ether (ETH) drops 15% since Ethereum merge as traders take profits

September 20, 2022
Pfizer Buys App That Diagnoses COVID-19 by Analyzing a Cough’s Sound

Pfizer Buys App That Diagnoses COVID-19 by Analyzing a Cough’s Sound

October 4, 2022

Trending.

No Content Available
  • Home
  • About
  • Contact
  • Privacy
  • Terms
  • DCMA
  • Write For Us / Submit
Contact us for submission queries. editor[at]geekyinsider.com.
No Result
View All Result
  • Home
  • Review
  • Apple
  • Gaming
  • Gadget and Gear
    • Camera
    • Smartphone
  • Microsoft
  • Security