【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
相关推荐
riverz122720 小时前
k8s fsGroup
k8s
茶本无香3 天前
Kubernetes(K8s)核心架构解析与实用命令大全
容器·架构·kubernetes·k8s
有梦想的攻城狮4 天前
etcd详解
数据库·k8s·etcd
藥瓿亭5 天前
2024 CKA模拟系统制作 | Step-By-Step | 18、题目搭建-备份还原Etcd
linux·运维·服务器·ubuntu·kubernetes·etcd·cka
玄德公笔记5 天前
ubuntu 22.04安装k8s高可用集群
linux·ubuntu·kubernetes·k8s·containerd·高可用集群·ubuntu 22.04
搞不懂语言的程序员6 天前
开发时如何通过Service暴露应用?ClusterIP、NodePort和LoadBalancer类型的使用场景分别是什么?
k8s
川川籽15 天前
minikube dashboard ImagePullBackOff 失败问题的解决方法
docker·k8s
格桑阿sir16 天前
Kubernetes控制平面组件:Kubelet详解(七):容器网络接口 CNI
kubernetes·k8s·kubelet·flannel·cni·calico·网络模型
一个天蝎座 白勺 程序猿18 天前
Python爬虫(29)Python爬虫高阶:动态页面处理与云原生部署全链路实践(Selenium、Scrapy、K8s)
redis·爬虫·python·selenium·scrapy·云原生·k8s
格桑阿sir23 天前
Kubernetes控制平面组件:Kubelet 之 Static 静态 Pod
kubernetes·k8s·kubelet·static pod·静态pod·mirror pod·镜像pod