【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
相关推荐
lansye2 天前
MySQL K8S日志分析与数据还原
mysql·k8s
博睿谷IT99_6 天前
K8s 核心架构是什么?组件怎么协同工作的?
云原生·kubernetes·k8s·k8s pod 设计原理·容器编排与集群管理
RancherLabs9 天前
Rancher 社区双周报| Longhorn v1.10.0 重磅发布,企业级存储性能全面升级
kubernetes·k8s·rancher
我的offer在哪里13 天前
企业级 K8s 深度解析:从容器编排到云原生基石的十年演进
阿里云·k8s
霖.2424 天前
四种常用SVC(service)及其与Ingress协作方式
linux·服务器·云原生·kubernetes·k8s
博客园团队1 个月前
博客园出海记-K8S集群优化:一次命中注定的失败
k8s·出海记
小马过河R1 个月前
K8s引入Service Mesh原因及Istio入门
云原生·容器·kubernetes·k8s·istio·service_mesh
Gogo8161 个月前
k8s 跟 nacos 关于服务注册以及服务发现
java·nacos·k8s
@ chen1 个月前
kubectl常用命令
云原生·kubernetes·k8s
博客园团队1 个月前
博客园出海记-组装集装箱:自建 Kubernetes 集群
k8s·出海记