【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
相关推荐
小白不想白a2 天前
pod调度--预选阶段(重点说容忍)
k8s·运维开发
_运维那些事儿4 天前
GitLabCI-CD入门
运维·ci/cd·容器·云计算·k8s·运维开发
yumenai_5 天前
【K8s 避坑指南】2026 最新 Kubernetes v1.28 + Containerd 安装全流程(内网/离线通用版)
ubuntu·云原生·容器·kubernetes·k8s
玄德公笔记5 天前
Prometheus监控k8s的metric详解(第二版)-01-scrape 指标抓取
kubernetes·k8s·prometheus·监控·metric·scrape·k8s监控
岁岁种桃花儿8 天前
详解kubectl get replicaset命令及与kubectl get pods的核心区别
运维·nginx·容器·kubernetes·k8s
Paraverse_徐志斌9 天前
K8S HPA + KEDA 弹性伸缩消费者解决 MQ 消息积压
容器·kafka·kubernetes·k8s·linq·hpa·keda
linweidong9 天前
K8s节点保卫战:基于Node Local DNS架构的磁盘自愈系统设计
运维·docker·云原生·容器·架构·kubernetes·k8s
2301_8107463110 天前
CKA冲刺40天笔记 - day10 K8S namespace
笔记·容器·kubernetes·k8s
伞啊伞10 天前
HPA + Helm
k8s
孤岛悬城10 天前
64 K8s安全机制
kubernetes·云计算·k8s