【CKA模拟题】查询消耗CPU最多的Pod

在这里插入图片描述

题干

For this question, please set this context (In exam, diff cluster name)

对于此问题,请设置此上下文(在考试中,diff 集群名称)

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集群环境
kubectl config use-context kubernetes-admin@kubernetes
  1. 通过kubectl top命令根据CPU排序查询
top pod -A --sort-by=cpu | awk -F ' ' '{print $2,$1}' | head -n 2 > high_cpu_pod.txt

在这里插入图片描述

相关推荐

  1. Linux查询内存或CPU占用几个进程

    2024-03-17 02:28:01       61 阅读
  2. 密码学系列2-安全模型(CPA,CCA,selective,adaptive)

    2024-03-17 02:28:01       32 阅读
  3. 运行时动态调整 Pod CPU 及 Memory 资源

    2024-03-17 02:28:01       30 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-17 02:28:01       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-17 02:28:01       106 阅读
  3. 在Django里面运行非项目文件

    2024-03-17 02:28:01       87 阅读
  4. Python语言-面向对象

    2024-03-17 02:28:01       96 阅读

热门阅读

  1. 面向对象(五)

    2024-03-17 02:28:01       44 阅读
  2. 2014

    2014

    2024-03-17 02:28:01      47 阅读
  3. KY158 找x

    2024-03-17 02:28:01       37 阅读
  4. 两个数组的交集

    2024-03-17 02:28:01       38 阅读
  5. 2403d,无串插件传播uda

    2024-03-17 02:28:01       42 阅读
  6. 条款09:绝不在析构和构造中调用virtual函数

    2024-03-17 02:28:01       38 阅读
  7. 远程过程调用-buttonrpc源码解析1-序列化

    2024-03-17 02:28:01       41 阅读