【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
相关推荐
ezreal_pan3 天前
Pod 重启多场景复盘:OOM、日志阻塞、并发 map 读写导致程序崩溃
docker·k8s
cg.family3 天前
containerd 1.6.33 + nerdctl 1.7.6 + Jenkins
k8s
Ningcode_cloud5 天前
Kubernetes 弹性伸缩实验手册:从集群搭建到 HPA / VPA 自动扩缩容
云原生·k8s·prometheus
ZzzZZzzzZZZzzzz…7 天前
K8s---组件
运维·云原生·容器·kubernetes·k8s·k8s组件
张洛闻Eren7 天前
云原生k8s【第八课】: ETCD 备份与恢复
linux·运维·docker·kubernetes·k8s
张洛闻Eren8 天前
云原生k8s【第七课】:集群监控与可观测性
linux·运维·docker·云原生·容器·kubernetes·k8s
Eminem899 天前
9、k8s亲和性与污点容忍度
k8s
鹤落晴春11 天前
有状态应用 vs 无状态应用
运维·云原生·k8s
Eminem8912 天前
8、k8s nodename和nodeSelector调度pod
k8s
cg.family14 天前
K8s内部pod间的负载均衡原理
k8s