【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故障排查三板斧-CSDN博客
运维·docker·云原生·kubernetes·k8s·容器化·故障排查
岳来2 天前
k8s pod 重启策略RestartPolicy 学习
容器·kubernetes·pod·restartpolicy
@王先生12 天前
【K8S-ETCD初始化三节点集群】
前端·chrome·k8s·etcd·集群
牛奶咖啡132 天前
CI/CD——在jenkins中构建流程实现springboot项目的自动化构建与部署
java·ci/cd·k8s·jenkins·springboot·springboot制作镜像·使用源码项目制作镜像
脑子加油站5 天前
K8S-Ingress资源对象
算法·贪心算法·k8s
~黄夫人~7 天前
Kubernetes 入门到实战:概念详解 + kubeadm 安装 + 节点克隆全流程
linux·运维·学习·k8s·集群
yunson_Liu13 天前
aws EKS集群pvc存储扩容
k8s·aws
张32316 天前
k8s etcd备份恢复
数据库·k8s·etcd
脑子加油站18 天前
kubernetes安装部署流程
k8s·安全架构
SilentSamsara18 天前
Kubernetes 网络模型:CNI 插件与 Pod 间通信的底层实现
网络·云原生·容器·架构·kubernetes·k8s