【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
相关推荐
matrixlzp4 天前
K8S 基于本地存储的持久卷
云原生·容器·kubernetes·k8s
matrixlzp5 天前
K8S PV 与 PVC 快速开始、入门实战
云原生·容器·kubernetes·k8s
A尘埃6 天前
K8S的使用(部署pod\service)+安装kubesphere图形化界面使用和操作
k8s·kubesphere
matrixlzp8 天前
K8S ConfigMap 快速开始
k8s
yuanlaile14 天前
Go全栈_Golang、Gin实战、Gorm实战、Go_Socket、Redis、Elasticsearch、微服务、K8s、RabbitMQ全家桶
linux·redis·golang·k8s·rabbitmq·gin
人生偌只如初见14 天前
Kubernetes学习笔记-配置Service对接第三方访问
kubernetes·k8s
企鹅侠客14 天前
简述删除一个Pod流程?
面试·kubernetes·pod·删除pod流程
梁萌15 天前
14-DevOps-快速部署Kubernetes
运维·kubernetes·k8s·devops·kubeode
时迁24716 天前
【k8s】k8s是怎么实现自动扩缩的
云原生·容器·kubernetes·k8s
时迁24718 天前
【k8s】LVS/IPVS的三种模式:NAT、DR、TUN
kubernetes·k8s·lvs