【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
相关推荐
Zsr10231 天前
K8s核心组件pod:进阶篇
云原生·容器·kubernetes·pod
Y.O.U..3 天前
Kubernetes-控制器介绍
k8s
大都督老师3 天前
配置 containerd 使用镜像加速器拉取 Docker Hub 镜像
容器·kubernetes·k8s
放寒假脚后跟v4 天前
Pod 的 YAML 文件中 exitCode 字段的具体含义、不同取值代表的场景
运维·云原生·容器·kubernetes·k8s
孤岛悬城4 天前
57 Rancher管理平台
云计算·k8s
HehuaTang5 天前
K8s labels 与 annotations 区别
k8s
百锦再9 天前
Elements Plus 跨设备自适应显示问题综合解决方案
python·flutter·小程序·uni-app·k8s·tornado·net
Font Tian11 天前
【云计算2025年度总结】汇总和反思
容器·云计算·k8s·openstack·虚拟化
Coder_Boy_11 天前
基于SpringAI的智能AIOps项目:部署相关容器化部署管理技术
人工智能·spring boot·k8s·运维开发
whltaoin14 天前
25年12月26日-福州某科技公司一面面试原题
java·linux·docker·面试·职场和发展·k8s·springboot