【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
相关推荐
SirLancelot11 天前
K8s-kubernetes(二)资源限制-详细介绍
微服务·云原生·容器·kubernetes·k8s·devops·kubelet
静谧之心7 天前
分层架构下的跨层通信:接口抽象如何解决反向调用
java·开发语言·设计模式·架构·golang·k8s·解耦
昕光xg7 天前
istio笔记03--快速上手多集群mesh
云原生·k8s·istio·服务网格·kind
无敌糖果14 天前
K8S的Pod之initC容器restartPolicy新特性
云原生·容器·kubernetes·pod·restartpolicy·容器重启
退役小学生呀20 天前
十七、K8s 可观测性:全链路追踪
linux·云原生·容器·kubernetes·k8s
岚天start20 天前
在K8S环境中,telnet nodePort端口是通的,但是 ss 获取不到端口号原因解析
iptables·kubernetes·k8s·telnet·ss
Kentos(acoustic ver.)22 天前
云原生 —— K8s 容器编排系统
云原生·容器·kubernetes·云计算·k8s
汪碧康1 个月前
【k8s集群管理平台】k8s运维管理的新玩法,让运维电脑随时不离身的现状成为过去
容器·kubernetes·k8s·rancher
老马啸西风1 个月前
windows wsl2-05-docker 安装笔记
运维·windows·笔记·docker·容器·k8s
一切顺势而行1 个月前
k8s 基本架构
k8s