【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
相关推荐
云上艺旅1 天前
K8S学习之基础十五:k8s中Deployment扩容缩容
学习·docker·云原生·kubernetes·k8s
云上艺旅3 天前
K8S学习之基础十六:k8s中Deployment更新策略
学习·云原生·kubernetes·k8s
john1377243 天前
云原生系列之本地k8s环境搭建
docker·云原生·minikube·k8s
问道飞鱼9 天前
【Kubernets】K8S内部nginx访问Service资源原理说明
nginx·k8s·service·kubernets
loop lee12 天前
【K8S】Kubernetes 基本架构、节点类型及运行流程详解(附架构图及流程图)
分布式·k8s
thinkerCoder13 天前
ubuntu 20.04系统离线安装nfs
ubuntu·k8s·共享文件·k8
菠菠萝宝15 天前
【Java八股文】11-分布式及场景面试篇
java·分布式·面试·k8s·系统·uuid·mq
AliCloudROS16 天前
阿里云ACK+GitLab企业级部署实战教程
k8s·gitlab·helm·ack·计算巢
仇辉攻防16 天前
【云安全】云原生- K8S 污点横移
web安全·网络安全·云原生·容器·kubernetes·k8s·安全威胁分析
明明跟你说过17 天前
【Kubernetes】常用命令全解析:从入门到实战(下)
运维·云原生·容器·kubernetes·k8s