【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
相关推荐
Eminem893 天前
14、k8s持久化存储
k8s
上火的金鱼妹5 天前
higress网关访问+ 模型访问的安全策略管控
k8s·higress·ai网关
weixin_444579305 天前
Containerd
容器·k8s
Dragon_qu·x7 天前
MongoDB 高可用集群部署
运维·数据库·mongodb·k8s·helm
此冬歌咏14 天前
K8s 节点故障实战:优雅驱逐 31 秒,硬故障 331 秒,以及那个永远 Pending 的 Pod
运维·k8s
玉&心14 天前
通过Arthas在线诊断K8S中的内存及JVM等使用情况
docker·k8s·arthas
流烟默14 天前
K8s StatefulSet 详解:有状态应用的“身份证”与“固定住址”
k8s·statefulset
cg.family14 天前
K8S集群手动巡检
k8s
九皇叔叔14 天前
Kubernetes 资源管理方式详解:命令式与声明式管理
docker·容器·k8s
九皇叔叔15 天前
K8S 资源菜单
docker·容器·kubernetes·k8s