【CKA模拟题】查询消耗CPU最多的Pod

题干

For this question, please set this context (In exam, diff cluster name)

对于此问题,请设置此上下文(在考试中,diff 集群名称)

bash 复制代码
kubectl config use-context kubernetes-admin@kubernetes

Find the pod that consumes the most CPU in all namespace(including kube-system) in all cluster(currently we have single cluster). Then, store the result in the file high_cpu_pod.txt with the following format: pod_name,namespace .

在所有集群(当前我们只有一个集群)中,在所有命名空间(包括kube-system)中,找到消耗CPU最多的pod,然后将结果以如下格式存储到文件high_cpu_pod.txt中:pod_name,namespace。

解题思路

  1. 切换K8S集群环境
bash 复制代码
kubectl config use-context kubernetes-admin@kubernetes
  1. 通过kubectl top命令根据CPU排序查询
bash 复制代码
top pod -A --sort-by=cpu | awk -F ' ' '{print $2,$1}' | head -n 2 > high_cpu_pod.txt
相关推荐
cool32002 天前
二进制基于kubeasz部署 K8s 1.34.x 高可用集群实战指南-第二章:HAProxy + Keepalived负载均衡高可用配置(2-4)
容器·k8s·负载均衡
国医中兴3 天前
边缘计算中的存储挑战与解决方案
微服务·云原生·容器·kubernetes·k8s
国医中兴4 天前
分布式存储的缓存优化:从理论到实践
微服务·云原生·容器·kubernetes·k8s
古城小栈4 天前
Jenkins+K8s实现Go后端服务自动化部署
go·k8s·jenkins
国医中兴5 天前
数据稠密计算的内存优化:从理论到实践
微服务·云原生·容器·kubernetes·k8s
国医中兴6 天前
数据稠密计算的并行处理:从理论到实践
微服务·云原生·容器·kubernetes·k8s
adamlevine77 天前
【docker笔记-001】如何设置docker使得容器能在多个numa之间均匀使用内存
笔记·docker·容器·k8s·numa·numactl·k3s
leo_messi948 天前
2026版商城项目(一)
java·elasticsearch·k8s·springcloud
cool32008 天前
Kubernetes基础入门教程
容器·云计算·k8s
不是书本的小明11 天前
K8s探针实战:存活、就绪与启动三重保障
云原生·k8s