【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
相关推荐
虚伪的空想家19 小时前
云镜像,虚拟机镜像怎么转换成容器镜像
服务器·docker·容器·k8s·镜像·云镜像·虚机
ohoy1 天前
ubuntu k8s1.32集群安装
k8s
武子康1 天前
AI研究-134 Java 2025:会衰退吗?LTS 路线、云原生与工程化落地趋势研究
java·开发语言·人工智能·python·ai·云原生·k8s
iru10 天前
kubectl cp详解,k8s集群与本地环境文件拷贝
运维·容器·k8s
竹君子12 天前
研发管理知识库(15)K8s和Istio关系
k8s
像风一样自由202016 天前
告别“在我电脑上能跑”:Docker入门与核心概念解析
docker·容器·k8s
Garfield200519 天前
Kubeflow 运行容器时 ENTRYPOINT 被覆盖导致环境变量未生效问题分析与解决
k8s·dockerfile·kubeflow·entrypoint
南方以南_21 天前
CKA07--Argo CD
运维·kubernetes·k8s
Matana11121 天前
CentOS7 + VMware 搭建 K3s 集群遇到的网络问题全记录与解决方案
k8s
nvd1123 天前
GKE 部署 - 从`kubectl` 到 Helm Chart 的演进
k8s