top 系统总览与进程实时监控 监控指标 - 系统负载 1/5/15分钟 可以结合 uptime 命令查看系统负载 - CPU状态 us sy id wa hi si - 内存 - 进程或线程 CPU/内存/状态(R/S/D) 可以结合 pidstat 命令查看CPU/内存 常用命令 top -c 按P M 1 top -p 7 按H查看线程 top -Hp 7
vmstat 系统整体运行队列与瓶颈 监控指标 - 进程 r(运行队列,等待CPU的进程数) b(阻塞在IO上的进程数) - 内存 - 交换 si/so(换入换出) bi/bo(块设备读写量) - 系统 in(每秒中断数) cs(每秒上下文切换数) - CPU us sy id wa 常用命令 vmstat -n 2 vmstat -n 2 10 工具 wget https://t.infuq.com/dl/vmstat.sh && bash vmstat.sh
kubectl get pods -n <namespace> -o wide kubectl exec -it <pod-name> -n <namespace> -- /bin/sh kubectl exec -it <pod-name> -c <container-name> -- /bin/sh kubectl describe pod <pod-name> -n <namespace> kubectl describe pod <pod-name> -n <namespace> | grep -A 5 "Containers:"
kubectl top pod -n <namespace> kubectl top pod <pod-name> -n <namespace> kubectl top pod <pod-name> --containers -n <namespace> kubectl top pod --sort-by=cpu -n <namespace> kubectl top pod --sort-by=memory -n <namespace> kubectl get deployment -n <namespace> kubectl get deployment <deployment-name> -n prod -o jsonpath='{.spec.template.spec.containers[*].resources}'