【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
相关推荐
南方以南_20 小时前
CKA07--Argo CD
运维·kubernetes·k8s
Matana11120 小时前
CentOS7 + VMware 搭建 K3s 集群遇到的网络问题全记录与解决方案
k8s
nvd113 天前
GKE 部署 - 从`kubectl` 到 Helm Chart 的演进
k8s
虚伪的空想家4 天前
记录次etcd故障,fatal error: bus error
服务器·数据库·k8s·etcd
岚天start6 天前
KubeSphere在线安装单节点K8S集群
docker·容器·kubernetes·k8s·kubesphere·kubekey
似水流年 光阴已逝7 天前
Kubernetes Pod 基本原理:全面详解
云原生·容器·kubernetes·pod
小坏讲微服务7 天前
五分钟使用 Docker-compose搭建 Redis 8.0 中间件
运维·redis·docker·中间件·容器·kubernetes·k8s
退役小学生呀11 天前
二十二、DevOps:基于Tekton的云原生平台落地(三)
linux·云原生·容器·kubernetes·k8s·devops·tekton
cc202292812 天前
ingress概念和实际运用
容器·kubernetes·k8s
The god of big data12 天前
Metrics Server 完整配置安装手册
云原生·云计算·k8s