Categorygithub.com/stephenzhang0713/k8s-monitor
modulepackage
0.0.0-20240731135952-1808d0ac5b63
Repository: https://github.com/stephenzhang0713/k8s-monitor.git
Documentation: pkg.go.dev

# README

k8s-monitor

Go Report Card License

k8s-monitor 是一个简单的命令行工具,用于实时监控 Kubernetes 中特定 Pod 的 CPU 和内存使用情况。该工具使用 Kubernetes Metrics API 来获取和展示 Pod 资源使用数据。

功能

  • 监控指定 Pod 的 CPU 和内存使用情况。
  • 支持指定 Kubernetes 命名空间中的 Pod。
  • 显示每个容器的资源使用情况。

开始使用

前提条件

  • 一个运行中的 Kubernetes 集群。
  • 集群中已部署 Metrics Server。
  • 你的机器上配置有对集群的访问权限(~/.kube/config 或通过 KUBECONFIG 环境变量指定)。

安装

go install github.com/stephenzhang0713/k8s-monitor@latest

使用

运行下面的命令来监控一个 Pod:

./k8s-monitor -p POD_NAME -n NAMESPACE

参数说明:

-p: 要监控的 Pod 名称。
-n: Pod 所在的命名空间。如果未指定,默认为 default。

# Packages

Copyright © 2024 Stephen Zhang [email protected] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.